This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fill in missing metrics for autopush_rs
the rust side's metrics (via cadence) currently lack the ability to pass datadog tags, currently ua.{message_data,connection.lifespan} Issue: #1054
- Loading branch information
Showing
12 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//! Metrics tie-ins | ||
use std::net::UdpSocket; | ||
|
||
use cadence::{BufferedUdpMetricSink, NopMetricSink, QueuingMetricSink, StatsdClient}; | ||
|
||
use errors::*; | ||
use server::ServerOptions; | ||
|
||
/// Create a cadence StatsdClient from the given options | ||
pub fn metrics_from_opts(opts: &ServerOptions) -> Result<StatsdClient> { | ||
Ok(if let Some(statsd_host) = opts.statsd_host.as_ref() { | ||
let socket = UdpSocket::bind("0.0.0.0:0")?; | ||
socket.set_nonblocking(true)?; | ||
|
||
let host = (statsd_host.as_str(), opts.statsd_port); | ||
let udp_sink = BufferedUdpMetricSink::from(host, socket)?; | ||
let sink = QueuingMetricSink::from(udp_sink); | ||
StatsdClient::from_sink("autopush", sink) | ||
} else { | ||
StatsdClient::from_sink("autopush", NopMetricSink) | ||
}) | ||
} |
Oops, something went wrong.