diff --git a/contrib/opencensus-ext-azure/CHANGELOG.md b/contrib/opencensus-ext-azure/CHANGELOG.md index ad8e8d689..3ece097d9 100644 --- a/contrib/opencensus-ext-azure/CHANGELOG.md +++ b/contrib/opencensus-ext-azure/CHANGELOG.md @@ -2,6 +2,17 @@ ## Unreleased +## 1.1.15 + +Released 2025-06-03 + +- Switch ordering for Statsbeat Attach detection to prioritize Azure Functions + ([#1251](https://github.com/census-instrumentation/opencensus-python/pull/1251)) + +## 1.1.14 + +Released 2025-01-06 + - Remove status code `206` from retry code + only count batch level for statsbeat ([#1247](https://github.com/census-instrumentation/opencensus-python/pull/1247)) diff --git a/contrib/opencensus-ext-azure/opencensus/ext/azure/statsbeat/statsbeat_metrics.py b/contrib/opencensus-ext-azure/opencensus/ext/azure/statsbeat/statsbeat_metrics.py index 0f3d838c1..712efecaf 100644 --- a/contrib/opencensus-ext-azure/opencensus/ext/azure/statsbeat/statsbeat_metrics.py +++ b/contrib/opencensus-ext-azure/opencensus/ext/azure/statsbeat/statsbeat_metrics.py @@ -131,7 +131,7 @@ def _get_common_properties(): properties.append(LabelKey("cikey", 'customer ikey')) properties.append(LabelKey("runtimeVersion", 'Python version')) properties.append(LabelKey("os", 'os of application being instrumented')) - properties.append(LabelKey("language", 'Python')) + properties.append(LabelKey("language", 'python')) properties.append(LabelKey("version", 'sdkVersion - version of the ext')) return properties @@ -412,17 +412,17 @@ def _get_attach_metric(self): rp = '' rpId = '' # rp, rpId - if os.environ.get("WEBSITE_SITE_NAME") is not None: + if os.environ.get("FUNCTIONS_WORKER_RUNTIME") is not None: + # Function apps + rp = _RP_NAMES[1] + rpId = os.environ.get("WEBSITE_HOSTNAME") + elif os.environ.get("WEBSITE_SITE_NAME") is not None: # Web apps rp = _RP_NAMES[0] rpId = '{}/{}'.format( os.environ.get("WEBSITE_SITE_NAME"), os.environ.get("WEBSITE_HOME_STAMPNAME", '') ) - elif os.environ.get("FUNCTIONS_WORKER_RUNTIME") is not None: - # Function apps - rp = _RP_NAMES[1] - rpId = os.environ.get("WEBSITE_HOSTNAME") elif self._vm_retry and self._get_azure_compute_metadata(): # VM rp = _RP_NAMES[2] diff --git a/contrib/opencensus-ext-azure/setup.py b/contrib/opencensus-ext-azure/setup.py index 28d8c450a..422effebc 100644 --- a/contrib/opencensus-ext-azure/setup.py +++ b/contrib/opencensus-ext-azure/setup.py @@ -43,7 +43,7 @@ install_requires=[ 'azure-core >= 1.12.0, < 2.0.0', 'azure-identity >= 1.5.0, < 2.0.0', - 'opencensus >= 0.12.dev0, < 1.0.0', + 'opencensus >= 0.11.4, < 1.0.0', 'psutil >= 5.6.3', 'requests >= 2.19.0', ], diff --git a/contrib/opencensus-ext-azure/tests/test_azure_statsbeat_metrics.py b/contrib/opencensus-ext-azure/tests/test_azure_statsbeat_metrics.py index 9ae366a95..f5e4b6519 100644 --- a/contrib/opencensus-ext-azure/tests/test_azure_statsbeat_metrics.py +++ b/contrib/opencensus-ext-azure/tests/test_azure_statsbeat_metrics.py @@ -665,6 +665,7 @@ def test_get_attach_metric_appsvc(self): { "FUNCTIONS_WORKER_RUNTIME": "runtime", "WEBSITE_HOSTNAME": "host_name", + "WEBSITE_SITE_NAME": "site_name", } ) def test_get_attach_metric_functions(self):