Skip to content

Commit 750168b

Browse files
committed
Impl set_status
Signed-off-by: Caleb Schoepp <caleb.schoepp@fermyon.com>
1 parent 4fac517 commit 750168b

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

crates/factor-observe/src/host.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,21 @@ impl traces::HostSpan for InstanceState {
165165

166166
async fn set_status(
167167
&mut self,
168-
_resource: Resource<traces::Span>,
169-
_status: traces::Status,
168+
resource: Resource<traces::Span>,
169+
status: traces::Status,
170170
) -> Result<()> {
171-
todo!()
171+
if let Some(guest_span) = self
172+
.state
173+
.write()
174+
.unwrap()
175+
.guest_spans
176+
.get_mut(resource.rep())
177+
{
178+
guest_span.inner.set_status(status.into());
179+
Ok(())
180+
} else {
181+
Err(anyhow!("BUG: cannot find resource in table"))
182+
}
172183
}
173184

174185
async fn update_name(&mut self, resource: Resource<traces::Span>, name: String) -> Result<()> {

crates/world/src/conversions.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,16 @@ mod observe {
311311
))
312312
}
313313
}
314+
315+
impl From<traces::Status> for opentelemetry::trace::Status {
316+
fn from(status: traces::Status) -> Self {
317+
match status {
318+
traces::Status::Unset => Self::Unset,
319+
traces::Status::Ok => Self::Ok,
320+
traces::Status::Error(s) => Self::Error {
321+
description: s.into(),
322+
},
323+
}
324+
}
325+
}
314326
}

0 commit comments

Comments
 (0)