Skip to content

Commit d9692b4

Browse files
committed
Attribution is key
Signed-off-by: Caleb Schoepp <[email protected]>
1 parent 0572fcc commit d9692b4

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
@@ -86,7 +86,9 @@ impl<'a> WasiHttpView for WasiHttpImplInner<'a> {
8686
mut request: Request<wasmtime_wasi_http::body::HyperOutgoingBody>,
8787
mut config: wasmtime_wasi_http::types::OutgoingRequestConfig,
8888
) -> wasmtime_wasi_http::HttpResult<wasmtime_wasi_http::types::HostFutureIncomingResponse> {
89-
self.state.observe_context.oh_dear_i_better_get_renamed();
89+
self.state
90+
.observe_context
91+
.reparent_tracing_span_this_was_lanns_idea();
9092

9193
// wasmtime-wasi-http fills in scheme and authority for relative URLs
9294
// (e.g. https://:443/<path>), which makes them hard to reason about.

0 commit comments

Comments
 (0)