Skip to content

Commit b01c83e

Browse files
committed
Changed get_tracer of invalid values to return empty string
1 parent 42213c4 commit b01c83e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Diff for: opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ def get_tracer(
997997
instrumenting_library_version: str = "",
998998
) -> "trace_api.Tracer":
999999
if not instrumenting_module_name: # Reject empty strings too.
1000-
instrumenting_module_name = "ERROR:MISSING MODULE NAME"
1000+
instrumenting_module_name = ""
10011001
logger.error("get_tracer called with missing module name.")
10021002
return Tracer(
10031003
self.sampler,

Diff for: opentelemetry-sdk/tests/trace/test_trace.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,22 @@ def test_invalid_instrumentation_info(self):
260260
self.assertEqual(
261261
tracer1.instrumentation_info, tracer2.instrumentation_info
262262
)
263+
263264
self.assertIsInstance(
264265
tracer1.instrumentation_info, InstrumentationInfo
265266
)
266267
span1 = tracer1.start_span("foo")
267268
self.assertTrue(span1.is_recording())
268269
self.assertEqual(tracer1.instrumentation_info.version, "")
269-
self.assertEqual(
270-
tracer1.instrumentation_info.name, "ERROR:MISSING MODULE NAME"
270+
self.assertEqual(tracer1.instrumentation_info.name, "")
271+
272+
self.assertIsInstance(
273+
tracer2.instrumentation_info, InstrumentationInfo
271274
)
275+
span2 = tracer2.start_span("bar")
276+
self.assertTrue(span2.is_recording())
277+
self.assertEqual(tracer2.instrumentation_info.version, "")
278+
self.assertEqual(tracer2.instrumentation_info.name, "")
272279

273280
def test_span_processor_for_source(self):
274281
tracer_provider = trace.TracerProvider()

0 commit comments

Comments
 (0)