This message was deleted.
# support
s
This message was deleted.
s
I believe there is no instrumentation support for this framework. How are instrumenting your service?
s
https://crates.io/crates/tracing-opentelemetry I found a tracing integration of opentelemetry and was able to integrate it to warp server. But how do i figure out if events are being fired to port 4317?
s
Did you configure the OTLP exporter?
s
I've the collector which is of type Layered<Opentelemetry> but i don't understand how do i use this to trace warp requests?
s
Not sure I am following, you want to send and see traces in signoz. You need to configure the app to use OTLP exporter something like here https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry-otlp#quickstart
n
You can either be explicit in creating a new tracing span within each of your warp endpoints, or creating a wrapping-filter that creates the tracing span on your behalf: https://willcrichton.net/example-analyzer/warp/filters/trace/fn.request.html I have never seen anything explicit in the Rust OLTP logs (nor the receiving end) to state that messages are sent or received. I have only verified by either inspecting the data directly in clickhouse, or looking for tracing spans through the UI.
s
Copy code
use opentelemetry::sdk::Resource;
use opentelemetry::trace::TraceError;
use opentelemetry::{global, sdk::trace as sdktrace};
use opentelemetry::{trace::Tracer};
use opentelemetry_otlp::WithExportConfig;

use tracing::{error, span};
use tracing_subscriber::layer::SubscriberExt;
// use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::Registry;


fn init_tracer() -> Result<sdktrace::Tracer, TraceError> {
    opentelemetry_otlp::new_pipeline()
        .tracing()
        .with_exporter(opentelemetry_otlp::new_exporter().tonic().with_env())
        .with_trace_config(
            sdktrace::config().with_resource(Resource::default()),
        )
        .install_batch(opentelemetry::runtime::Tokio)
}

#[tokio::main]
async fn main() {
    dotenv::dotenv().ok();

    let tracer = init_tracer().unwrap();
    // Create a tracing subscriber with the configured tracer
    let telemetry = tracing_opentelemetry::layer().with_tracer(tracer);

    // Use the tracing subscriber `Registry`, or any other subscriber
    // that impls `LookupSpan`
    let collector = Registry::default().with(telemetry);

    let log = warp::log("warp_server");
    std_logger::init();

    let route = warp::path("health")
        .and(warp::get())
        .and(warp::path::end())
        .map(|| "ok!");

    let all_app_routes = warp::path("events")
        .and(route)
        .with(log)
        .with(warp::trace::request());

    warp::serve(all_app_routes).run(([0, 0, 0, 0], 3032)).await;
}
This is my
<http://main.rs|main.rs>
code for warp server with opentelemetry and tracing