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 · 3 comments
Assignees
Labels
bug Something isn't working

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

@cijothomas
Copy link
Member

I'll take a look today.

@cijothomas
Copy link
Member

I was able to easily repro this, but unsure why is this deadlocked, despite using reqwest::blocking client. Will investigate more and get back. There are several errors related to async runtimes and we are actively investigating a proper fix to take care of all of them, including this issue!.

@cijothomas
Copy link
Member

This is unrelated to async runtimes, and is caused by exporter itself producing logs which are fed back to opentelemetry.
Test added here: #2199

@cijothomas cijothomas removed the triage:todo Needs to be traiged. label Oct 12, 2024
bsbds added a commit to bsbds/Xline that referenced this issue Oct 12, 2024
open-telemetry/opentelemetry-rust#1745

Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com>
bsbds added a commit to xline-kv/Xline that referenced this issue Oct 12, 2024
open-telemetry/opentelemetry-rust#1745

Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants