Skip to content

Commit

Permalink
Merge pull request #36 from anirudhRowjee/20-add_IP-anirudh
Browse files Browse the repository at this point in the history
feat: added IP Tag Support (#20)
  • Loading branch information
sile authored Feb 7, 2023
2 parents 1c9b9c1 + 0dace4a commit 7132a19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rand = "0.8.3"
rustracing = "0.6"
thrift_codec = "0.2"
trackable = "1"
local-ip-address = "0.5.1"

[dev-dependencies]
bytecodec = "0.4"
Expand Down
6 changes: 6 additions & 0 deletions src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::error;
use crate::span::FinishedSpan;
use crate::thrift::{agent, jaeger};
use crate::Result;
use local_ip_address::local_ip;
use rustracing::tag::Tag;
use std::net::{SocketAddr, UdpSocket};
use thrift_codec::message::Message;
Expand Down Expand Up @@ -152,6 +153,11 @@ impl JaegerReporter {
if let Ok(Ok(hostname)) = hostname::get().map(|h| h.into_string()) {
this.add_service_tag(Tag::new(constants::TRACER_HOSTNAME_TAG_KEY, hostname));
}

if let Ok(local_ip_address) = local_ip().map(|h| h.to_string()) {
this.add_service_tag(Tag::new(constants::TRACER_IP_TAG_KEY, local_ip_address));
}

Ok(this)
}
fn set_agent_addr(&mut self, addr: SocketAddr) {
Expand Down

0 comments on commit 7132a19

Please sign in to comment.