Skip to content
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

added decorators to keyvault-keys #6381

Merged
merged 138 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from 136 commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
657c34e
add opencensus impl
SuyogSoti Jul 9, 2019
8573e23
dont need to check for noop tracer
SuyogSoti Jul 9, 2019
989c4dc
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 9, 2019
3f64325
get rid of span and trace id
SuyogSoti Jul 9, 2019
0b04d80
fix span instance
SuyogSoti Jul 9, 2019
9f4e507
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 9, 2019
7b728d8
added documentation
SuyogSoti Jul 9, 2019
bfd355c
added documentation and refactor names of a few variables
SuyogSoti Jul 9, 2019
cd06c97
write test for opencensus wrapper
SuyogSoti Jul 10, 2019
a9f7a6f
put opencensus in the dev requirements
SuyogSoti Jul 10, 2019
b8f63df
initial common
SuyogSoti Jul 10, 2019
408c5ad
only import the wrapper when necessary
SuyogSoti Jul 10, 2019
9baf366
add check for the exporter
SuyogSoti Jul 10, 2019
f4c52fd
rework logic and fix some settings
SuyogSoti Jul 10, 2019
d439df9
added initial decorator
SuyogSoti Jul 10, 2019
f256d62
some mroe documentation
SuyogSoti Jul 10, 2019
9067279
added decorators
SuyogSoti Jul 10, 2019
eee5e09
small change
SuyogSoti Jul 10, 2019
6050bd7
some minor fixes
SuyogSoti Jul 10, 2019
c9faa4b
test patch happening
SuyogSoti Jul 10, 2019
6d35557
fix space
SuyogSoti Jul 10, 2019
0f6c1f7
share a function
SuyogSoti Jul 10, 2019
2bfffe5
clearer logic for setting span context
SuyogSoti Jul 10, 2019
c1f6d69
better logic
SuyogSoti Jul 10, 2019
18890ea
better logic
SuyogSoti Jul 10, 2019
6a4a545
fix environ variable
SuyogSoti Jul 11, 2019
e7b5707
test the way opencensus does it
SuyogSoti Jul 11, 2019
aaf2152
middle of tests
SuyogSoti Jul 11, 2019
7ccf041
only load if opencensus has already been imported
SuyogSoti Jul 11, 2019
6a01918
fix spelling mistake
SuyogSoti Jul 11, 2019
36572c5
temp
SuyogSoti Jul 11, 2019
d9a2d95
Merge branch 'opencensus_impl' into temp
SuyogSoti Jul 11, 2019
280173f
finish writing tests for common
SuyogSoti Jul 11, 2019
b3f44fb
charles fixes
SuyogSoti Jul 11, 2019
9cb1bd9
Merge branch 'opencensus_impl' into temp
SuyogSoti Jul 11, 2019
77e0ccf
fix tests
SuyogSoti Jul 11, 2019
1e9c7dc
fix test settings
SuyogSoti Jul 11, 2019
d72248e
to header should not take a dict
SuyogSoti Jul 11, 2019
135d1c0
from header should be class method
SuyogSoti Jul 11, 2019
56e8269
Merge branch 'opencensus_impl' into temp
SuyogSoti Jul 11, 2019
73203c2
initial tests
SuyogSoti Jul 11, 2019
e304d40
dont create trace and get rid of end_tracer
SuyogSoti Jul 11, 2019
ff5627d
dont need to save the trace
SuyogSoti Jul 11, 2019
1e4b03a
more little fixes
SuyogSoti Jul 11, 2019
d55bca1
Merge branch 'opencensus_impl' into temp
SuyogSoti Jul 11, 2019
72e0dd4
some intermediatary changes
SuyogSoti Jul 11, 2019
aa5b671
fix type annotations
SuyogSoti Jul 11, 2019
0ce1a22
rst fix types
SuyogSoti Jul 11, 2019
b9c7d72
add :class:annotations
SuyogSoti Jul 11, 2019
57b2a57
fix line wrapping
SuyogSoti Jul 11, 2019
9b6260e
Merge branch 'opencensus_impl' into temp
SuyogSoti Jul 11, 2019
8b1ed8f
added tests for decorator
SuyogSoti Jul 12, 2019
c041818
rename opencensus wrapper
SuyogSoti Jul 12, 2019
8da57ec
Merge branch 'opencensus_impl' into overall
SuyogSoti Jul 12, 2019
56d2e7d
intermediate changes
SuyogSoti Jul 12, 2019
de6f552
use spans the right way
SuyogSoti Jul 12, 2019
691eb3d
some formatting
SuyogSoti Jul 12, 2019
6a1f733
Merge branch 'opencensus_impl' into overall
SuyogSoti Jul 12, 2019
20d5afe
some grammar
SuyogSoti Jul 12, 2019
c55c901
Merge branch 'opencensus_impl' into overall
SuyogSoti Jul 12, 2019
3e80b1e
restructure settings and make tests pass
SuyogSoti Jul 12, 2019
3f9f4ae
rename get_parent
SuyogSoti Jul 12, 2019
412bf7a
fix typings
SuyogSoti Jul 12, 2019
3c6ab1c
use protocol and from_headers becomes links
SuyogSoti Jul 12, 2019
de8b5f4
Merge branch 'opencensus_impl' into overall
SuyogSoti Jul 12, 2019
de41353
ramifications of opencensus wrapper being a protocol
SuyogSoti Jul 12, 2019
db2f865
add tests for link
SuyogSoti Jul 12, 2019
7c637e6
Merge branch 'opencensus_impl' into overall
SuyogSoti Jul 12, 2019
27c9876
added async tests
SuyogSoti Jul 12, 2019
ac9ff09
delete the unit test thing
SuyogSoti Jul 12, 2019
f0ba4ee
fix merge conflict
SuyogSoti Jul 12, 2019
ff07c55
added add_attribute
SuyogSoti Jul 13, 2019
30fd165
added add_attribute
SuyogSoti Jul 13, 2019
644fe2a
added tests for add attributes
SuyogSoti Jul 13, 2019
e556a69
add initial policy
SuyogSoti Jul 13, 2019
fc6a284
Merge branch 'opencensus_impl' into add_decorator
SuyogSoti Jul 13, 2019
8f137c1
remove unused import
SuyogSoti Jul 13, 2019
a6e4ee8
Merge branch 'opencensus_impl' into overall
SuyogSoti Jul 13, 2019
8e8aa21
Merge branch 'master' into add_decorator
SuyogSoti Jul 13, 2019
a373e40
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 15, 2019
0c37b38
added docstrings
SuyogSoti Jul 15, 2019
b925782
minor docstring formatting
SuyogSoti Jul 15, 2019
4dd6ba9
fix pylint errors
SuyogSoti Jul 15, 2019
fae494a
don't rely on opencensus children to check
SuyogSoti Jul 15, 2019
e484bcf
use exporter to not rely on parent.children
SuyogSoti Jul 15, 2019
76c75bc
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 15, 2019
f2119da
Merge branch 'add_decorator' into overall
SuyogSoti Jul 15, 2019
1eba4cd
added documentation and span attributes
SuyogSoti Jul 16, 2019
6e5b05f
added test tracing policy
SuyogSoti Jul 16, 2019
9d0159c
test should only propagate
SuyogSoti Jul 16, 2019
aa14218
made test tracing helper
SuyogSoti Jul 16, 2019
ce5c667
Merge branch 'add_decorator' into overall
SuyogSoti Jul 16, 2019
bc35a5f
decrease flakiness of test
SuyogSoti Jul 16, 2019
c99bf19
Merge branch 'add_decorator' into overall
SuyogSoti Jul 16, 2019
85e5e48
simplify get parent
SuyogSoti Jul 16, 2019
91d1d25
calling a decorator decorator is redundant
SuyogSoti Jul 16, 2019
603d4f6
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 16, 2019
d347f2e
Merge branch 'add_decorator' into overall
SuyogSoti Jul 16, 2019
236ef8b
middle of writing tests
SuyogSoti Jul 16, 2019
056bc2e
fix settings
SuyogSoti Jul 16, 2019
103c44e
Merge branch 'add_decorator' into overall
SuyogSoti Jul 16, 2019
4adb5c3
add tests
SuyogSoti Jul 16, 2019
a7ede6b
test propogation also happens
SuyogSoti Jul 16, 2019
720c44e
more elegant code
SuyogSoti Jul 16, 2019
c8574fe
Merge branch 'add_decorator' into overall
SuyogSoti Jul 16, 2019
c3d7eb8
await async stuff
SuyogSoti Jul 16, 2019
f503b6e
add await for async
SuyogSoti Jul 16, 2019
b5fb8a1
Merge branch 'add_decorator' into add_policy
SuyogSoti Jul 16, 2019
6743bd1
should only have to wait a 1/1000 of a second
SuyogSoti Jul 16, 2019
c070b77
fix tests spans too short
SuyogSoti Jul 17, 2019
df7f09e
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 17, 2019
d106a16
accidentally deleted setup.cfg
SuyogSoti Jul 17, 2019
6f7a85f
fix merge conflict
SuyogSoti Jul 17, 2019
dc86986
add component
SuyogSoti Jul 17, 2019
31f43ec
merge conflict
SuyogSoti Jul 17, 2019
7d65a46
added decorators to convenience layer
SuyogSoti Jul 17, 2019
3c6530e
clear all context for the tests in context helper!
SuyogSoti Jul 17, 2019
ab01300
add set_http_attributes
SuyogSoti Jul 17, 2019
1b9e5d4
fix span network name
SuyogSoti Jul 17, 2019
03f75e2
fix http request types
SuyogSoti Jul 17, 2019
c097ed9
fix more types
SuyogSoti Jul 17, 2019
b4f7094
bryan fixes
SuyogSoti Jul 17, 2019
d0a5137
more efficient tests
SuyogSoti Jul 17, 2019
583cf38
non flakey tests
SuyogSoti Jul 17, 2019
c28fe34
make tracing only use my context
SuyogSoti Jul 17, 2019
290f272
test user agent on exception
SuyogSoti Jul 17, 2019
3090416
pylint formatting
SuyogSoti Jul 17, 2019
ca59363
delete unused import
SuyogSoti Jul 17, 2019
ff8fdeb
fix spelling
SuyogSoti Jul 17, 2019
11ecf0e
pylint
SuyogSoti Jul 17, 2019
6546f8b
merge conflict
SuyogSoti Jul 18, 2019
06a0b18
merge conflict
SuyogSoti Jul 18, 2019
ed8189e
add policy to the keyvault
SuyogSoti Jul 19, 2019
0d2dd80
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 19, 2019
a1ed57a
add forgotten to add the tracing policy to the async client
SuyogSoti Jul 19, 2019
3b36088
cant pass header when trace not sampled
SuyogSoti Jul 19, 2019
7925f31
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
SuyogSoti Jul 23, 2019
639a7b3
use assert not
SuyogSoti Jul 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sdk/core/azure-core/azure/core/tracing/ext/opencensus_span.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
TYPE_CHECKING = False

