File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
sdk/monitor/azure-monitor-opentelemetry-exporter
azure/monitor/opentelemetry/exporter Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 44
55### Features Added
66
7+ - Allow tracking of whether in a Azure Functions attach scenario
8+ ([ #37717 ] ( https://github.com/Azure/azure-sdk-for-python/pull/37717 ) )
9+
710### Breaking Changes
811
912### Bugs Fixed
Original file line number Diff line number Diff line change 1010_APPLICATIONINSIGHTS_OPENTELEMETRY_RESOURCE_METRIC_DISABLED = \
1111 "APPLICATIONINSIGHTS_OPENTELEMETRY_RESOURCE_METRIC_DISABLED"
1212_APPLICATIONINSIGHTS_METRIC_NAMESPACE_OPT_IN = "APPLICATIONINSIGHTS_METRIC_NAMESPACE_OPT_IN"
13+
14+ # RPs
15+
1316_WEBSITE_SITE_NAME = "WEBSITE_SITE_NAME"
1417_WEBSITE_HOME_STAMPNAME = "WEBSITE_HOME_STAMPNAME"
1518_WEBSITE_HOSTNAME = "WEBSITE_HOSTNAME"
1619_FUNCTIONS_WORKER_RUNTIME = "FUNCTIONS_WORKER_RUNTIME"
20+ _PYTHON_ENABLE_OPENTELEMETRY = "PYTHON_ENABLE_OPENTELEMETRY"
1721_AKS_ARM_NAMESPACE_ID = "AKS_ARM_NAMESPACE_ID"
1822
1923# Network
Original file line number Diff line number Diff line change 2323from azure .monitor .opentelemetry .exporter ._constants import (
2424 _AKS_ARM_NAMESPACE_ID ,
2525 _APPLICATION_INSIGHTS_RESOURCE_SCOPE ,
26+ _PYTHON_ENABLE_OPENTELEMETRY ,
2627 _INSTRUMENTATIONS_BIT_MAP ,
2728 _FUNCTIONS_WORKER_RUNTIME ,
2829 _WEBSITE_SITE_NAME ,
4950def _is_on_app_service ():
5051 return environ .get (_WEBSITE_SITE_NAME ) is not None
5152
53+ # Functions
54+
5255def _is_on_functions ():
5356 return environ .get (_FUNCTIONS_WORKER_RUNTIME ) is not None
5457
55- def _is_attach_enabled ():
56- if _is_on_app_service ():
57- return isdir ("/agents/python/" )
58- return False
59-
60-
6158# AKS
6259
6360def _is_on_aks ():
6461 return _AKS_ARM_NAMESPACE_ID in environ
6562
63+ # Attach
64+
65+ def _is_attach_enabled ():
66+ if _is_on_app_service ():
67+ return isdir ("/agents/python/" )
68+ if _is_on_functions ():
69+ return environ .get (_PYTHON_ENABLE_OPENTELEMETRY ) == "true"
70+ return False
6671
6772def _get_sdk_version_prefix ():
6873 sdk_version_prefix = ''
You can’t perform that action at this time.
0 commit comments