|
26 | 26 | APPLICATIONINSIGHTS_CONNECTION_STRING,
|
27 | 27 | HTTP_URI,
|
28 | 28 | METADATA_PROPERTIES_WORKER_INDEXED,
|
29 |
| - PYTHON_AZURE_MONITOR_LOGGER_NAME, |
30 |
| - PYTHON_AZURE_MONITOR_LOGGER_NAME_DEFAULT, |
| 29 | + PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME, |
| 30 | + PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME_DEFAULT, |
31 | 31 | PYTHON_ENABLE_DEBUG_LOGGING,
|
32 | 32 | PYTHON_ENABLE_INIT_INDEXING,
|
33 |
| - PYTHON_ENABLE_OPENTELEMETRY, |
34 |
| - PYTHON_ENABLE_OPENTELEMETRY_DEFAULT, |
| 33 | + PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY, |
| 34 | + PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY_DEFAULT, |
35 | 35 | PYTHON_LANGUAGE_RUNTIME,
|
36 | 36 | PYTHON_ROLLBACK_CWD_PATH,
|
37 | 37 | PYTHON_SCRIPT_FILE_NAME,
|
@@ -103,8 +103,10 @@ def __init__(self, loop: BaseEventLoop, host: str, port: int,
|
103 | 103 | self._function_metadata_result = None
|
104 | 104 | self._function_metadata_exception = None
|
105 | 105 |
|
106 |
| - # Used for checking if open telemetry is enabled |
| 106 | + # Used for checking if appinsights is enabled |
107 | 107 | self._azure_monitor_available = False
|
| 108 | + # Used for checking if open telemetry is enabled |
| 109 | + self._otel_libs_available = False |
108 | 110 | self._context_api = None
|
109 | 111 | self._trace_context_propagator = None
|
110 | 112 |
|
@@ -318,8 +320,8 @@ def initialize_azure_monitor(self):
|
318 | 320 | setting=APPLICATIONINSIGHTS_CONNECTION_STRING
|
319 | 321 | ),
|
320 | 322 | logger_name=get_app_setting(
|
321 |
| - setting=PYTHON_AZURE_MONITOR_LOGGER_NAME, |
322 |
| - default_value=PYTHON_AZURE_MONITOR_LOGGER_NAME_DEFAULT |
| 323 | + setting=PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME, |
| 324 | + default_value=PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME_DEFAULT |
323 | 325 | ),
|
324 | 326 | )
|
325 | 327 | self._azure_monitor_available = True
|
@@ -381,15 +383,16 @@ async def _handle__worker_init_request(self, request):
|
381 | 383 | constants.RPC_HTTP_TRIGGER_METADATA_REMOVED: _TRUE,
|
382 | 384 | constants.SHARED_MEMORY_DATA_TRANSFER: _TRUE,
|
383 | 385 | }
|
| 386 | + |
384 | 387 | opentelemetry_app_setting = get_app_setting(
|
385 |
| - setting=PYTHON_ENABLE_OPENTELEMETRY, |
386 |
| - default_value=PYTHON_ENABLE_OPENTELEMETRY_DEFAULT, |
| 388 | + setting=PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY, |
| 389 | + default_value=PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY_DEFAULT, |
387 | 390 | )
|
388 | 391 | if opentelemetry_app_setting and opentelemetry_app_setting.lower() == "true":
|
389 | 392 | self.initialize_azure_monitor()
|
390 | 393 |
|
391 |
| - if self._azure_monitor_available: |
392 |
| - capabilities[constants.WORKER_OPEN_TELEMETRY_ENABLED] = _TRUE |
| 394 | + if self._azure_monitor_available or self._otel_libs_available: |
| 395 | + capabilities[constants.WORKER_OPEN_TELEMETRY_ENABLED] = _TRUE |
393 | 396 |
|
394 | 397 | if DependencyManager.should_load_cx_dependencies():
|
395 | 398 | DependencyManager.prioritize_customer_dependencies()
|
@@ -665,7 +668,7 @@ async def _handle__invocation_request(self, request):
|
665 | 668 | args[name] = bindings.Out()
|
666 | 669 |
|
667 | 670 | if fi.is_async:
|
668 |
| - if self._azure_monitor_available: |
| 671 | + if self._azure_monitor_available or self._otel_libs_available: |
669 | 672 | self.configure_opentelemetry(fi_context)
|
670 | 673 |
|
671 | 674 | call_result = \
|
@@ -783,13 +786,13 @@ async def _handle__function_environment_reload_request(self, request):
|
783 | 786 |
|
784 | 787 | capabilities = {}
|
785 | 788 | if get_app_setting(
|
786 |
| - setting=PYTHON_ENABLE_OPENTELEMETRY, |
787 |
| - default_value=PYTHON_ENABLE_OPENTELEMETRY_DEFAULT): |
| 789 | + setting=PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY, |
| 790 | + default_value=PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY_DEFAULT): |
788 | 791 | self.initialize_azure_monitor()
|
789 | 792 |
|
790 |
| - if self._azure_monitor_available: |
791 |
| - capabilities[constants.WORKER_OPEN_TELEMETRY_ENABLED] = ( |
792 |
| - _TRUE) |
| 793 | + if self._azure_monitor_available or self._otel_libs_available: |
| 794 | + capabilities[constants.WORKER_OPEN_TELEMETRY_ENABLED] = ( |
| 795 | + _TRUE) |
793 | 796 |
|
794 | 797 | if is_envvar_true(PYTHON_ENABLE_INIT_INDEXING):
|
795 | 798 | try:
|
@@ -999,7 +1002,7 @@ def _run_sync_func(self, invocation_id, context, func, params):
|
999 | 1002 | # invocation_id from ThreadPoolExecutor's threads.
|
1000 | 1003 | context.thread_local_storage.invocation_id = invocation_id
|
1001 | 1004 | try:
|
1002 |
| - if self._azure_monitor_available: |
| 1005 | + if self._azure_monitor_available or self._otel_libs_available: |
1003 | 1006 | self.configure_opentelemetry(context)
|
1004 | 1007 | return ExtensionManager.get_sync_invocation_wrapper(context,
|
1005 | 1008 | func)(params)
|
|
0 commit comments