if TYPE_CHECKING:
from typing import Dict, Optional, Union, TypeVar
from typing import Dict, Optional, Union

from azure.core.pipeline.transport import HttpRequest, HttpResponse

Expand Down Expand Up @@ -83,7 +83,10 @@ def to_header(self):
temp_headers = {}
if tracer_from_context is not None:
ctx = tracer_from_context.span_context
temp_headers = tracer_from_context.propagator.to_headers(ctx)
try:
temp_headers = tracer_from_context.propagator.to_headers(ctx)
except AttributeError:
pass
return temp_headers

def add_attribute(self, key, value):
Expand Down
1 change: 1 addition & 0 deletions sdk/core/azure-core/tests/test_tracing_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, environ={}, tracer_to_use=None):

def __enter__(self):
self.orig_sdk_context_span = tracing_context.current_span.get()
tracing_context.current_span.clear()
settings.tracing_implementation.set_value(self.tracer_to_use)
self.os_env.start()
return self
Expand Down
25 changes: 8 additions & 17 deletions sdk/core/azure-core/tests/test_tracing_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,27 @@
# ------------------------------------
"""The tests for decorators.py and common.py"""

import unittest

try:
from unittest import mock
except ImportError:
import mock

import sys
import os
import time

import pytest
from azure.core import HttpRequest
from azure.core.pipeline import Pipeline, PipelineResponse
from azure.core.pipeline.policies import HTTPPolicy
from azure.core.pipeline.transport import HttpTransport
from azure.core.settings import settings
from azure.core.tracing import common
from azure.core.tracing.context import tracing_context
from azure.core.tracing.decorator import distributed_trace
from azure.core.settings import settings
from azure.core.tracing.ext.opencensus_span import OpenCensusSpan
from opencensus.trace import tracer as tracer_module
from opencensus.trace.samplers import AlwaysOnSampler
from tracing_common import ContextHelper, MockExporter
import time
import pytest

