fix: start tracing only if enabled and endpoint exists#884
fix: start tracing only if enabled and endpoint exists#884ferhatelmas merged 1 commit intomasterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Cache: Disabled due to Reviews > Disable Cache setting Disabled knowledge base sources:
📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe change tightens OpenTelemetry tracing initialization: span processors are only created when a trace exporter exists (BatchSpanProcessor is instantiated inline alongside TenantSpanProcessor), and the SDK is started only if tracing is enabled, a trace exporter is configured, and at least one span processor is present. If tracing is enabled but no OTLP endpoint/trace exporter is configured, a warning is logged and SDK startup is skipped. Sequence Diagram(s)sequenceDiagram
participant Config as Tracing Config
participant Logger as Logger
participant Exporter as TraceExporter
participant Processors as SpanProcessors
participant SDK as Tracing SDK
Config->>Logger: Read tracingEnabled
alt tracingEnabled = false
Config->>Logger: Do not initialize tracing
else tracingEnabled = true
Config->>Exporter: Check for traceExporter (OTLP endpoint)
alt traceExporter exists
Exporter->>Processors: Create TenantSpanProcessor
Exporter->>Processors: Create BatchSpanProcessor (inline)
Processors->>SDK: Provide configured span processors
SDK->>SDK: Start SDK
SDK-->>Logger: Tracing started
else no traceExporter
Logger-->>Config: Log warning (tracing enabled but no exporter)
Config->>SDK: Skip SDK startup
end
end
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
2e9c044 to
7b7fc02
Compare
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
If tracing is enabled but endpoint is missing, instrumentation will start but won't export anything. Pure overhead.
What is the new behavior?
Start tracing only if enabled and exporter endpoint is given.
Additional context
None