Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(progress_tracing): inject transport into otlp push

Steven Enamakel5a19faecc865
diff --git a/crates/openhuman-core/src/agent/progress_tracing/flow_export_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/flow_export_tests.rs
index 28f61738fb..dc5000a355 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/flow_export_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/flow_export_tests.rs
@@ -296,9 +296,15 @@ async fn shared_otlp_transport_posts_rendered_graph_json_with_attribution() {
.await;
let url = format!("{}/otel/v1/traces", server.uri());
- super::super::otlp::push_otlp_json_requests(&url, "session-token", &requests)
- .await
- .expect("send graph request through shared authenticated transport");
+ let transport = crate::backend::transport::plain::PlainHttpTransport::fresh();
+ super::super::otlp::push_otlp_json_requests_via(
+ transport.as_ref(),
+ &url,
+ "session-token",
+ &requests,
+ )
+ .await
+ .expect("send graph request through shared authenticated transport");
}
#[tokio::test]
@@ -321,9 +327,15 @@ async fn shared_otlp_transport_reports_http_and_partial_rejections() {
.mount(&server)
.await;
let url = format!("{}/otel/v1/traces", server.uri());
- let error = super::super::otlp::push_otlp_json_requests(&url, "token", &requests)
- .await
- .expect_err("HTTP failure must be reported");
+ let transport = crate::backend::transport::plain::PlainHttpTransport::fresh();
+ let error = super::super::otlp::push_otlp_json_requests_via(
+ transport.as_ref(),
+ &url,
+ "token",
+ &requests,
+ )
+ .await
+ .expect_err("HTTP failure must be reported");
assert!(error.contains("503"), "{error}");
let server = MockServer::start().await;
@@ -335,8 +347,14 @@ async fn shared_otlp_transport_reports_http_and_partial_rejections() {
.mount(&server)
.await;
let url = format!("{}/otel/v1/traces", server.uri());
- let error = super::super::otlp::push_otlp_json_requests(&url, "token", &requests)
- .await
- .expect_err("partial rejection must be reported");
+ let transport = crate::backend::transport::plain::PlainHttpTransport::fresh();
+ let error = super::super::otlp::push_otlp_json_requests_via(
+ transport.as_ref(),
+ &url,
+ "token",
+ &requests,
+ )
+ .await
+ .expect_err("partial rejection must be reported");
assert!(error.contains("partially rejected"), "{error}");
}
diff --git a/crates/openhuman-core/src/agent/progress_tracing/otlp.rs b/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
index 4455b6244c..bf686e5354 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/otlp.rs
@@ -20,12 +20,22 @@ pub(super) async fn push_otlp_json_requests(
token: &str,
requests: &[Value],
) -> Result<(), String> {
- let client = crate::backend::resolve_backend_transport()
- .map_err(|err| format!("Langfuse OTLP push has no backend transport: {err}"))?
- .http_client(crate::backend::TransportProfile::Api);
+ let transport = crate::backend::resolve_backend_transport()
+ .map_err(|err| format!("Langfuse OTLP push has no backend transport: {err}"))?;
+ push_otlp_json_requests_via(transport.as_ref(), url, token, requests).await
+}
+
+pub(super) async fn push_otlp_json_requests_via(
+ transport: &dyn crate::backend::BackendTransport,
+ url: &str,
+ token: &str,
+ requests: &[Value],
+) -> Result<(), String> {
+ let client = transport.http_client(crate::backend::TransportProfile::Api);
for payload in requests {
let response = client
.post(url)
+ .headers(transport.attribution_headers())
.header(
reqwest::header::AUTHORIZATION,
bearer_authorization_value(token),