Skip to content

Commit eb9d4f5

Browse files
committed
Apply Lukas feedback
1 parent 08808aa commit eb9d4f5

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

  • opentelemetry-sdk/src/opentelemetry/sdk/trace

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,15 +1377,28 @@ def _set_tracer_configurator(
13771377
self._tracer_configurator = tracer_configurator
13781378
with self._tracers_lock:
13791379
for instrumentation_scope, tracer in self._tracers.items():
1380-
# pylint: disable-next=protected-access
1381-
tracer._set_tracer_config(
1382-
tracer_configurator(instrumentation_scope)
1380+
tracer_config = self._apply_tracer_configurator(
1381+
instrumentation_scope
13831382
)
1383+
# pylint: disable-next=protected-access
1384+
tracer._set_tracer_config(tracer_config)
13841385

13851386
@property
13861387
def resource(self) -> Resource:
13871388
return self._resource
13881389

1390+
def _apply_tracer_configurator(
1391+
self, instrumentation_scope: InstrumentationScope
1392+
):
1393+
try:
1394+
return self._tracer_configurator(instrumentation_scope)
1395+
except Exception: # pylint: disable=broad-exception-caught
1396+
logger.exception(
1397+
"Failed to create a Tracer Config for %s, using default Tracer config",
1398+
instrumentation_scope,
1399+
)
1400+
return _TracerConfig.default()
1401+
13891402
def get_tracer(
13901403
self,
13911404
instrumenting_module_name: str,
@@ -1422,16 +1435,7 @@ def get_tracer(
14221435
schema_url,
14231436
attributes,
14241437
)
1425-
1426-
try:
1427-
tracer_config = self._tracer_configurator(instrumentation_scope)
1428-
except Exception: # pylint: disable=broad-exception-caught
1429-
logger.exception(
1430-
"Failed to create a Tracer Config for %s, using default Tracer config",
1431-
instrumentation_scope,
1432-
)
1433-
tracer_config = _TracerConfig.default()
1434-
1438+
tracer_config = self._apply_tracer_configurator(instrumentation_scope)
14351439
tracer = Tracer(
14361440
self.sampler,
14371441
self.resource,

0 commit comments

Comments
 (0)