Skip to main content

pypi

This library contains OpenTelemetry Resource Detectors for the following Azure resources:

Installation

pip install opentelemetry-resource-detector-azure

Usage example for opentelemetry-resource-detector-azure

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.resource.detector.azure.app_service import (
    AzureAppServiceResourceDetector,
    AzureVMResourceDetector,
)
from opentelemetry.resource.detector.azure.vm import (
    AzureVMResourceDetector,
)
from opentelemetry.sdk.resources import get_aggregated_resources


trace.set_tracer_provider(
    TracerProvider(
        resource=get_aggregated_resources(
            [
                AzureAppServiceResourceDetector(),
                AzureVMResourceDetector(),
            ]
        ),
    )
)

Mappings

The Azure App Service Resource Detector sets the following Resource Attributes:
  • service.name set to the value of the WEBSITE_SITE_NAME environment variable.

  • cloud.platform set to azure_app_service.

  • cloud.provider set to azure.

  • cloud.resource_id set using the WEBSITE_RESOURCE_GROUP, WEBSITE_OWNER_NAME, and WEBSITE_SITE_NAME environment variables.

  • cloud.region set to the value of the REGION_NAME environment variable.

  • deployment.environment set to the value of the WEBSITE_SLOT_NAME environment variable.

  • host.id set to the value of the WEBSITE_HOSTNAME environment variable.

  • service.instance.id set to the value of the WEBSITE_INSTANCE_ID environment variable.

  • azure.app.service.stamp set to the value of the WEBSITE_HOME_STAMPNAME environment variable.

The Azure VM Resource Detector sets the following Resource Attributes according to the response from the Azure Metadata Service:
  • azure.vm.scaleset.name set to the value of the vmScaleSetName field.

  • azure.vm.sku set to the value of the sku field.

  • cloud.platform set to the value of the azure_vm.

  • cloud.provider set to the value of the azure.

  • cloud.region set to the value of the location field.

  • cloud.resource_id set to the value of the resourceId field.

  • host.id set to the value of the vmId field.

  • host.name set to the value of the name field.

  • host.type set to the value of the vmSize field.

  • os.type set to the value of the osType field.

  • os.version set to the value of the version field.

  • service.instance.id set to the value of the vmId field.

The Azure Functions Resource Detector is currently experimental. It sets the following Resource Attributes:
  • service.name set to the value of the WEBSITE_SITE_NAME environment variable.

  • process.id set to the process ID collected from the running process.

  • cloud.platform set to azure_functions.

  • cloud.provider set to azure.

  • cloud.resource_id set using the WEBSITE_RESOURCE_GROUP, WEBSITE_OWNER_NAME, and WEBSITE_SITE_NAME environment variables.

  • cloud.region set to the value of the REGION_NAME environment variable.

  • faas.instance set to the value of the WEBSITE_INSTANCE_ID environment variable.

  • faas.max_memory set to the value of the WEBSITE_MEMORY_LIMIT_MB environment variable.

For more information, see the Semantic Conventions for Cloud Resource Attributes.

References

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentelemetry_resource_detector_azure-0.2.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file opentelemetry_resource_detector_azure-0.2.0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_resource_detector_azure-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7a82d1c1794a3b252de9b0cb393116ae260f8414a085010e1c334cea34c4677e
MD5 f5f36e867c5c3fb542bea4107db1a659
BLAKE2b-256 fd39d42e29076bad36b07ac0894701b87a81b36b68a92359ccec50f01b3305d2

See more details on using hashes here.

File details

Details for the file opentelemetry_resource_detector_azure-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_resource_detector_azure-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a8368e91356464bd3746848a8ef952e89a5e8c83673c7d4b722ad5f3716b45e
MD5 4966857af5fc1b91ae006c93fbf29e1a
BLAKE2b-256 675456bf2c4936ab482bef76a54603119c53c0ea4bdee0912966f2da07d8d43f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page