mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-11 19:56:44 +00:00
feat: update FluentBit and OTelCollector configurations to include service name in headers and adjust logging level
This commit is contained in:
parent
f4b0548133
commit
367480fff1
3 changed files with 24 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
service:
|
||||
flush: 1
|
||||
log_level: info
|
||||
log_level: debug
|
||||
|
||||
pipeline:
|
||||
inputs:
|
||||
|
|
@ -8,29 +8,20 @@ pipeline:
|
|||
listen: 0.0.0.0
|
||||
port: 8889
|
||||
|
||||
processors:
|
||||
logs:
|
||||
- name: opentelemetry_envelope
|
||||
|
||||
- name: content_modifier
|
||||
context: otel_resource_attributes
|
||||
action: upsert
|
||||
key: service.name
|
||||
value: fluent-bit
|
||||
|
||||
outputs:
|
||||
- name: stdout
|
||||
match: '*'
|
||||
- name: opentelemetry
|
||||
match: '*'
|
||||
host: 'test.oneuptime.com'
|
||||
host: 'local.genosyn.com'
|
||||
port: 443
|
||||
metrics_uri: '/otlp/v1/metrics'
|
||||
logs_uri: '/otlp/v1/logs'
|
||||
traces_uri: '/otlp/v1/traces'
|
||||
tls: On
|
||||
header:
|
||||
- x-oneuptime-token 1e603f70-b3c8-11ef-9018-bdd11a3584d1
|
||||
- x-oneuptime-token ad29ff90-100f-11f0-a779-39a19251c0cf
|
||||
- x-oneuptime-service-name demo-service-1
|
||||
|
||||
|
||||
|
||||
|
|
@ -11,6 +11,9 @@ extensions:
|
|||
- action: upsert
|
||||
key: x-oneuptime-token
|
||||
from_context: x-oneuptime-token
|
||||
- action: upsert
|
||||
key: x-oneuptime-service-name
|
||||
from_context: x-oneuptime-service-name
|
||||
|
||||
processors:
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@ import TelemetryService from "Common/Models/DatabaseModels/TelemetryService";
|
|||
|
||||
export default class OtelIngestService {
|
||||
@CaptureSpan()
|
||||
public static getServiceNameFromAttributes(attributes: JSONArray): string {
|
||||
public static getServiceNameFromAttributes(
|
||||
req: ExpressRequest,
|
||||
attributes: JSONArray,
|
||||
): string {
|
||||
for (const attribute of attributes) {
|
||||
if (
|
||||
attribute["key"] === "service.name" &&
|
||||
|
|
@ -60,6 +63,16 @@ export default class OtelIngestService {
|
|||
}
|
||||
}
|
||||
|
||||
// if there's no service name, check header for x-oneuptime-service-name
|
||||
|
||||
const serviceName: string = req.headers[
|
||||
"x-oneuptime-service-name"
|
||||
] as string;
|
||||
|
||||
if (serviceName) {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
return "Unknown Service";
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +99,7 @@ export default class OtelIngestService {
|
|||
|
||||
for (const resourceLog of resourceLogs) {
|
||||
const serviceName: string = this.getServiceNameFromAttributes(
|
||||
req,
|
||||
((resourceLog["resource"] as JSONObject)?.[
|
||||
"attributes"
|
||||
] as JSONArray) || [],
|
||||
|
|
@ -283,6 +297,7 @@ export default class OtelIngestService {
|
|||
|
||||
for (const resourceMetric of resourceMetrics) {
|
||||
const serviceName: string = this.getServiceNameFromAttributes(
|
||||
req,
|
||||
((resourceMetric["resource"] as JSONObject)?.[
|
||||
"attributes"
|
||||
] as JSONArray) || [],
|
||||
|
|
@ -513,6 +528,7 @@ export default class OtelIngestService {
|
|||
// get service name from resourceSpan attributes
|
||||
|
||||
const serviceName: string = this.getServiceNameFromAttributes(
|
||||
req,
|
||||
((resourceSpan["resource"] as JSONObject)?.[
|
||||
"attributes"
|
||||
] as JSONArray) || [],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue