@@ -102,7 +102,7 @@ def __init__(self, loop: BaseEventLoop, host: str, port: int,
102
102
self ._function_metadata_exception = None
103
103
104
104
# Used for checking if open telemetry is enabled
105
- self ._otel_libs_available = False
105
+ self ._azure_monitor_available = False
106
106
self ._context_api = None
107
107
self ._trace_context_propagator = None
108
108
@@ -291,7 +291,7 @@ async def _dispatch_grpc_request(self, request):
291
291
resp = await request_handler (request )
292
292
self ._grpc_resp_queue .put_nowait (resp )
293
293
294
- def initialize_opentelemetry (self ):
294
+ def initialize_azure_monitor (self ):
295
295
"""Initializes OpenTelemetry and Azure monitor distro
296
296
"""
297
297
self .update_opentelemetry_status ()
@@ -317,19 +317,19 @@ def initialize_opentelemetry(self):
317
317
default_value = PYTHON_AZURE_MONITOR_LOGGER_NAME_DEFAULT
318
318
),
319
319
)
320
- self ._otel_libs_available = True
320
+ self ._azure_monitor_available = True
321
321
322
322
logger .info ("Successfully configured Azure monitor distro." )
323
323
except ImportError :
324
324
logger .exception (
325
325
"Cannot import Azure Monitor distro."
326
326
)
327
- self ._otel_libs_available = False
327
+ self ._azure_monitor_available = False
328
328
except Exception :
329
329
logger .exception (
330
330
"Error initializing Azure monitor distro."
331
331
)
332
- self ._otel_libs_available = False
332
+ self ._azure_monitor_available = False
333
333
334
334
def update_opentelemetry_status (self ):
335
335
"""Check for OpenTelemetry library availability and
@@ -342,12 +342,11 @@ def update_opentelemetry_status(self):
342
342
343
343
self ._context_api = context_api
344
344
self ._trace_context_propagator = TraceContextTextMapPropagator ()
345
- self ._otel_libs_available = True
346
345
347
346
logger .info ("Successfully loaded OpenTelemetry modules. "
348
347
"OpenTelemetry is now enabled." )
349
348
except ImportError :
350
- self ._otel_libs_available = False
349
+ self ._azure_monitor_available = False
351
350
352
351
async def _handle__worker_init_request (self , request ):
353
352
logger .info ('Received WorkerInitRequest, '
@@ -379,9 +378,9 @@ async def _handle__worker_init_request(self, request):
379
378
}
380
379
if get_app_setting (setting = PYTHON_ENABLE_OPENTELEMETRY ,
381
380
default_value = PYTHON_ENABLE_OPENTELEMETRY_DEFAULT ):
382
- self .initialize_opentelemetry ()
381
+ self .initialize_azure_monitor ()
383
382
384
- if self ._otel_libs_available :
383
+ if self ._azure_monitor_available :
385
384
capabilities [constants .WORKER_OPEN_TELEMETRY_ENABLED ] = _TRUE
386
385
387
386
if DependencyManager .should_load_cx_dependencies ():
@@ -653,7 +652,7 @@ async def _handle__invocation_request(self, request):
653
652
args [name ] = bindings .Out ()
654
653
655
654
if fi .is_async :
656
- if self ._otel_libs_available :
655
+ if self ._azure_monitor_available :
657
656
self .configure_opentelemetry (fi_context )
658
657
659
658
call_result = \
@@ -773,9 +772,9 @@ async def _handle__function_environment_reload_request(self, request):
773
772
if get_app_setting (
774
773
setting = PYTHON_ENABLE_OPENTELEMETRY ,
775
774
default_value = PYTHON_ENABLE_OPENTELEMETRY_DEFAULT ):
776
- self .update_opentelemetry_status ()
775
+ self .initialize_azure_monitor ()
777
776
778
- if self ._otel_libs_available :
777
+ if self ._azure_monitor_available :
779
778
capabilities [constants .WORKER_OPEN_TELEMETRY_ENABLED ] = (
780
779
_TRUE )
781
780
@@ -986,7 +985,7 @@ def _run_sync_func(self, invocation_id, context, func, params):
986
985
# invocation_id from ThreadPoolExecutor's threads.
987
986
context .thread_local_storage .invocation_id = invocation_id
988
987
try :
989
- if self ._otel_libs_available :
988
+ if self ._azure_monitor_available :
990
989
self .configure_opentelemetry (context )
991
990
return ExtensionManager .get_sync_invocation_wrapper (context ,
992
991
func )(params )
0 commit comments