From bf098490052434a5a6e479f9df38c81a3b94cf02 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Fri, 3 Nov 2023 08:51:54 -0600 Subject: [PATCH] chore: add metadata to datadog rust iota example --- demo-iota/rust/src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/demo-iota/rust/src/main.rs b/demo-iota/rust/src/main.rs index db29dc1..9abc683 100644 --- a/demo-iota/rust/src/main.rs +++ b/demo-iota/rust/src/main.rs @@ -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; @@ -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(); @@ -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);