File tree Expand file tree Collapse file tree
include/opentelemetry/sdk/trace Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ Increment the:
3535 double range no longer downscales without end.
3636 [ #4353 ] ( https://github.com/open-telemetry/opentelemetry-cpp/pull/4353 )
3737
38+ * [ SDK] Remove TracerConfig copy from Tracer
39+ [ #4712 ] ( https://github.com/open-telemetry/opentelemetry-cpp/pull/4712 )
40+
3841* [ LOGS] Fix undefined behavior in ` Logger::EmitLogRecord() ` when a logger is
3942 enabled (e.g. via ` LoggerProvider::UpdateLoggerConfigurator() ` ) after
4043 ` CreateLogRecord() ` was called while it was still disabled. The disabled
Original file line number Diff line number Diff line change @@ -136,8 +136,6 @@ class Tracer final : public opentelemetry::trace::Tracer,
136136 // tracer-context.
137137 std::shared_ptr<InstrumentationScope> instrumentation_scope_;
138138 std::shared_ptr<TracerContext> context_;
139- mutable std::mutex tracer_config_mutex_;
140- TracerConfig tracer_config_;
141139#if OPENTELEMETRY_ABI_VERSION_NO < 2
142140 std::atomic<bool > is_enabled_{false };
143141#endif
Original file line number Diff line number Diff line change 33
44#include < chrono>
55#include < cstdint>
6- #include < mutex>
76#include < utility>
87
98#include " opentelemetry/context/context.h"
@@ -40,11 +39,10 @@ Tracer::Tracer(std::shared_ptr<TracerContext> context,
4039 std::unique_ptr<InstrumentationScope> instrumentation_scope)
4140 : instrumentation_scope_{std::move (instrumentation_scope)},
4241 context_{std::move (context)},
43- tracer_config_ (context_->GetTracerConfigurator ().ComputeConfig(*instrumentation_scope_)),
4442 noop_span_{std::make_shared<opentelemetry::trace::DefaultSpan>(
4543 opentelemetry::trace::SpanContext::GetInvalid ())}
4644{
47- UpdateEnabled (tracer_config_. IsEnabled ( ));
45+ UpdateTracerConfig (context_-> GetTracerConfigurator (). ComputeConfig (*instrumentation_scope_ ));
4846}
4947
5048nostd::shared_ptr<opentelemetry::trace::Span> Tracer::StartSpan (
@@ -196,12 +194,7 @@ void Tracer::CloseWithMicroseconds(uint64_t timeout) noexcept
196194
197195void Tracer::UpdateTracerConfig (TracerConfig config) noexcept
198196{
199- const bool enabled = config.IsEnabled ();
200- {
201- std::lock_guard<std::mutex> lock (tracer_config_mutex_);
202- tracer_config_ = config;
203- }
204- UpdateEnabled (enabled);
197+ UpdateEnabled (config.IsEnabled ());
205198}
206199
207200} // namespace trace
You can’t perform that action at this time.
0 commit comments