try:
from typing import TYPE_CHECKING
except ImportError:
TYPE_CHECKING = False

if TYPE_CHECKING:
from typing import List


class MockClient:
Expand Down Expand Up @@ -73,6 +63,7 @@ def get_foo(self):
time.sleep(0.001)
return 5


class TestCommon(object):
def test_set_span_context(self):
with ContextHelper(environ={"AZURE_SDK_TRACING_IMPLEMENTATION": "opencensus"}):
Expand Down Expand Up @@ -113,11 +104,11 @@ def test_get_parent_span(self):
def test_should_use_trace(self):
with ContextHelper(environ={"AZURE_TRACING_ONLY_PROPAGATE": "yes"}):
parent_span = OpenCensusSpan()
assert common.should_use_trace(parent_span) == False
assert common.should_use_trace(None) == False
assert common.should_use_trace(parent_span) is False
assert common.should_use_trace(None) is False
SuyogSoti marked this conversation as resolved.
Show resolved Hide resolved
parent_span = OpenCensusSpan()
assert common.should_use_trace(parent_span)
assert common.should_use_trace(None) == False
assert common.should_use_trace(None) is False


class TestDecorator(object):
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/tests/test_tracing_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from opencensus.trace.span import SpanKind
from opencensus.trace.samplers import AlwaysOnSampler
from opencensus.trace.base_exporter import Exporter
from opencensus.common.utils import timestamp_to_microseconds
from tracing_common import MockExporter, ContextHelper
import os

