-
Notifications
You must be signed in to change notification settings - Fork 3k
[Core] Tracing updates #39563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Tracing updates #39563
Conversation
4072688
to
5268fb4
Compare
API change check APIView has identified API level changes in this PR and created following API reviews. |
be04837
to
c81d021
Compare
Signed-off-by: Paul Van Eck <[email protected]>
c81d021
to
74e47e4
Compare
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks great - thanks a lot for putting it together!
Left some naming suggestions and other minor suggestions
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py
Show resolved
Hide resolved
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly nits and questions 🐱
sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Paul Van Eck <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @kristapratico, for the feedback!
sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/azure/core/pipeline/policies/_distributed_tracing.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Paul Van Eck <[email protected]>
Signed-off-by: Paul Van Eck <[email protected]>
Verified that the azure-core-tracing-opentelemetry live tests still work with these changes. Adding live tests for native tracing here: #39945 |
This introduces native OpenTelemetry tracing to Azure Core. Signed-off-by: Paul Van Eck <[email protected]>
Additional context: https://gist.github.com/pvaneck/12273663942e70e71cea36bf40716d8d
This introduces native OpenTelemetry tracing to Azure Core. This is intended to be an alternative/replacement to the
azure-core-tracing-opentelemetry
plugin.To enable native OpenTelemetry tracing, users need to:
opentelemetry-api
installed.settings.tracing_implementation
is not set.settings.tracing_enabled
is set toTrue
.If
setting.tracing_implementation
is set, the tracing plugin will be used instead of the native tracing. Ifsettings.tracing_enabled
is set toFalse
, tracing will be disabled.Main changes
opentelemetry-api
is added as an optional dependency, and is needed to enable native tracing.OpenTelemetryTracer
class was added to theazure.core.tracing.opentelemetry
module. This is a wrapper around the OpenTelemetry tracer that is used to create spans for Azure SDK operations.get_tracer
method to the newazure.core.instrumentation
module. This method returns an instance of theOpenTelemetryTracer
class.TracingOptions
TypedDict class was added to define the options that SDK users can use to configure tracing per-operation. These options include the ability to enable or disable tracing and set additional attributes on spans.- Example usage:
client.method(tracing_options={"enabled": True, "attributes": {"foo": "bar"}})
DistributedTracingPolicy
anddistributed_trace
/distributed_trace_async
decorators now uses the OpenTelemetry tracer if it is available and native tracing is enabled._instrumentation_config
class variable to configure the OpenTelemetry tracer used in method span creation. Possible configuration options arelibrary_name
,library_version
,schema_url
, andattributes
.DistributedTracingPolicy
now accepts ainstrumentation_config
keyword argument to configure the OpenTelemetry tracer used in HTTP span creation.