|
Azure::Core::Tracing::OpenTelemetry (azure-core-tracing-opentelemetry
) provides an implementation to enable customers to implement tracing in the Azure SDK for C++ libraries.
The easiest way to acquire the OpenTelemetry library is leveraging vcpkg package manager. See the corresponding Azure SDK for C++ readme section.
To install Azure Core OpenTelemetry package via vcpkg:
Then, use in your CMake file:
The azure-core-tracing-opentelemetry
package supports enabling tracing for Azure SDK packages, using an OpenTelemetry Tracer
.
By default, all libraries log with a NoOpTracer
that takes no action. To enable tracing, you will need to set a global tracer provider following the instructions in the OpenTelemetry getting started guide or the Enabling Tracing using OpenTelemetry example below.
Core Tracing supports both automatic and manual span propagation. Automatic propagation is handled using OpenTelemetry's API and will work well in most scenarios.
For customers who require manual propagation, all client library operations accept an optional field in the options
parameter where a tracingContext can be passed in and used as the currently active context. Please see the Manual Span Propagation example below for more details.
Most Azure SDKs use OpenTelemetry to support tracing. Specifically, we depend on the opentelemetry-cpp VCPKG package.
After this, the SDK API implementations will be able to retrieve the tracer provider and produce tracing events automatically.
In Azure Service methods, the Azure::Context
value passed into the tracer optionally has an associated Span.
If there is a span associated with the Azure::Context
, then calling DiagnosticTracingFactory::CreateSpanFromContext
will cause a new span to be created using the span in the provided Azure::Context
object as the parent span.
You can build and run the tests locally by executing azure-core-tracing-opentelemetry-test
. Explore the test
folder to see advanced usage and behavior of the public classes.
If you run into issues while using this library, please feel free to file an issue.
Ideally you'd want to use OpenTelemetry 1.3.0 or higher.
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secur. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the e@mi croso ft.c omSecurity TechCenter.
Azure SDK for C++ is licensed under the MIT license.