9
9
10
10
#include " opentelemetry/nostd/shared_ptr.h"
11
11
#include " opentelemetry/nostd/string_view.h"
12
+ #include " opentelemetry/sdk/instrumentationscope/scope_configurator.h"
12
13
#include " opentelemetry/sdk/resource/resource.h"
13
14
#include " opentelemetry/sdk/trace/id_generator.h"
14
15
#include " opentelemetry/sdk/trace/processor.h"
@@ -27,6 +28,8 @@ namespace sdk
27
28
namespace trace
28
29
{
29
30
31
+ using namespace opentelemetry ::sdk::instrumentationscope;
32
+
30
33
class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::TracerProvider
31
34
{
32
35
public:
@@ -39,30 +42,30 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T
39
42
* not be a nullptr.
40
43
* @param id_generator The custom id generator for this tracer provider. This must
41
44
* not be a nullptr
45
+ * @param tracer_configurator Provides access to a function that computes the TracerConfig for
46
+ * Tracers provided by this TracerProvider.
42
47
*/
43
48
explicit TracerProvider (
44
49
std::unique_ptr<SpanProcessor> processor,
45
50
const opentelemetry::sdk::resource::Resource &resource =
46
51
opentelemetry::sdk::resource::Resource::Create ({}),
47
52
std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler),
48
53
std::unique_ptr<IdGenerator> id_generator =
49
- std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept ;
54
+ std::unique_ptr<IdGenerator>(new RandomIdGenerator()),
55
+ std::unique_ptr<ScopeConfigurator<TracerConfig>> tracer_configurator =
56
+ std::make_unique<ScopeConfigurator<TracerConfig>>(
57
+ TracerConfig::DefaultConfigurator ())) noexcept ;
50
58
51
59
explicit TracerProvider (
52
60
std::vector<std::unique_ptr<SpanProcessor>> &&processors,
53
61
const opentelemetry::sdk::resource::Resource &resource =
54
62
opentelemetry::sdk::resource::Resource::Create ({}),
55
63
std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler),
56
64
std::unique_ptr<IdGenerator> id_generator =
57
- std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept ;
58
-
59
- // explicit TracerProvider(
60
- // std::vector<std::unique_ptr<SpanProcessor>> &&processors,
61
- // const opentelemetry::sdk::resource::Resource &resource =
62
- // opentelemetry::sdk::resource::Resource::Create({}),
63
- // std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler),
64
- // std::unique_ptr<IdGenerator> id_generator =
65
- // std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept;
65
+ std::unique_ptr<IdGenerator>(new RandomIdGenerator()),
66
+ std::unique_ptr<ScopeConfigurator<TracerConfig>> tracer_configurator =
67
+ std::make_unique<ScopeConfigurator<TracerConfig>>(
68
+ TracerConfig::DefaultConfigurator ())) noexcept ;
66
69
67
70
/* *
68
71
* Initialize a new tracer provider with a specified context
@@ -121,6 +124,9 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T
121
124
std::vector<std::shared_ptr<Tracer>> tracers_;
122
125
std::shared_ptr<TracerContext> context_;
123
126
std::mutex lock_;
127
+
128
+ // private helper to get TracerConfig from InstrumentationScope using tracer configurator.
129
+ TracerConfig GetTracerConfig (const InstrumentationScope &instrumentation_scope) const ;
124
130
};
125
131
} // namespace trace
126
132
} // namespace sdk
0 commit comments