https://github.com/opentelemetry-php/contrib-sampler-aws-xray
[READONLY] OpenTelemetry AWS X-Ray sampler
https://github.com/opentelemetry-php/contrib-sampler-aws-xray
Last synced: 6 months ago
JSON representation
[READONLY] OpenTelemetry AWS X-Ray sampler
- Host: GitHub
- URL: https://github.com/opentelemetry-php/contrib-sampler-aws-xray
- Owner: opentelemetry-php
- Created: 2025-08-27T00:58:44.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-27T01:07:41.000Z (11 months ago)
- Last Synced: 2025-09-30T20:56:17.471Z (9 months ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS X-Ray Sampler
Provides a sampler which can get sampling configurations from AWS X-Ray to make sampling decisions. See: [AWS X-Ray Sampling](https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-sampling)
## Installation
```shell
composer require open-telemetry/sampler-aws-xray
```
## Configuration
You can configure the `AWSXRayRemoteSampler` as per the following example.
Note that you will need to configure your [OpenTelemetry Collector for
X-Ray remote sampling](https://aws-otel.github.io/docs/getting-started/remote-sampling).
```php
'MyServiceName',
'service.version'=> '1.0.0',
'cloud.provider' => 'aws',
]));
$xraySampler = new AWSXRayRemoteSampler(
$resource,
'http://localhost:2000',
2
);
$tracerProvider = TracerProvider::builder()
->setResource($resource)
->setSampler($xraySampler)
->addSpanProcessor(
new SimpleSpanProcessor(
(new ConsoleSpanExporterFactory())->create()
)
)
->build();
```