Skip to content

Commit

Permalink
fix trace integration test (#5962)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
  • Loading branch information
bnjjj authored and SimonSapin committed Sep 10, 2024
1 parent 82847f6 commit f626c48
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion apollo-router/src/plugins/telemetry/otel/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,6 @@ where
attributes.insert(OTEL_ORIGINAL_NAME.into(), builder.name.into());
builder.name = forced_span_name.into();
}

// Assign end time, build and start span, drop span to export
builder
.with_end_time(SystemTime::now())
Expand Down
18 changes: 9 additions & 9 deletions apollo-router/tests/integration/telemetry/datadog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async fn test_default_span_names() -> Result<(), BoxError> {
.unwrap(),
id.to_datadog()
);
router.graceful_shutdown().await;
TraceSpec::builder()
.services(["client", "router", "subgraph"].into())
.span_names(
Expand All @@ -73,7 +74,6 @@ async fn test_default_span_names() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand Down Expand Up @@ -104,6 +104,7 @@ async fn test_override_span_names() -> Result<(), BoxError> {
.unwrap(),
id.to_datadog()
);
router.graceful_shutdown().await;
TraceSpec::builder()
.services(["client", "router", "subgraph"].into())
.span_names(
Expand All @@ -125,7 +126,6 @@ async fn test_override_span_names() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand Down Expand Up @@ -156,6 +156,7 @@ async fn test_override_span_names_late() -> Result<(), BoxError> {
.unwrap(),
id.to_datadog()
);
router.graceful_shutdown().await;
TraceSpec::builder()
.services(["client", "router", "subgraph"].into())
.span_names(
Expand All @@ -177,7 +178,6 @@ async fn test_override_span_names_late() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand Down Expand Up @@ -206,6 +206,7 @@ async fn test_basic() -> Result<(), BoxError> {
.unwrap(),
id.to_datadog()
);
router.graceful_shutdown().await;
TraceSpec::builder()
.operation_name("ExampleQuery")
.services(["client", "router", "subgraph"].into())
Expand Down Expand Up @@ -240,7 +241,6 @@ async fn test_basic() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand Down Expand Up @@ -274,6 +274,7 @@ async fn test_with_parent_span() -> Result<(), BoxError> {
.unwrap(),
id.to_datadog()
);
router.graceful_shutdown().await;
TraceSpec::builder()
.operation_name("ExampleQuery")
.services(["client", "router", "subgraph"].into())
Expand Down Expand Up @@ -308,7 +309,6 @@ async fn test_with_parent_span() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand Down Expand Up @@ -383,6 +383,7 @@ async fn test_resource_mapping_override() -> Result<(), BoxError> {
.get("apollo-custom-trace-id")
.unwrap()
.is_empty());
router.graceful_shutdown().await;
TraceSpec::builder()
.services(["client", "router", "subgraph"].into())
.span_names(
Expand All @@ -403,7 +404,6 @@ async fn test_resource_mapping_override() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand All @@ -428,6 +428,7 @@ async fn test_span_metrics() -> Result<(), BoxError> {
.get("apollo-custom-trace-id")
.unwrap()
.is_empty());
router.graceful_shutdown().await;
TraceSpec::builder()
.operation_name("ExampleQuery")
.services(["client", "router", "subgraph"].into())
Expand All @@ -450,7 +451,6 @@ async fn test_span_metrics() -> Result<(), BoxError> {
.build()
.validate_trace(id)
.await?;
router.graceful_shutdown().await;
Ok(())
}

Expand Down Expand Up @@ -495,12 +495,12 @@ impl TraceSpec {
.await?;
tracing::debug!("{}", serde_json::to_string_pretty(&trace)?);
self.verify_trace_participants(&trace)?;
self.verify_spans_present(&trace)?;
self.validate_measured_spans(&trace)?;
self.verify_operation_name(&trace)?;
self.verify_priority_sampled(&trace)?;
self.verify_version(&trace)?;
self.verify_spans_present(&trace)?;
self.validate_span_kinds(&trace)?;
self.validate_measured_spans(&trace)?;
Ok(())
}

Expand Down

0 comments on commit f626c48

Please sign in to comment.