Skip to content

Commit

Permalink
fix: remove the host tag/log field
Browse files Browse the repository at this point in the history
the tag overwrites datadog's API host field. it isn't a useful value
for metrics or logs anyway

Closes #41
  • Loading branch information
pjenvey committed Aug 2, 2018
1 parent 350caa4 commit 7425749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
11 changes: 2 additions & 9 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
/// the various state behind the server. This provides transitive access to
/// various configuration options of the server as well as the ability to
/// call back into Python.
pub fn new(ws: T, srv: &Rc<Server>, mut uarx: Receiver<String>, host: String) -> Client<T> {
pub fn new(ws: T, srv: &Rc<Server>, mut uarx: Receiver<String>) -> Client<T> {
let srv = srv.clone();
let timeout = Timeout::new(srv.opts.open_handshake_timeout.unwrap(), &srv.handle).unwrap();
let (tx, rx) = mpsc::unbounded();
Expand All @@ -86,7 +86,6 @@ where
srv: srv.clone(),
ws,
user_agent: uastr,
host,
broadcast_subs: broadcast_subs.clone(),
},
timeout,
Expand Down Expand Up @@ -134,7 +133,6 @@ struct SessionStatistics {
uaid_reset: bool,
existing_uaid: bool,
connection_type: String,
host: String,

// Usage data
direct_acked: i32,
Expand Down Expand Up @@ -217,7 +215,6 @@ pub struct UnAuthClientData<T> {
srv: Rc<Server>,
ws: T,
user_agent: String,
host: String,
broadcast_subs: Rc<RefCell<BroadcastSubs>>,
}

Expand Down Expand Up @@ -394,7 +391,6 @@ where
srv,
ws,
user_agent,
host,
broadcast_subs,
} = data;

Expand All @@ -419,7 +415,6 @@ where
uaid_reset: reset_uaid,
existing_uaid: check_storage,
connection_type: String::from("webpush"),
host: host.clone(),
..Default::default()
},
..Default::default()
Expand Down Expand Up @@ -487,10 +482,9 @@ where
let (ua_result, metrics_os, metrics_browser) = parse_user_agent(&parser, &user_agent);
// dogstatsd doesn't support timers: use histogram instead
srv.metrics
.histogram_with_tags("ua.connection.lifespan", elapsed)
.time_with_tags("ua.connection.lifespan", elapsed)
.with_tag("ua_os_family", metrics_os)
.with_tag("ua_browser_family", metrics_browser)
.with_tag("host", &webpush.stats.host)
.send();

// If there's direct unack'd messages, they need to be saved out without blocking
Expand Down Expand Up @@ -524,7 +518,6 @@ where
"uaid_reset" => stats.uaid_reset,
"existing_uaid" => stats.existing_uaid,
"connection_type" => &stats.connection_type,
"host" => &stats.host,
"ua_name" => ua_result.name,
"ua_os_family" => metrics_os,
"ua_os_ver" => ua_result.os_version,
Expand Down
7 changes: 2 additions & 5 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ impl Server {
let srv2 = srv.clone();
let handle2 = handle.clone();

let host = format!("{}", addr.ip());

// Setup oneshot to extract the user-agent from the header callback
let (uatx, uarx) = oneshot::channel();
let callback = |req: &Request| {
Expand Down Expand Up @@ -386,7 +384,7 @@ impl Server {
// the internal state machine.
Box::new(
ws.and_then(move |ws| {
PingManager::new(&srv2, ws, uarx, host)
PingManager::new(&srv2, ws, uarx)
.chain_err(|| "failed to make ping handler")
}).flatten(),
)
Expand Down Expand Up @@ -654,7 +652,6 @@ impl PingManager {
srv: &Rc<Server>,
socket: WebSocketStream<WebpushIo>,
uarx: oneshot::Receiver<String>,
host: String,
) -> io::Result<PingManager> {
// The `socket` is itself a sink and a stream, and we've also got a sink
// (`tx`) and a stream (`rx`) to send messages. Half of our job will be
Expand All @@ -675,7 +672,7 @@ impl PingManager {
timeout: Timeout::new(srv.opts.auto_ping_interval, &srv.handle)?,
waiting: WaitingFor::SendPing,
socket: socket.clone(),
client: CloseState::Exchange(Client::new(socket, srv, uarx, host)),
client: CloseState::Exchange(Client::new(socket, srv, uarx)),
srv: srv.clone(),
})
}
Expand Down

0 comments on commit 7425749

Please sign in to comment.