aws-otel-python
aws-otel-python copied to clipboard
Publish `logging` instrumentation package that injects X-Ray styled Trace IDs into logs
Description
The AWS X-Ray developer guide talks about Trace ID Injection. Trace ID Injection allows services like CloudWatch Service to link X-Ray segments to X-Ray segment Service Graphs. This is accomplished by injecting the current AWS X-Ray segment Trace ID into the log that is sent to CloudWatch under the AWS-XRAY-TRACE-ID
key (the key is not important since the query is done on the Trace ID, but this is just an example). For example, as seen in the docs:
2019-09-10 18:58:30.844 [nio-5000-exec-4] AWS-XRAY-TRACE-ID: 1-5d77f256-19f12e4eaa02e3f76c78f46a@1ce7df03252d99e1 WARN 1 - Your logging message here
The problem is, that we do not currently have a package that does this. This is unlike ADOT Java, which publishes a package for log4j and other logging libraries as well.
We should distribute a package like this which gives an OpenTelemetry Instrumentor
that injects X-Ray formatted Trace IDs from the current OpenTelemetry Python span. Since we want to do X-Ray specific Trace IDs, the package should be hosted in this repo and not OTel Python Contrib.
NOTE: We need to set up publishing to PIP before we can work on this issue.