open-telemetry / detector-azure
The Azure package for opentelemetry-php
Requires
- php: ^7.4 || ^8.0
- open-telemetry/api: ^1.0
- open-telemetry/sdk: ^1.0
Requires (Dev)
- assertwell/phpunit-global-state: ^0.2.2
- dg/bypass-finals: ^v1.4.1
- friendsofphp/php-cs-fixer: ^3.0
- guzzlehttp/guzzle: ^7.8
- mikey179/vfsstream: ^1.6
- open-telemetry/dev-tools: dev-main
- phan/phan: ^4.1 || ^5
- php-http/mock-client: *
- phpstan/phpstan: ^1.4
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ~9
- psalm/plugin-phpunit: ^0.18.4
- vimeo/psalm: ^5.0
README
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
OpenTelemetry Azure Resource Detectors
This package provides OpenTelemetry ResourceDetector
s which will detect
resource attributes for these Azure services:
- App Service
- Container Apps
- Virtual Machines
The following OpenTelemetry resource attributes will be detected:
| Resource attribute | VM | App Service | Containers | | cloud.platform | azure_vm | azure_app_service | azure_container_apps | | cloud.provider | azure | azure | azure | | cloud.resource.id | auto | auto | | | cloud.region | auto | auto | | | deployment.environment | | auto | | | host.id | auto | auto | | | host.name | auto | | | | host.type | auto | | | | os.type | auto | | | | os.version | auto | | | | azure.vm.scaleset.name | auto | | | | azure.vm.sku | auto | | | | service.name | | auto | auto | | service.version | | | auto | | service.instance.id | | auto | auto | | azure.app.service.stamp | | auto | |
Requirements
- OpenTelemetry SDK
Installation via composer
$ composer require open-telemetry/detector-azure
Usage
The detector will be automatically registered as part of composer autoloading.
By default, all built-in and registered custom resource detectors are used, and will be added to the default resources associated with traces, metrics, and logs.
You can also provide a list of detectors via the OTEL_PHP_DETECTORS
config (environment variable or php.ini setting):
putenv('OTEL_PHP_DETECTORS=azure,env,os,<others>') var_dump(ResourceInfoFactory::defaultResource());