Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for AWS X-Ray Tracing Propagator #3580

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ dependencies = [
"nu-ansi-term 0.47.0",
"once_cell",
"opentelemetry",
"opentelemetry-aws",
"opentelemetry-datadog",
"opentelemetry-http",
"opentelemetry-jaeger",
Expand Down Expand Up @@ -3821,6 +3822,16 @@ dependencies = [
"opentelemetry_sdk",
]

[[package]]
name = "opentelemetry-aws"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72a394d24777936802edd6c03a68daab4db39630418c7e431a5648e9befa80b8"
dependencies = [
"once_cell",
"opentelemetry",
]

[[package]]
name = "opentelemetry-datadog"
version = "0.7.0"
Expand Down
1 change: 1 addition & 0 deletions apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ opentelemetry = { version = "0.19.0", features = [
"rt-tokio",
"metrics",
] }
opentelemetry-aws = "0.7.0"
opentelemetry-datadog = { version = "0.7.0", features = ["reqwest-client"] }
opentelemetry-http = "0.8.0"
opentelemetry-jaeger = { version = "0.18.0", features = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4661,6 +4661,11 @@ expression: "&schema"
"description": "Propagation configuration",
"type": "object",
"properties": {
"awsxray": {
"description": "Propagate AWS X-Ray",
"default": false,
"type": "boolean"
},
"baggage": {
"description": "Propagate baggage https://www.w3.org/TR/baggage/",
"default": false,
Expand Down
2 changes: 2 additions & 0 deletions apollo-router/src/plugins/telemetry/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ pub(crate) struct Propagation {
pub(crate) datadog: bool,
/// Propagate Zipkin
pub(crate) zipkin: bool,
/// Propagate AWS X-Ray
pub(crate) awsxray: bool,
}

#[derive(Clone, Debug, Deserialize, JsonSchema, Default)]
Expand Down
3 changes: 3 additions & 0 deletions apollo-router/src/plugins/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,9 @@ impl Telemetry {
if propagation.datadog || tracing.datadog.is_some() {
propagators.push(Box::<opentelemetry_datadog::DatadogPropagator>::default());
}
if propagation.awsxray {
propagators.push(Box::<opentelemetry_aws::XrayPropagator>::default());
}
if let Some(from_request_header) = &propagation.request.header_name {
propagators.push(Box::new(CustomTraceIdPropagator::new(
from_request_header.to_string(),
Expand Down
3 changes: 3 additions & 0 deletions docs/source/configuration/tracing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ telemetry:
# https://zipkin.io/ (compliant with opentracing)
zipkin: false
# https://aws.amazon.com/xray/ (compliant with opentracing)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(compliant with opentracing)

I'm actually curious what this comment means (even on the other options). Is it compatible? What makes it so?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that It means that the format is compatible with the OpenTelemetry OTLP exporter/collector.

Copy link
Member

@abernix abernix Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"OpenTelemetry" makes sense, but I was more curious about "OpenTracing" (which is different, as I understand it).

However, your uncertainty here is totally fine. I only asked because I thought maybe you'd perhaps made understanding of it already. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah. It looks like OpenTracing was merged into OpenTelemetry. Perhaps the comments should be updated.

awsxray: false
# If you have your own way to generate a trace id and you want to pass it via a custom request header
request:
header_name: my-trace-id
Expand Down