krojew / tracing-elastic-apm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: relative URL without a base with example configuration

ufoscout opened this issue · comments

I am trying this library with the example code from readme.md file, anyway, it keeps printing this error at runtime:

ERROR tracing_elastic_apm::apm_client: Error sending batch to APM! error=builder error: relative URL without a base

My Code:

    let apm_layer = tracing_elastic_apm::new_layer(
        "ServiceName".to_string(),
        tracing_elastic_apm::config::Config::new("127.0.0.1:8200".to_string())
    );

    let subscriber = tracing_subscriber::registry()
        .with(apm_layer);

I am using version 2.1

You need to provide a scheme in the url, otherwise it's impossible to tell which protocol to use, e.g.

    let apm_layer = tracing_elastic_apm::new_layer(
        "ServiceName".to_string(),
        tracing_elastic_apm::config::Config::new("http://127.0.0.1:8200".to_string())
    );

@krojew
thanks for your help.

Could I propose you add this information to the documentation? The fact that the HTTP(s) protocol is required and used is written nowhere.

I would replace this:

let layer = tracing_elastic_apm::new_layer(
    "ServiceName".to_string(),
    tracing_elastic_apm::Config::new("APM address".to_string())
);

with this one that definitely gives more information about the protocol:

let layer = tracing_elastic_apm::new_layer(
    "ServiceName".to_string(),
    tracing_elastic_apm::Config::new("http://127.0.0.1:8200".to_string())
);

@ufoscout I was thinking about that, but that in turn would lead to people trying to run it literally (yes, these things happen). I think it would be better to put a simple comment there.