@@ -146,9 +146,9 @@ def test_opentelemetry_api_can_record_errors(tracer):
146146# OpenTelemetry API and New Relic API can inject outbound trace context
147147@dt_enabled
148148@validate_transaction_metrics (name = "Foo" , background_task = True )
149- @validate_span_events (exact_intrinsics = {"name" : "External/url1/OtelSpan1 /GET" }, expected_intrinsics = ("parentId" ,))
149+ @validate_span_events (exact_intrinsics = {"name" : "External/url1/Default /GET" }, expected_intrinsics = ("parentId" ,))
150150@validate_span_events (exact_intrinsics = {"name" : "External/url2/segment1/GET" }, expected_intrinsics = ("parentId" ,))
151- @validate_span_events (exact_intrinsics = {"name" : "External/url3/OtelSpan2 /GET" }, expected_intrinsics = ("parentId" ,))
151+ @validate_span_events (exact_intrinsics = {"name" : "External/url3/Default /GET" }, expected_intrinsics = ("parentId" ,))
152152@validate_span_events (exact_intrinsics = {"name" : "External/url4/segment2/GET" }, expected_intrinsics = ("parentId" ,))
153153def test_opentelemetry_api_and_new_relic_api_can_inject_outbound_trace_context (tracer ):
154154 application = application_instance (activate = False )
@@ -159,7 +159,7 @@ def test_opentelemetry_api_and_new_relic_api_can_inject_outbound_trace_context(t
159159 name = "OtelSpan1" ,
160160 kind = otel_api_trace .SpanKind .CLIENT ,
161161 attributes = {"http.url" : "http://url1" , "http.method" : "GET" },
162- ):
162+ ) as span1 :
163163 headers = {}
164164 PROPAGATOR .inject (carrier = headers )
165165 _ , trace_id , span_id , sampled = headers ["traceparent" ].split ("-" )
@@ -172,6 +172,10 @@ def test_opentelemetry_api_and_new_relic_api_can_inject_outbound_trace_context(t
172172
173173 # Correct sampled flag was injected
174174 assert transaction .sampled == (sampled == "01" )
175+
176+ # Assert that the span name is correct even though
177+ # ExternalTrace types do not have a name attribute
178+ assert span1 .name == "OtelSpan1"
175179
176180 # Reset the distributed trace state for the purposes of this test
177181 transaction ._distributed_trace_state = 0
@@ -197,7 +201,7 @@ def test_opentelemetry_api_and_new_relic_api_can_inject_outbound_trace_context(t
197201 name = "OtelSpan2" ,
198202 kind = otel_api_trace .SpanKind .CLIENT ,
199203 attributes = {"http.url" : "http://url3" , "http.method" : "GET" },
200- ):
204+ ) as span2 :
201205 headers = []
202206 transaction .insert_distributed_trace_headers (headers )
203207 _ , trace_id , span_id , sampled = headers [0 ][1 ].split ("-" )
@@ -211,6 +215,10 @@ def test_opentelemetry_api_and_new_relic_api_can_inject_outbound_trace_context(t
211215 # Correct sampled flag was injected
212216 assert transaction .sampled == (sampled == "01" )
213217
218+ # Assert that the span name is correct even though
219+ # ExternalTrace types do not have a name attribute
220+ assert span2 .name == "OtelSpan2"
221+
214222 # Reset the distributed trace state for the purposes of this test
215223 transaction ._distributed_trace_state = 0
216224
0 commit comments