Skip to content

Commit

Permalink
no debugonly section
Browse files Browse the repository at this point in the history
  • Loading branch information
mustakimali committed Jan 31, 2024
1 parent f416b28 commit 5fd5a9f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
25 changes: 10 additions & 15 deletions opentelemetry-otlp/src/exporter/http/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,17 @@ impl LogExporter for OtlpHttpClient {
request.headers_mut().insert(k.clone(), v.clone());
}

#[cfg(not(debug_assertions))]
client.send(request).await?;
let request_uri = request.uri().to_string();
let response = client.send(request).await?;

Check warning on line 35 in opentelemetry-otlp/src/exporter/http/logs.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/logs.rs#L34-L35

Added lines #L34 - L35 were not covered by tests

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

if !response.status().is_success() {
let error = format!(
"OpenTelemetry logs export failed. Url: {}, Response: {:?}",
request_uri,
response.body()
);
return Err(LogError::Other(error.into()));
}
if !response.status().is_success() {
let error = format!(
"OpenTelemetry logs export failed. Url: {}, Status Code: {}, Response: {:?}",
response.status().as_u16(),
request_uri,
response.body()
);
return Err(LogError::Other(error.into()));
}

Check warning on line 45 in opentelemetry-otlp/src/exporter/http/logs.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/logs.rs#L37-L45

Added lines #L37 - L45 were not covered by tests

Ok(())
Expand Down
25 changes: 10 additions & 15 deletions opentelemetry-otlp/src/exporter/http/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,17 @@ impl SpanExporter for OtlpHttpClient {
}

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

Check warning on line 50 in opentelemetry-otlp/src/exporter/http/trace.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/trace.rs#L49-L50

Added lines #L49 - L50 were not covered by tests

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

if !response.status().is_success() {
let error = format!(
"OpenTelemetry trace export failed. Url: {}, Response: {:?}",
request_uri,
response.body()
);
return Err(TraceError::Other(error.into()));
}
if !response.status().is_success() {
let error = format!(
"OpenTelemetry trace export failed. Url: {}, Status Code: {}, Response: {:?}",
response.status().as_u16(),
request_uri,
response.body()
);
return Err(TraceError::Other(error.into()));
}

Check warning on line 60 in opentelemetry-otlp/src/exporter/http/trace.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-otlp/src/exporter/http/trace.rs#L52-L60

Added lines #L52 - L60 were not covered by tests

Ok(())
Expand Down

0 comments on commit 5fd5a9f

Please sign in to comment.