Skip to content

Commit

Permalink
Fix traces and metrics not working. Fix slow tests. Rename variable
Browse files Browse the repository at this point in the history
Signed-off-by: Caleb Schoepp <[email protected]>
  • Loading branch information
calebschoepp committed Jan 20, 2025
1 parent 5f9beef commit 42ba595
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions crates/factor-observe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl ObserveContext {
};

// If there are no active guest spans then there is nothing to do
let Some(current_span_id) = state.active_spans.last() else {
let Some(active_span) = state.active_spans.last() else {
return;
};

Expand All @@ -166,7 +166,7 @@ impl ObserveContext {
// Now reparent the current span to the last active guest span
let span_context = state
.guest_spans
.get(*current_span_id)
.get(*active_span)
.unwrap()
.inner
.span_context()
Expand Down
2 changes: 2 additions & 0 deletions crates/telemetry/src/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub(crate) fn otel_tracing_layer<S: Subscriber + for<'span> LookupSpan<'span>>(

global::set_tracer_provider(tracer_provider.clone());

global::set_tracer_provider(tracer_provider.clone());

let env_filter = match EnvFilter::try_from_env("SPIN_OTEL_TRACING_LEVEL") {
Ok(filter) => filter,
// If it isn't set or it fails to parse default to info
Expand Down
18 changes: 9 additions & 9 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1469,7 +1469,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1539,7 +1539,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1604,7 +1604,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1665,7 +1665,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1727,7 +1727,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1793,7 +1793,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1851,7 +1851,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down Expand Up @@ -1908,7 +1908,7 @@ mod otel_integration_tests {
},
ServicesConfig::none(),
|env| {
env.set_env_var("OTEL_EXPORTER_OTLP_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", collector_endpoint);
env.set_env_var("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc");
env.set_env_var("OTEL_BSP_SCHEDULE_DELAY", "5");
Ok(())
Expand Down

0 comments on commit 42ba595

Please sign in to comment.