rustracing_jaeger
rustracing_jaeger copied to clipboard
Automatically set ip tag
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.
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.
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 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));
}
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!