Expand Down Expand Up @@ -79,6 +78,7 @@ def test_start_finish(self):
assert wrapped_class.span_instance.start_time is not None
assert wrapped_class.span_instance.end_time is not None
parent.finish()
tracer.finish()

def test_to_header(self):
with ContextHelper() as ctx:
Expand Down
18 changes: 7 additions & 11 deletions sdk/core/azure-core/tests/tracing_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@
# ------------------------------------
"""Code shared between the async and the sync test_decorator files."""

import sys
import os
from azure.core import HttpRequest
from azure.core.pipeline import Pipeline, PipelineResponse
from azure.core.pipeline.policies import HTTPPolicy
from azure.core.pipeline.transport import HttpTransport
from azure.core.tracing import common
from azure.core.tracing.context import tracing_context

from azure.core.settings import settings
from azure.core.tracing.context import tracing_context
from azure.core.tracing.ext.opencensus_span import OpenCensusSpan
from opencensus.trace import tracer as tracer_module
from opencensus.trace.span_data import SpanData
from opencensus.trace.samplers import AlwaysOnSampler
from opencensus.trace import execution_context
from opencensus.trace.base_exporter import Exporter
from opencensus.trace.span_data import SpanData
from collections import defaultdict

try:
Expand All @@ -44,6 +38,8 @@ def __enter__(self):
if self.should_only_propagate is not None:
settings.tracing_should_only_propagate.set_value(self.should_only_propagate)
self.os_env.start()
execution_context.clear()
tracing_context.current_span.clear()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
Expand All @@ -64,7 +60,7 @@ def __init__(self, span_data):

