Class TracerProvider
Defined in File tracer_provider.h
Inheritance Relationships
Base Type
public opentelemetry::trace::TracerProvider
(Class TracerProvider)
Class Documentation
-
class TracerProvider : public opentelemetry::trace::TracerProvider
Public Functions
-
explicit TracerProvider(std::unique_ptr<SpanProcessor> processor, const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler), std::unique_ptr<IdGenerator> id_generator = std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept
Initialize a new tracer provider with a specified sampler
- Parameters:
processor – The span processor for this tracer provider. This must not be a nullptr.
resource – The resources for this tracer provider.
sampler – The sampler for this tracer provider. This must not be a nullptr.
id_generator – The custom id generator for this tracer provider. This must not be a nullptr
-
explicit TracerProvider(std::vector<std::unique_ptr<SpanProcessor>> &&processors, const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler), std::unique_ptr<IdGenerator> id_generator = std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept
-
explicit TracerProvider(std::unique_ptr<TracerContext> context) noexcept
Initialize a new tracer provider with a specified context
- Parameters:
context – The owned tracer configuration/pipeline for this provider.
-
~TracerProvider() override
-
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> GetTracer(nostd::string_view name, nostd::string_view version = "", nostd::string_view schema_url = "") noexcept override
-
void AddProcessor(std::unique_ptr<SpanProcessor> processor) noexcept
Attaches a span processor to list of configured processors for this tracer provider.
Note: This process may not receive any in-flight spans, but will get newly created spans. Note: This method is not thread safe, and should ideally be called from main thread.
- Parameters:
processor – The new span processor for this tracer provider. This must not be a nullptr.
-
const opentelemetry::sdk::resource::Resource &GetResource() const noexcept
Obtain the resource associated with this tracer provider.
- Returns:
The resource for this tracer provider.
-
bool Shutdown() noexcept
Shutdown the span processor associated with this tracer provider.
-
bool ForceFlush(std::chrono::microseconds timeout = (std::chrono::microseconds::max)()) noexcept
Force flush the span processor associated with this tracer provider.
-
explicit TracerProvider(std::unique_ptr<SpanProcessor> processor, const opentelemetry::sdk::resource::Resource &resource = opentelemetry::sdk::resource::Resource::Create({}), std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler), std::unique_ptr<IdGenerator> id_generator = std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept