-
Notifications
You must be signed in to change notification settings - Fork 221
Open
open-telemetry/opentelemetry-php-contrib
#524Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
php 8.2
open-telemetry/opentelemetry-auto-aws-sdk": "^0.1.0" Introduced in open-telemetry/opentelemetry-php-contrib#361
other OTEL stuff
"open-telemetry/exporter-otlp": "1.0.4",
"open-telemetry/opentelemetry-auto-guzzle": "1.0.0",
"open-telemetry/opentelemetry-auto-psr6": "0.0.3",
"open-telemetry/opentelemetry-auto-psr15": "^1.0.6",
"open-telemetry/opentelemetry-auto-psr16": "0.0.3",
"open-telemetry/opentelemetry-auto-psr18": "^1.0.4",
"open-telemetry/sdk": "1.0.8",
Steps to reproduce
Add "open-telemetry/opentelemetry-auto-aws-sdk": "^0.1.0" and watch millions of warning logs when your services interact with AWS
{
"message": "Undefined array key \"x-amz-request-id\"",
"context": {
"level": 2,
"error_file": "/var/app/vendor/open-telemetry/opentelemetry-auto-aws-sdk/src/AwsSdkInstrumentation.php",
"error_line": 78
},
"level": 300,
"level_name": "WARNING",
"channel": "phperrors",
"datetime": "2026-02-27T21:19:29.705+00:00",
"extra": {
"traceparent": "00-d39ad722ff0fd9da5ab43335f49b9778-101da05b120b41ac-00",
"tracestate": "",
"logRef": "3d4a0a6169b8d3404f165",
"tag": "phperrors"
}
}
What is the expected behavior?
Try another header, or skip and DO NOT LOG
What is the actual behavior?
Millions of logs
Additional context
See AWS docs: https://opentelemetry.io/docs/specs/semconv/cloud-providers/aws-sdk/
Should be something like?
// 1. Safely extract the headers array from the metadata
$headers = $result['@metadata']['headers'] ?? [];
// 2. Use the Null Coalescing operator to check for the various AWS ID formats
// We check the S3 version and the general version.
$awsRequestId = $headers['x-amz-request-id']
?? $headers['x-amzn-requestid']
?? $headers['x-amzn-request-id'] // Some services use this variant
?? null;
// 3. Only set the attribute if we found a value
if ($awsRequestId !== null) {
$span->setAttribute(TraceAttributes::AWS_REQUEST_ID, $awsRequestId);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working