open-telemetry/detector-container
OpenTelemetry container resource detector
Maintainers
Package info
github.com/opentelemetry-php/contrib-detector-container
pkg:composer/open-telemetry/detector-container
Requires
- php: ^8.1
- open-telemetry/sdk: ^1.0
- open-telemetry/sem-conv: ^1.38
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- guzzlehttp/promises: ^1.5|^2
- mikey179/vfsstream: ^1.6.11
- nyholm/psr7: ^1.5
- phan/phan: ^5.0
- php-http/message-factory: ^1.0
- phpstan/phpstan: ^1.1
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.19.2
- symfony/http-client: ^5.4|^6.0
- vimeo/psalm: 6.4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
Apache-2.0 d22f03d374705ecf7b2ffd027c2a87848bdc373c
README
👁 Releases
👁 Issues
👁 Source
👁 Mirror
👁 Latest Version
👁 Stable
This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.
OpenTelemetry Container Detector
This package provides an OpenTelemetry ResourceDetector which will detect docker container id at runtime, using either V1 (cgroup) or V2 (mountinfo).
It should work with docker, kubernetes, and podman containers.
Requirements
- OpenTelemetry SDK
Installation via composer
$ composer require open-telemetry/detector-container
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=container,env,os,<others>') var_dump(ResourceInfoFactory::defaultResource());
