diff --git a/docs/public/sdk/GettingStarted.rst b/docs/public/sdk/GettingStarted.rst index c39f080e71..6486d46463 100644 --- a/docs/public/sdk/GettingStarted.rst +++ b/docs/public/sdk/GettingStarted.rst @@ -107,8 +107,8 @@ The OpenTelemetry C++ SDK allow for creation of Resources and for associating th auto resource_attributes = opentelemetry::sdk::resource::ResourceAttributes { - {"service.name": "shoppingcart"}, - {"service.instance.id": "instance-12"} + {"service.name", "shoppingcart"}, + {"service.instance.id", "instance-12"} }; auto resource = opentelemetry::sdk::resource::Resource::Create(resource_attributes); auto received_attributes = resource.GetAttributes(); @@ -136,18 +136,21 @@ OpenTelemetry C++ SDK offers four samplers out of the box: .. code:: cpp //AlwaysOnSampler - opentelemetry::sdk::trace::AlwaysOnSampler always_on_sampler; + auto always_on_sampler = std::unique_ptr + (new sdktrace::AlwaysOnSampler); //AlwaysOffSampler - opentelemetry::sdk::trace::AlwaysOffSampler always_off_sampler; + auto always_off_sampler = std::unique_ptr + (new sdktrace::AlwaysOffSampler); //ParentBasedSampler - opentelemetry::sdk::trace::ParentBasedSampler sampler_off(std::make_shared()); + auto parent_based_sampler = std::unique_ptr + (new sdktrace::ParentBasedSampler); //TraceIdRatioBasedSampler - Sample 50% generated spans double ratio = 0.5; - opentelemetry::sdk::trace::TraceIdRatioBasedSampler s(ratio); - + auto always_off_sampler = std::unique_ptr + (new sdktrace::TraceIdRatioBasedSampler(ratio)); TracerContext ^^^^^^^^^^^^^ @@ -172,11 +175,12 @@ There are two different mechanisms to create TraceProvider instance .. code:: cpp // Created using `TracerContext` instance - auto tracer_provider = sdktrace::TracerProvider(tracer_context); + auto tracer_provider = nostd::shared_ptr + (new sdktrace::TracerProvider(tracer_context)); // Create using SDK configurations as parameter - auto tracer_provider = - sdktrace::TracerProvider(std::move(simple_processor), resource, std::move(always_on_sampler)); + auto tracer_provider = nostd::shared_ptr + (std::move(simple_processor), resource, std::move(always_on_sampler)); // set the global tracer TraceProvider opentelemetry::trace::Provider::SetTracerProvider(tracer_provider);