opentelemetry-rust icon indicating copy to clipboard operation
opentelemetry-rust copied to clipboard

[Bug]: unclear how to setup http(hyper) without agent pipeline

Open ibigbug opened this issue 10 months ago • 1 comments

What happened?

opentelemetry = "0.22"
opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] }
tracing-opentelemetry = "0.23"
opentelemetry-jaeger-propagator = "0.1.0"
opentelemetry-jaeger = { version = "0.21", features = ["collector_client", "hyper_collector_client", "rt-tokio"] }
opentelemetry-otlp = { version = "0.15.0", features = ["http-proto"] }

these are the enabled features

global::set_text_map_propagator(opentelemetry_jaeger_propagator::Propagator::new());

        let otlp_exporter = opentelemetry_otlp::new_exporter()
            .http()
            .with_endpoint(jager_endpoint);
        let tracer =
            opentelemetry_otlp::new_pipeline()
                .tracing()
                .with_exporter(otlp_exporter)
                .with_trace_config(trace::config().with_resource(Resource::new(vec![
                    KeyValue::new("service.name", "clash-rs"),
                ])))
                .install_batch(opentelemetry_sdk::runtime::Tokio)?;

these are the setup

problem is

failed to setup logging: Exporter otlp encountered the following error(s): no http client, you must select one from features or provide your own implementation

how do i active the default hyper client?

ty

API Version

x

SDK Version

x

What Exporters are you seeing the problem on?

No response

Relevant log output

No response

ibigbug avatar Apr 09 '24 12:04 ibigbug

https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-otlp/examples/basic-otlp-http/src/main.rs and https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml#L12 Can you check this example, and see if it helps?

cijothomas avatar Apr 15 '24 17:04 cijothomas

This is not resolved, as shown here : https://github.com/open-telemetry/opentelemetry-rust/pull/1756#issuecomment-2109176774

cijothomas avatar May 14 '24 03:05 cijothomas

125 |         Some(tracing_opentelemetry::layer().with_tracer(tracer))
    |                                             ----------- ^^^^^^ the trait `PreSampledTracer` is not implemented for `opentelemetry_sdk::trace::Tracer`
    |                                             |
    |                                             required by a bound introduced by this call
    |

how to have PreSampledTracer implemented for a tracer below?

   let tracer = opentelemetry_otlp::new_pipeline()
            .tracing()
            .with_exporter(otlp_exporter)
            .with_trace_config(
                trace::config()
                    .with_sampler(Sampler::AlwaysOn)
                    .with_resource(Resource::new(vec![KeyValue::new(
                        "service.name",
                        "clash-rs",
                    )])),
            )
            .install_batch(opentelemetry_sdk::runtime::Tokio)?;

I'm getting new API compatibility issue..

ibigbug avatar May 28 '24 07:05 ibigbug

Hi @ibigbug - if you are still interested here could you check that the example in https://github.com/open-telemetry/opentelemetry-rust/pull/1861/files would help?

markdingram avatar Jun 04 '24 10:06 markdingram

Hey thanks for getting back. I've moved to grpc setup but will give this a try hopefully

ibigbug avatar Jun 04 '24 11:06 ibigbug