Skip to content

Commit 9552deb

Browse files
committed
Attribution is key
Signed-off-by: Caleb Schoepp <[email protected]>
1 parent 87d2100 commit 9552deb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

crates/factor-observe/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ pub struct ObserveContext {
8989

9090
impl ObserveContext {
9191
/// TODO comment
92-
pub fn oh_dear_i_better_get_renamed(&self) {
92+
/// Make sure to mention this should only be called from an instrumented function in a factor.
93+
pub fn reparent_tracing_span_this_was_lanns_idea(&self) {
9394
// TODO: Move this duplicate logic into its own impl
9495
let state = self.state.read().unwrap();
9596
if state.active_spans.is_empty() {

crates/factor-outbound-http/src/spin.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ impl spin_http::Host for crate::InstanceState {
1313
fields(otel.kind = "client", url.full = Empty, http.request.method = Empty,
1414
http.response.status_code = Empty, otel.name = Empty, server.address = Empty, server.port = Empty))]
1515
async fn send_request(&mut self, req: Request) -> Result<Response, HttpError> {
16-
self.observe_context.oh_dear_i_better_get_renamed();
16+
self.observe_context
17+
.reparent_tracing_span_this_was_lanns_idea();
1718

1819
let span = Span::current();
1920
record_request_fields(&span, &req);

crates/factor-outbound-http/src/wasi.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ impl<'a> WasiHttpView for WasiHttpImplInner<'a> {
8787
request: Request<wasmtime_wasi_http::body::HyperOutgoingBody>,
8888
config: wasmtime_wasi_http::types::OutgoingRequestConfig,
8989
) -> wasmtime_wasi_http::HttpResult<wasmtime_wasi_http::types::HostFutureIncomingResponse> {
90-
self.state.observe_context.oh_dear_i_better_get_renamed();
90+
self.state
91+
.observe_context
92+
.reparent_tracing_span_this_was_lanns_idea();
9193
Ok(HostFutureIncomingResponse::Pending(
9294
wasmtime_wasi::runtime::spawn(
9395
send_request_impl(

0 commit comments

Comments
 (0)