class MockExporter(Exporter):
def __init__(self):
self.root = None
self.root = None # type: SpanData
self._all_nodes = []
self.parent_dict = defaultdict(list)

Expand Down
18 changes: 18 additions & 0 deletions sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from typing import Any, Dict, Generator, Mapping, Optional

from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError
from azure.core.tracing.decorator import distributed_trace

from ._shared import KeyVaultClientBase
from ._models import Key, KeyBase, DeletedKey, KeyOperationResult
Expand All @@ -32,6 +33,7 @@ class KeyClient(KeyVaultClientBase):

# pylint:disable=protected-access

@distributed_trace
def create_key(
self,
name,
Expand Down Expand Up @@ -107,6 +109,7 @@ def create_key(
)
return Key._from_key_bundle(bundle)

@distributed_trace
def create_rsa_key(
self,
name,
Expand Down Expand Up @@ -171,6 +174,7 @@ def create_rsa_key(
**kwargs
)

@distributed_trace
def create_ec_key(
self,
name,
Expand Down Expand Up @@ -238,6 +242,7 @@ def create_ec_key(
**kwargs
)

@distributed_trace
def delete_key(self, name, **kwargs):
# type: (str, Mapping[str, Any]) -> DeletedKey
"""Deletes a key from the Key Vault.
Expand Down Expand Up @@ -265,6 +270,7 @@ def delete_key(self, name, **kwargs):
bundle = self._client.delete_key(self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs)
return DeletedKey._from_deleted_key_bundle(bundle)

@distributed_trace
def get_key(self, name, version=None, **kwargs):
# type: (str, Optional[str], Mapping[str, Any]) -> Key
"""Gets the public part of a stored key.
Expand Down Expand Up @@ -295,6 +301,7 @@ def get_key(self, name, version=None, **kwargs):
)
return Key._from_key_bundle(bundle)

@distributed_trace
def get_deleted_key(self, name, **kwargs):
# type: (str, Mapping[str, Any]) -> DeletedKey
"""Gets a deleted key from the Key Vault
Expand All @@ -320,6 +327,7 @@ def get_deleted_key(self, name, **kwargs):
bundle = self._client.get_deleted_key(self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs)
return DeletedKey._from_deleted_key_bundle(bundle)

@distributed_trace
def list_deleted_keys(self, **kwargs):
# type: (Mapping[str, Any]) -> Generator[DeletedKey]
"""Lists the deleted keys in the Key Vault
Expand Down Expand Up @@ -348,6 +356,7 @@ def list_deleted_keys(self, **kwargs):
pages = self._client.get_deleted_keys(self._vault_url, maxresults=max_page_size, **kwargs)
return (DeletedKey._from_deleted_key_item(item) for item in pages)

@distributed_trace
SuyogSoti marked this conversation as resolved.
Show resolved Hide resolved
def list_keys(self, **kwargs):
# type: (Mapping[str, Any]) -> Generator[KeyBase]
"""List the keys in the Key Vault
Expand Down Expand Up @@ -375,6 +384,7 @@ def list_keys(self, **kwargs):
pages = self._client.get_keys(self._vault_url, maxresults=max_page_size, **kwargs)
return (KeyBase._from_key_item(item) for item in pages)

@distributed_trace
def list_key_versions(self, name, **kwargs):
# type: (str, Mapping[str, Any]) -> Generator[KeyBase]
"""Retrieves a list of individual key versions with the same key name.
Expand All @@ -400,6 +410,7 @@ def list_key_versions(self, name, **kwargs):
pages = self._client.get_key_versions(self._vault_url, name, maxresults=max_page_size, **kwargs)
return (KeyBase._from_key_item(item) for item in pages)

@distributed_trace
def purge_deleted_key(self, name, **kwargs):
# type: (str, Mapping[str, Any]) -> None
"""Permanently deletes the specified key.
Expand All @@ -424,6 +435,7 @@ def purge_deleted_key(self, name, **kwargs):
"""
self._client.purge_deleted_key(self.vault_url, name, kwargs)

@distributed_trace
def recover_deleted_key(self, name, **kwargs):
# type: (str, Mapping[str, Any]) -> Key
"""Recovers the deleted key to its latest version.
Expand Down Expand Up @@ -451,6 +463,7 @@ def recover_deleted_key(self, name, **kwargs):
bundle = self._client.recover_deleted_key(self.vault_url, name, kwargs)
return Key._from_key_bundle(bundle)

@distributed_trace
def update_key(
self, name, version=None, key_operations=None, enabled=None, expires=None, not_before=None, tags=None, **kwargs
):
Expand Down Expand Up @@ -508,6 +521,7 @@ def update_key(
)
return Key._from_key_bundle(bundle)

@distributed_trace
def backup_key(self, name, **kwargs):
# type: (str, Mapping[str, Any]) -> bytes
"""Backs up the specified key.
Expand Down Expand Up @@ -545,6 +559,7 @@ def backup_key(self, name, **kwargs):
backup_result = self._client.backup_key(self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs)
return backup_result.value

@distributed_trace
def restore_key(self, backup, **kwargs):
# type: (bytes, Mapping[str, Any]) -> Key
"""Restores a backed up key to the Key Vault
Expand Down Expand Up @@ -581,6 +596,7 @@ def restore_key(self, backup, **kwargs):
bundle = self._client.restore_key(self.vault_url, backup, error_map={409: ResourceExistsError}, **kwargs)
return Key._from_key_bundle(bundle)

@distributed_trace
def import_key(self, name, key, hsm=None, enabled=None, not_before=None, expires=None, tags=None, **kwargs):
# type: (str, List[str], Optional[bool], Optional[bool], Optional[datetime], Optional[datetime], Optional[Dict[str, str]], Mapping[str, Any]) -> Key
"""Imports an externally created key, stores it, and returns the key to the client.
Expand Down Expand Up @@ -618,6 +634,7 @@ def import_key(self, name, key, hsm=None, enabled=None, not_before=None, expires
)
return Key._from_key_bundle(bundle)

@distributed_trace
def wrap_key(self, name, algorithm, value, version=None, **kwargs):
# type: (str, str, Optional[str], bytes, Mapping[str, Any]) -> KeyOperationResult
"""Wraps a symmetric key using a specified key.
Expand Down Expand Up @@ -653,6 +670,7 @@ def wrap_key(self, name, algorithm, value, version=None, **kwargs):
)
return KeyOperationResult(id=bundle.kid, value=bundle.result)

@distributed_trace
def unwrap_key(self, name, algorithm, value, version=None, **kwargs):
# type: (str, str, Optional[str], bytes, Mapping[str, Any]) -> KeyOperationResult
"""Unwraps a symmetric key using the specified key that was initially used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from azure.core.async_paging import AsyncPagedMixin
from azure.core.configuration import Configuration
from azure.core.pipeline import AsyncPipeline
from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy
from azure.core.pipeline.transport import AsyncioRequestsTransport, HttpTransport
from msrest.serialization import Model

Expand Down Expand Up @@ -101,6 +102,7 @@ def _build_pipeline(config: Configuration, transport: HttpTransport, **kwargs: A
config.retry_policy,
config.authentication_policy,
config.logging_policy,
DistributedTracingPolicy()
]

if transport is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from azure.core import Configuration
from azure.core.pipeline import Pipeline
from azure.core.pipeline.transport import RequestsTransport
from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy
from ._generated import KeyVaultClient

if TYPE_CHECKING:
Expand Down Expand Up @@ -73,6 +74,7 @@ def _build_pipeline(self, config, transport, **kwargs):
config.retry_policy,
config.authentication_policy,
config.logging_policy,
DistributedTracingPolicy(),
]

if transport is None:
Expand Down
Loading