Skip to content

Commit

Permalink
no allocation in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mustakimali committed Jan 29, 2024
1 parent 7df53da commit b6e30b9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions opentelemetry-otlp/src/exporter/http/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ impl SpanExporter for OtlpHttpClient {
}

Box::pin(async move {
#[cfg(debug_assertions)]
let request_uri = request.uri().to_string();
let response = client.send(request).await?;

if response.status().is_success() {
Ok(())
} else {
#[cfg(debug_assertions)]
let request_uri = request_uri.as_str();
#[cfg(not(debug_assertions))]
const request_uri: &str = "(available in debug mode)";

let error = format!(
"OpenTelemetry export failed. Url: {}, Response: {:?}",
request_uri,
Expand Down

0 comments on commit b6e30b9

Please sign in to comment.