Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: opentelemetry_appender_tracing does not work with blocking otlp exporter #1745

Open
cortopy opened this issue May 12, 2024 · 0 comments
Labels
bug Something isn't working triage:todo Needs to be traiged.

Comments

@cortopy
Copy link

cortopy commented May 12, 2024

What happened?

The basic example for opentelemetry_appender_tracing is working fine for me.

The same example also works if I use an OTLP exporter with tonic and Tokio runtime within an async context.

However, if I modify the example for opentelemetry_appender_tracing to use an OTLP exporter with reqwest::blocking, the program enters into a deadlock.

This is the code I'm running:

use opentelemetry::KeyValue;
use opentelemetry_appender_tracing::layer;
use opentelemetry_sdk::{
    logs::{Config, LoggerProvider},
    Resource,
};
use tracing::error;
use tracing_subscriber::prelude::*;

fn main() {
    // This exporter is built with reqwest:blocking and will hang
    let otl_exporter = opentelemetry_otlp::new_exporter()
        .http()
        .build_log_exporter()
        .unwrap();
    let provider: LoggerProvider = LoggerProvider::builder()
        .with_config(
            Config::default().with_resource(Resource::new(vec![KeyValue::new(
                "service.name",
                "log-appender-tracing-example",
            )])),
        )
        .with_simple_exporter(otl_exporter)
        .build();
    let layer = layer::OpenTelemetryTracingBridge::new(&provider);
    tracing_subscriber::registry().with(layer).init();

    error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "otel@opentelemetry.io");
    drop(provider);
}

The opentelemetry-otlp crate is used with both reqwest blocking and tonic within an internal config crate:

opentelemetry-otlp = { version = "0.15.0", features = ["logs", "grpc-tonic", "http-proto", "reqwest-blocking-client", "serialize", "metrics", "trace"] }

API Version

I don't know

SDK Version

0.22.1

What Exporters are you seeing the problem on?

OTLP

Relevant log output

No response

@cortopy cortopy added bug Something isn't working triage:todo Needs to be traiged. labels May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage:todo Needs to be traiged.
Projects
None yet
Development

No branches or pull requests

1 participant