Skip to content

Commit 7736166

Browse files
committed
Cleanup wit a bit
Signed-off-by: Caleb Schoepp <[email protected]>
1 parent db94e84 commit 7736166

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

crates/factor-otel/src/host.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ use tracing_opentelemetry::OpenTelemetrySpanExt;
99
use crate::InstanceState;
1010

1111
impl wasi_otel::Host for InstanceState {
12-
async fn on_start(
13-
&mut self,
14-
span_data: wasi_otel::SpanData,
15-
_parent: wasi_otel::SpanContext,
16-
) -> Result<()> {
12+
async fn on_start(&mut self, context: wasi_otel::SpanContext) -> Result<()> {
1713
let mut state = self.state.write().unwrap();
1814

1915
// Before we do anything make sure we track the original host span ID for reparenting
@@ -28,7 +24,7 @@ impl wasi_otel::Host for InstanceState {
2824
}
2925

3026
// Track the guest spans context in our ordered map
31-
let span_context: opentelemetry::trace::SpanContext = span_data.span_context.into();
27+
let span_context: opentelemetry::trace::SpanContext = context.into();
3228
state
3329
.guest_span_contexts
3430
.insert(span_context.span_id(), span_context);
@@ -51,7 +47,7 @@ impl wasi_otel::Host for InstanceState {
5147
Ok(())
5248
}
5349

54-
async fn current_span_context(&mut self) -> Result<wasi_otel::SpanContext> {
50+
async fn outer_span_context(&mut self) -> Result<wasi_otel::SpanContext> {
5551
Ok(tracing::Span::current()
5652
.context()
5753
.span()

wit/deps/otel/tracing.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ interface tracing {
22
use wasi:clocks/wall-clock@0.2.0.{datetime};
33

44
/// Called when a span is started.
5-
on-start: func(span: span-data, parent: span-context);
5+
on-start: func(context: span-context);
66

77
/// Called when a span is ended.
88
on-end: func(span: span-data);
99

10-
/// Returns the current span context of the host.
11-
current-span-context: func() -> span-context;
10+
/// Returns the span context of the host.
11+
outer-span-context: func() -> span-context;
1212

1313
/// The data associated with a span.
1414
record span-data {

0 commit comments

Comments
 (0)