diff options
| author | Stefan Boberg <[email protected]> | 2026-01-19 13:39:03 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-01-19 13:39:03 +0100 |
| commit | ee0c0810b5720a01318a0115da68760b20059459 (patch) | |
| tree | bcd25a41a639b487b9375830ee5e1e0d0c0cf9b6 /src/zentelemetry/otlptrace.cpp | |
| parent | small doc updates (#715) (diff) | |
| download | zen-ee0c0810b5720a01318a0115da68760b20059459.tar.xz zen-ee0c0810b5720a01318a0115da68760b20059459.zip | |
OTLP/trace improvements (#717)
This PR brings over some changes made to avoid performing setup for otel instrumentation if we are not sending otel information anywhere anyway.
It also adds the ability to configure an OTLP endpoint on the command line using `--otlp-endpoint=<URI>`.
Bear in mind that OTLP support is still not officially supported so this should not be used in production at this stage.
Diffstat (limited to 'src/zentelemetry/otlptrace.cpp')
| -rw-r--r-- | src/zentelemetry/otlptrace.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/zentelemetry/otlptrace.cpp b/src/zentelemetry/otlptrace.cpp index f987afcfe..6a095cfeb 100644 --- a/src/zentelemetry/otlptrace.cpp +++ b/src/zentelemetry/otlptrace.cpp @@ -273,7 +273,7 @@ IsRecording() std::atomic<bool> g_OtlpTraceEnabled{false}; -inline bool +bool IsOtlpTraceEnabled() { return g_OtlpTraceEnabled.load(); @@ -346,6 +346,12 @@ ScopedSpan::ScopedSpan(std::string_view Name) return; } + Initialize(Name); +} + +void +ScopedSpan::Initialize(std::string_view Name) +{ Tracer* TracerPtr = Tracer::GetTracer(); Tracer::Impl* const ImplPtr = TracerPtr->m_Impl; @@ -359,12 +365,9 @@ ScopedSpan::ScopedSpan(std::string_view Name) m_Span = NewSpan; } -ScopedSpan::ScopedSpan(Span* InSpan, Tracer* InTracer) : m_Tracer(InTracer), m_Span(InSpan) -{ -} - ScopedSpan::~ScopedSpan() { + // this is not inline to avoid code bloat on every use site } } // namespace zen::otel |