diff --git a/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py b/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py index ffdbb8b58a3b..ecaf8ac96ee4 100644 --- a/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py +++ b/sdk/core/azure-core-tracing-opencensus/tests/test_tracing_implementations.py @@ -141,6 +141,7 @@ def test_set_http_attributes(self): setattr(request, "headers", {}) setattr(response, "status_code", 200) wrapped_class.set_http_attributes(request) + assert wrapped_class.span_instance.span_kind == OpenCensusSpanKind.CLIENT assert wrapped_class.span_instance.attributes.get("http.method") == request.method assert wrapped_class.span_instance.attributes.get("component") == "http" assert wrapped_class.span_instance.attributes.get("http.url") == request.url diff --git a/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py b/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py index 15d4e11569dc..a3be80465e09 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py +++ b/sdk/core/azure-core-tracing-opentelemetry/tests/test_tracing_implementations.py @@ -139,7 +139,7 @@ def test_add_attribute(self, tracer): assert parent.attributes["test"] == "test2" def test_set_http_attributes(self, tracer): - with tracer.start_as_current_span("Root") as parent: + with tracer.start_as_current_span("Root", kind=OpenTelemetrySpanKind.CLIENT) as parent: wrapped_class = OpenTelemetrySpan(span=parent) request = mock.Mock() setattr(request, "method", "GET") @@ -148,6 +148,7 @@ def test_set_http_attributes(self, tracer): setattr(request, "headers", {}) setattr(response, "status_code", 200) wrapped_class.set_http_attributes(request) + assert wrapped_class.span_instance.kind == OpenTelemetrySpanKind.CLIENT assert wrapped_class.span_instance.attributes.get("http.method") == request.method assert wrapped_class.span_instance.attributes.get("component") == "http" assert wrapped_class.span_instance.attributes.get("http.url") == request.url diff --git a/sdk/core/azure-core/azure/core/tracing/_abstract_span.py b/sdk/core/azure-core/azure/core/tracing/_abstract_span.py index de9e408b3025..e2cea5547126 100644 --- a/sdk/core/azure-core/azure/core/tracing/_abstract_span.py +++ b/sdk/core/azure-core/azure/core/tracing/_abstract_span.py @@ -221,6 +221,7 @@ def set_http_attributes(self, request, response=None): :param response: The response received by the server. Is None if no response received. :type response: ~azure.core.pipeline.transport.HttpResponse or ~azure.core.pipeline.transport.AsyncHttpResponse """ + self.kind = SpanKind.CLIENT self.add_attribute(self._SPAN_COMPONENT, "http") self.add_attribute(self._HTTP_METHOD, request.method) self.add_attribute(self._HTTP_URL, request.url) diff --git a/shared_requirements.txt b/shared_requirements.txt index 4a7fb37fdfc4..baf963ca9127 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -266,4 +266,4 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-rdbms msrest>=0.6.21 #override azure-mgmt-peering msrest>=0.6.21 #override azure-mgmt-confidentialledger msrest>=0.6.21 -#override azure-mgmt-mixedreality msrest>=0.6.21 \ No newline at end of file +#override azure-mgmt-mixedreality msrest>=0.6.21