Skip to content

SimpleExporter is not useable with OTLP/Http #2189

Open
@cijothomas

Description

SimpleExporter is not useable with OTLP/HTTP (Reqwest client and Hyper client both fails), as export just hangs forever.

Minimal repro when using Reqwest

use tracing::info;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::Registry;
use tracing_subscriber::util::SubscriberInitExt;
use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge;
use opentelemetry_otlp::WithExportConfig;

fn main() {
     let exporter = opentelemetry_otlp::new_exporter().http();
    let logger_provider = opentelemetry_otlp::new_pipeline()
        .logging()
        .with_exporter(
            exporter
                .with_protocol(Protocol::HttpBinary)
                .with_endpoint("http://localhost:4318/v1/logs"),
        )
        .install_simple()
        .unwrap();

    // Create a new OpenTelemetryTracingBridge using the above LoggerProvider.
    let layer = OpenTelemetryTracingBridge::new(&logger_provider);
    tracing_subscriber::registry()
        .with(layer)
        .init();

    info!(name: "my-event", target: "my-target", "hello from {}. My price is {}", "apple", 1.99);

    let _ = logger_provider.shutdown();
}

Minimal repro when using Hyper

let exporter = opentelemetry_otlp::new_exporter().http();
    let exporter = exporter.with_http_client(hyper::HyperClient::default());
    let logger_provider = opentelemetry_otlp::new_pipeline()
        .logging()
        .with_exporter(
            exporter
                .with_protocol(Protocol::HttpBinary)
                .with_endpoint("http://localhost:4318/v1/logs"),
        )
        .install_simple()
        .unwrap();
``

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions