rustracing_jaeger icon indicating copy to clipboard operation
rustracing_jaeger copied to clipboard

Automatically set ip tag

Open bobrik opened this issue 5 years ago • 1 comments
trafficstars

There's already a constant for it: TRACER_IP_TAG_KEY.

Jaeger uses ip tag to group spans around individual machines for clock skew adjustment and with futures it's easy to mess up and make child spans outlive parents, triggering time travel bamboozle:

  • https://github.com/jaegertracing/jaeger/pull/2052

It's probably best to infer ip tag automatically just like C++ and Go clients do.

bobrik avatar Feb 02 '20 05:02 bobrik

Thank you for you proposal. It seems nice feature. Let me label this issue as a help wanted because I don't have enough time to implement it.

sile avatar Feb 03 '20 08:02 sile

Hello! I'd like to work on this, but don't exactly know where to get started. I'd appreciate any guidance on the same. Thank you!

anirudhRowjee avatar Feb 05 '23 17:02 anirudhRowjee

@anirudhRowjee Thank you. I think you can implement this feature like the code setting hostname tag (see below).

https://github.com/sile/rustracing_jaeger/blob/master/src/reporter.rs#L152-L154

if let Ok(Ok(hostname)) = hostname::get().map(|h| h.into_string()) {
    this.add_service_tag(Tag::new(constants::TRACER_HOSTNAME_TAG_KEY, hostname));
}

sile avatar Feb 06 '23 13:02 sile

Thank you for the guidance! I'm in a much better place to start now. I'm considering introducing this crate (https://docs.rs/local-ip-address/latest/local_ip_address/) as an external dependency, and would appreciate any advice on the same - I'll be working on a PR for this until then!

Once again, thank you for your time!

anirudhRowjee avatar Feb 06 '23 13:02 anirudhRowjee