Skip to content

Commit

Permalink
chore: add metadata to datadog rust iota example
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice committed Nov 3, 2023
1 parent b4a765d commit bf09849
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions demo-iota/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use axum::{
Router,
};
use dylibso_observe_sdk::adapter::{
datadog::{DatadogAdapter, DatadogConfig, Options, SpanFilter},
datadog::{AdapterMetadata, DatadogAdapter, DatadogConfig, DatadogMetadata, Options, SpanFilter},
AdapterHandle,
};
use serde::Deserialize;
Expand Down Expand Up @@ -80,7 +80,7 @@ async fn run_module(
let adapter = state.clone();
let options = Options {
span_filter: SpanFilter {
min_duration_microseconds: std::time::Duration::from_micros(100),
min_duration_microseconds: std::time::Duration::from_micros(30),
},
};
let trace_ctx = adapter.start(&mut linker, &data, options).unwrap();
Expand All @@ -92,6 +92,17 @@ async fn run_module(
.expect("function exists");
f.call(&mut store, &[], &mut []).unwrap();

let meta = DatadogMetadata {
http_url: Some("https://example.com/things/123".into()),
http_method: Some("GET".into()),
http_status_code: Some(200u16),
http_client_ip: Some("23.123.15.145".into()),
http_request_content_length: Some(128974u64),
http_response_content_length: Some(239823874u64),
..Default::default()
};
trace_ctx.set_metadata(AdapterMetadata::Datadog(meta)).await;

trace_ctx.shutdown().await;

drop(store);
Expand Down

0 comments on commit bf09849

Please sign in to comment.