https://github.com/opentelemetry-php/contrib-detector-container
[READONLY] OpenTelemetry container detector
https://github.com/opentelemetry-php/contrib-detector-container
Last synced: 7 months ago
JSON representation
[READONLY] OpenTelemetry container detector
- Host: GitHub
- URL: https://github.com/opentelemetry-php/contrib-detector-container
- Owner: opentelemetry-php
- Created: 2023-05-10T03:00:39.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T23:03:51.000Z (about 1 year ago)
- Last Synced: 2024-11-14T16:49:57.729Z (8 months ago)
- Language: PHP
- Size: 20.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/opentelemetry-php/contrib-detector-container/releases)
[](https://github.com/open-telemetry/opentelemetry-php/issues)
[](https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/ResourceDetectors/Container)
[](https://github.com/opentelemetry-php/contrib-detector-container)
[](https://packagist.org/packages/open-telemetry/detector-container/)
[](https://packagist.org/packages/open-telemetry/detector-container/)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
```bash
$ 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):
```php
putenv('OTEL_PHP_DETECTORS=container,env,os,')var_dump(ResourceInfoFactory::defaultResource());
```