Skip to main content

Azure Resource Detector for OpenTelemetry

Project description

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.

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

References

Project details


Download files

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

Source Distribution

Built Distribution

File details

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

File metadata

File hashes

Hashes for opentelemetry_resource_detector_azure-0.1.3.tar.gz
Algorithm Hash digest
SHA256 65f0bbb00ec92b021c3a6d8a86fc2f21c8f5a73c012e5d1fa4a12a2d34adc2cf
MD5 764a61ff8da3da622707e30cbef7fc55
BLAKE2b-256 4110d46829f68f197087bc485a59b9a50ec40a9f888d2dbb092d97676034d1cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opentelemetry_resource_detector_azure-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f588907ccfb07eb594882df22963c3e2081baaee9440c4204a323a0b9fde1592
MD5 7735fd4293caf06130969398fd2e7608
BLAKE2b-256 99c46790b15d360d0a14c5fb3a754d713470758da8a3635d90502aabb52febe2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page