-
Notifications
You must be signed in to change notification settings - Fork 441
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
SimpleExporter is not useable with OTLP/gRPC #2188
Comments
is this open to be worked on @cijothomas ? |
@RichardChukwu thanks for volunteering to fix the issue. Do you have any approach in mind - if we can discuss it here? The tonic crate used for gRPC seems to require the runtime in all scenarios, while SimpleExporter is supposed to work with the futures crate. p.s. - @cijothomas is traveling so there could be a delay in response, assigning it to you for now. |
The problem is that libraries in the exporter network stack enter use tracing_subscriber::filter;
let layer = OpenTelemetryTracingBridge::new(&logger_provider)
.with_filter(
filter::Targets::new().with_target("my-target", Level::INFO)
); |
Yes, opentelemetry-otlp tonic exporter requires a Tokio runtime context, regardless of the choice of simple vs. batch. And you likely want the batch processor with the networked exporter anyway. |
@mzabaluev would you say the Tokio runtime needs to be initialized properly to handle async tasks then? |
Yes, putting the initialization into the tokio runtime context will solve the panic. |
@cijothomas I see you mentioned that exporter hangs with fn init_logs() -> Result<opentelemetry_sdk::logs::LoggerProvider, LogError> {
let tonic_exporter = opentelemetry_otlp::new_exporter()
.tonic()
.with_endpoint("http://localhost:4317");
let res = opentelemetry_otlp::new_pipeline()
.logging()
.with_resource(RESOURCE.clone())
.with_exporter(
tonic_exporter,
)
.install_simple();
//.install_batch(opentelemetry_sdk::runtime::Tokio);
if let Err(ref err) = res {
println!("Error initializing logs: {:?}", err);
}
res
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
let logger_provider = init_logs().unwrap();
// Create a new OpenTelemetryTracingBridge using the above LoggerProvider.
let layer = OpenTelemetryTracingBridge::new(&logger_provider);
let filter = EnvFilter::new("info")
.add_directive("hyper=error".parse().unwrap())
.add_directive("tonic=error".parse().unwrap())
.add_directive("reqwest=error".parse().unwrap());
tracing_subscriber::registry()
.with(filter)
.with(layer)
.init();
info!(name: "my-event", target: "my-target", "hello from {}. My price is {}", "apple", 1.99);
logger_provider.shutdown()?;
} |
|
You are right! Added #2199 recently to prove this with tests, so the fix can be easily validated. |
Yes exactly. Its deadlock caused by reentrancy in SimpleLogProcessor. |
I thought about that, but I doubt the |
Spot on! That is the reason why solving the "Context" problem is important for OTel! It is non-trivial and @lalitb has done a lot of research into this, and came to same conclusion as you shared! This is something we'll need to solve, most likely, after initial stable release of logs and metrics. |
SimpleExporter is not useable with OTLP/gRPC (Tonic client used for gRPC)
Minimal repro:
Panics with
If making the
main
astokio::main
, then export hangs forever.Need to modify exporters in such a way that they don't require async runtimes, and can do normal blocking calls (assuming there are APIs to do that).
The text was updated successfully, but these errors were encountered: