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.0.tar.gz.

File metadata

  • Download URL: opentelemetry_resource_detector_azure-0.1.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9

File hashes

Hashes for opentelemetry_resource_detector_azure-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac075af66b2845bb4c7f798c4428cb1a50d90acf7e363a0e2a77c4045c287a7a
MD5 ddd42fb8456c8fdbbfb15e21a31959f2
BLAKE2b-256 f7583bcacc448bc494850ec6188ff30635707b1d0b3f48615ef526cc79161bc5

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for opentelemetry_resource_detector_azure-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cf96912c4f4ce0cf8520796e51b1f64a4c2f49ec1efb715ec9d04fffe7fb395
MD5 9534c54fee822089b93e2303983897e9
BLAKE2b-256 4cca304fc79ba4949de1f08ae9a4ba779582999c4fa67ff3eb45df4e44687ce8

See more details on using hashes here.

Provenance

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