commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
482a894c92e1b34223f7ed40be1bd4205517b63d | Nick Pillitteri | 2021-05-10T19:03:54 | Make sure channel is empty before flush | diff --git a/cadence/src/sinks/spy.rs b/cadence/src/sinks/spy.rs
index b9eb4c5..ab4e6ae 100644
--- a/cadence/src/sinks/spy.rs
+++ b/cadence/src/sinks/spy.rs
@@ -185,6 +185,8 @@ mod test {
let (rx, sink) = BufferedSpyMetricSink::with_capacity(None, Some(64));
sink.emit("foo:54|c").unwrap();
si... | 1 | 2 | 0 |
bf77e1780dab926088832a3ac881fb403fd422f6 | Nick Pillitteri | 2021-05-10T18:57:44 | Add tests for all supported types for metrics (floats, durations, etc)
Fixes #142 | diff --git a/cadence-macros/tests/lib.rs b/cadence-macros/tests/lib.rs
index 4dd3bc9..a168e8d 100644
--- a/cadence-macros/tests/lib.rs
+++ b/cadence-macros/tests/lib.rs
@@ -5,6 +5,7 @@ use cadence_macros::{
};
use crossbeam_channel::Receiver;
use std::collections::HashSet;
+use std::time::Duration;
static RX: Sin... | 1 | 11 | 0 |
9279619445217829e2e3d5d056cbcc5216cdc4dd | Nick Pillitteri | 2021-05-09T22:39:50 | Add f64 constructors for histogram and distribution types | diff --git a/cadence/benches/lib.rs b/cadence/benches/lib.rs
index 97e5a77..12f9c19 100644
--- a/cadence/benches/lib.rs
+++ b/cadence/benches/lib.rs
@@ -1,7 +1,7 @@
use cadence::prelude::*;
use cadence::{
- BufferedUdpMetricSink, Counter, Gauge, Histogram, Meter, NopMetricSink, QueuingMetricSink, Set, StatsdClient... | 2 | 27 | 10 |
2c0d2ecde1bb99d6e198083ec4dae31ebefe3a87 | Nick Pillitteri | 2021-03-31T23:20:37 | No dead code | diff --git a/cadence/tests/utils.rs b/cadence/tests/utils.rs
index 69511e8..a6ad52a 100644
--- a/cadence/tests/utils.rs
+++ b/cadence/tests/utils.rs
@@ -4,7 +4,6 @@ use std::sync::Arc;
use std::thread;
use std::time::Duration;
-#[allow(dead_code)]
pub fn run_arc_threaded_test(client: StatsdClient, num_threads: u64... | 1 | 0 | 1 |
82f08dafb3579b6062ee2f42cb7ae588e3140d55 | Nick Pillitteri | 2021-03-31T23:19:38 | Add note to client about distributions | diff --git a/cadence/src/client.rs b/cadence/src/client.rs
index d6e2e78..4e8080b 100644
--- a/cadence/src/client.rs
+++ b/cadence/src/client.rs
@@ -459,6 +459,7 @@ impl StatsdClientBuilder {
/// * `Gauged` for emitting gauge values.
/// * `Metered` for emitting meter values.
/// * `Histogrammed` for emitting histog... | 1 | 1 | 0 |
f71586ed89758a0baa2622257daea8290e69425a | Nick Pillitteri | 2021-03-30T01:38:18 | Update macros crate description
Signed-off-by: Nick Pillitteri <nick@56quarters.xyz> | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index 52792e7..04eea42 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -2,7 +2,7 @@
name = "cadence-macros"
version = "0.25.0"
authors = ["Nick Pillitteri"]
-description = "An extensible Statsd client for Rust"
+description ... | 1 | 1 | 1 |
98e2f602614662d71983d6bdf6e6ceb513d1dd40 | Nick Pillitteri | 2021-03-21T18:57:08 | Name macro benches correctly | diff --git a/cadence-macros/benches/lib.rs b/cadence-macros/benches/lib.rs
index 76f4797..1d20a28 100644
--- a/cadence-macros/benches/lib.rs
+++ b/cadence-macros/benches/lib.rs
@@ -10,13 +10,13 @@ fn benchmark_global_statsdclient_queuing(c: &mut Criterion) {
// of metrics which tends to be accurate except in speci... | 1 | 2 | 2 |
cda3455f7433d1603a76a10dd86decb7af129880 | Duarte Nunes | 2021-03-16T21:00:00 | Add support for distribution metric type (#125)
add support for distribution metric type | diff --git a/cadence-macros/examples/production-setup.rs b/cadence-macros/examples/production-setup.rs
index 0f3fc30..d1a1f92 100644
--- a/cadence-macros/examples/production-setup.rs
+++ b/cadence-macros/examples/production-setup.rs
@@ -8,7 +8,7 @@
// software. If not, see <http://creativecommons.org/publicdomain/zero... | 10 | 159 | 12 |
adc88dca8a7f51202257e30d1bf9d07af4a1ffdd | Nick Pillitteri | 2021-02-07T20:19:20 | Remove generic type from queuing worker
The underlying worker isn't used outside of this crate and doesn't
need to be generic over all types. We're only ever using it with a
`String`. | diff --git a/cadence/src/sinks/queuing.rs b/cadence/src/sinks/queuing.rs
index c138261..1539898 100644
--- a/cadence/src/sinks/queuing.rs
+++ b/cadence/src/sinks/queuing.rs
@@ -66,7 +66,7 @@ use std::thread;
/// sink is stopped.
#[derive(Debug, Clone)]
pub struct QueuingMetricSink {
- worker: Arc<Worker<String>>,... | 1 | 17 | 38 |
6e07809e7d3afabe405bf076ff7310c15a24590c | Nick Pillitteri | 2021-02-03T03:11:39 | Macro documentation improvements | diff --git a/cadence-macros/src/macros.rs b/cadence-macros/src/macros.rs
index 39528aa..8cc7520 100644
--- a/cadence-macros/src/macros.rs
+++ b/cadence-macros/src/macros.rs
@@ -13,6 +13,9 @@
/// Emit a counter using the default global client, optionally with tags
///
+/// The counter will use the prefix from the de... | 1 | 36 | 0 |
98480a2977782e6ea52727402f58e32696782e72 | Nick Pillitteri | 2021-02-03T02:03:12 | Remove unneeded option wrapping metric formatter tags
Remove unneeded option since `Vec::new()` doesn't allocate
so the option isn't saving us any work.
Fixes #120 | diff --git a/cadence/src/builder.rs b/cadence/src/builder.rs
index ace2337..6788c03 100644
--- a/cadence/src/builder.rs
+++ b/cadence/src/builder.rs
@@ -66,7 +66,7 @@ where
key: &'a str,
val: MetricValue,
type_: MetricType,
- tags: Option<Vec<(Option<&'a str>, &'a str)>>,
+ tags: Vec<(Option<&'a st... | 1 | 45 | 21 |
e575ca0d20ee9ca0f40e15f559625fbd05dc8580 | Nick Pillitteri | 2021-01-24T18:56:03 | Add set example to prelude | diff --git a/cadence/src/prelude.rs b/cadence/src/prelude.rs
index 86b89bf..d038ba2 100644
--- a/cadence/src/prelude.rs
+++ b/cadence/src/prelude.rs
@@ -23,6 +23,7 @@
//! client.gauge("some.gauge", 45).unwrap();
//! client.meter("some.meter", 67).unwrap();
//! client.histogram("some.histogram", 89).unwrap();
+//! cl... | 1 | 1 | 0 |
c468e784ceef01020bb02c25f0aca8ebea852064 | Nick Pillitteri | 2021-01-24T18:31:08 | Benchmarks for metric macros
Benchmarks for macros for emitting counter metrics based on
the assumption that counters are representative of all other
types of metrics, for the most part. | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index a234c9d..a7e4a56 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -14,3 +14,10 @@ autobenches = false
[dependencies]
cadence = { path = "../cadence", version = "0.23" }
+
+[dev-dependencies]
+criterion = "0.3.1"
+
+[[b... | 2 | 35 | 0 |
3ecc8d37ea29242fd5b7691ec1afe57842a43e67 | Nick Pillitteri | 2021-01-23T22:47:19 | Cargo link updates | diff --git a/cadence-macros/Cargo.toml b/cadence-macros/Cargo.toml
index da48951..a234c9d 100644
--- a/cadence-macros/Cargo.toml
+++ b/cadence-macros/Cargo.toml
@@ -4,8 +4,8 @@ version = "0.23.0"
authors = ["Nick Pillitteri"]
description = "An extensible Statsd client for Rust"
homepage = "https://github.com/56quart... | 2 | 3 | 3 |
2ab1e0f6eb5a4ca3c883c39b260361bd77d8fd73 | Nick Pillitteri | 2021-01-23T22:36:47 | Happy new year | diff --git a/cadence-macros/src/lib.rs b/cadence-macros/src/lib.rs
index be5be50..7c6bdd1 100644
--- a/cadence-macros/src/lib.rs
+++ b/cadence-macros/src/lib.rs
@@ -1,6 +1,6 @@
// Cadence - An extensible Statsd client for Rust!
//
-// Copyright 2020 Nick Pillitteri
+// Copyright 2020-2021 Nick Pillitteri
//
// Lice... | 17 | 17 | 17 |
10c6667bbcbde934a54cf48e5f5e67d8328cedc6 | Nick Pillitteri | 2021-01-23T22:20:34 | Return correct number of bytes written by MultilineWriter::write
Fixes #117 | diff --git a/cadence/src/io.rs b/cadence/src/io.rs
index ef8da33..c656d12 100644
--- a/cadence/src/io.rs
+++ b/cadence/src/io.rs
@@ -86,7 +86,8 @@ where
// "things" into a single write call to the underlying impl
// (probably a UDP socket). Thus, there's no value in adding
// a ne... | 3 | 23 | 30 |
9f6b0523a17d2fb3f74ee1c94d8c0ca174e0ab54 | Nick Pillitteri | 2018-11-17T01:38:51 | Use Criterion for benchmarks since it doesn't require nightly Rust
Prerequisite for #109 | diff --git a/Cargo.toml b/Cargo.toml
index 612fff1..9895876 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,18 @@ readme = "README.md"
license = "Apache-2.0/MIT"
keywords = ["statsd", "metrics"]
edition = "2018"
+autobenches = false
[dependencies]
crossbeam-channel = "0.5.0"
+[dev-dependencies]
+criteri... | 2 | 150 | 92 |
7e2bc31de2615fba2174f0fb4e7a47f17b88ae03 | Zhang Jingqiang | 2020-11-24T14:48:53 | update to use crossbeam-channel 0.5 | diff --git a/Cargo.toml b/Cargo.toml
index 81cd389..612fff1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ keywords = ["statsd", "metrics"]
edition = "2018"
[dependencies]
-crossbeam-channel = "0.4.0"
+crossbeam-channel = "0.5.0"
[lib]
name = "cadence" | 1 | 1 | 1 |
7317f46ddbfa98b242590b3d8c637d30826c682d | Nick Pillitteri | 2020-11-15T15:35:55 | Documentation examples for `MetricBuilder` | diff --git a/src/builder.rs b/src/builder.rs
index 6600c20..38b1208 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -227,9 +227,9 @@ where
/// This builder adds tags, key-value pairs or just values, to a metric that
/// was previously constructed by a call to a method on `StatsdClient`. The
/// tags are added to... | 1 | 28 | 4 |
51d7a0684a23cd07f500c53fb8d8875946f4611e | Nick Pillitteri | 2020-11-13T19:58:19 | Add methods to `Gauged` trait for f64 values
Many statsd client implementations support floating point values for
gauges (as well as integer values) so we should as well. A survey of
several other clients indicates that gauges are the only type we're
obviously out of alignment on (compared to counters, timers, etc).
... | diff --git a/benches/lib.rs b/benches/lib.rs
index ff431f1..b0f4869 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -122,6 +122,11 @@ fn test_benchmark_new_gauge_obj(b: &mut Bencher) {
b.iter(|| Gauge::new("prefix", "some.gauge", 5));
}
+#[bench]
+fn test_benchmark_new_gauge_f64_obj(b: &mut Bencher) {
+ ... | 7 | 96 | 57 |
f4d3a5dc0d33eb843e5a11f6a323f27057d640c5 | Nick Pillitteri | 2020-10-12T12:55:26 | More documentation around extension points | diff --git a/src/client.rs b/src/client.rs
index 346c92e..539d046 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -262,11 +262,12 @@ pub trait MetricClient: Counted + Timed + Gauged + Metered + Histogrammed + Sett
///
/// This trait exposes methods of the client that would normally be internal
/// but may be usefu... | 2 | 7 | 4 |
f55087259a475da37dedbb271899a653abd0d439 | Nick Pillitteri | 2020-09-29T01:28:07 | Combine "datadog" tag functions into MetricFormatter
The tags emitted by Cadence are pretty solidly using the Datadog metric
format and this isn't likely to change without a major refactor. It
doesn't make sense to attempt to split them out from the rest of the
formatter anymore. | diff --git a/src/builder.rs b/src/builder.rs
index 484a976..9860f4a 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -14,8 +14,6 @@ use crate::types::{Metric, MetricError, MetricResult};
use std::fmt::{self, Write};
use std::marker::PhantomData;
-const DATADOG_TAGS_PREFIX: &str = "|#";
-
/// Uniform holder for ... | 1 | 35 | 60 |
c34dc1e468143d449dc3619ec53fa91f6d0ab149 | Nick Pillitteri | 2020-09-20T12:40:53 | Add spy metric sinks to allow easier integration testing of metrics
Add `SpyMetricSink` and `BufferedSpyMetricSink` which both write metrics
to a shared `Write` implementation to allow callers to verify the metrics
being written. These are not general purpose sinks but rather meant for
testing only.
Fixes #103 | diff --git a/examples/spy-sink.rs b/examples/spy-sink.rs
new file mode 100644
index 0000000..3e94faa
--- /dev/null
+++ b/examples/spy-sink.rs
@@ -0,0 +1,37 @@
+// Cadence - An extensible Statsd client for Rust!
+//
+// To the extent possible under law, the author(s) have dedicated all copyright and
+// related and neig... | 11 | 307 | 25 |
a74cb5888b7f668ffca80b051d2d51117c32ccae | Nick Pillitteri | 2020-09-02T18:20:08 | Add `dyn` keyword to code in docs | diff --git a/src/client.rs b/src/client.rs
index 3040ffa..346c92e 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -246,7 +246,7 @@ pub trait Setted {
/// ```
/// use cadence::{MetricClient, StatsdClient, NopMetricSink};
///
-/// let client: Box<MetricClient> = Box::new(StatsdClient::from_sink(
+/// let client: Box... | 1 | 2 | 2 |
584d9c31ed003d21ecec47e4718d74e1274c70e1 | Nick Pillitteri | 2020-08-17T23:30:02 | Expose .flush() method on `MetricSink` trait (#101)
Allow applications to periodically flush any buffered metrics
before they would otherwise be flushed due to the buffer filling
up.
Fixes #100 | diff --git a/src/sinks/core.rs b/src/sinks/core.rs
index e35cd54..99b1ca8 100644
--- a/src/sinks/core.rs
+++ b/src/sinks/core.rs
@@ -58,6 +58,15 @@ pub trait MetricSink {
/// Send the Statsd metric using this sink and return the number of bytes
/// written or an I/O error.
fn emit(&self, metric: &str) ->... | 3 | 52 | 0 |
32e86e858906ee9a912cd9cca69791f4b7bda97f | Nick Pillitteri | 2020-05-17T13:45:31 | Fix deprecation warnings about Error trait methods | diff --git a/src/types.rs b/src/types.rs
index c470809..46088ba 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -224,6 +224,18 @@ impl fmt::Display for MetricError {
}
impl error::Error for MetricError {
+ fn source(&self) -> Option<&(dyn error::Error + 'static)> {
+ match self.repr {
+ ErrorRe... | 1 | 13 | 7 |
96c8228ba2fbedcd1f080a3ffb5f2a3ed0267b91 | Nick Pillitteri | 2020-02-15T22:29:40 | Histogram methods to support recording Durations as nanoseconds
Add methods to the Histogram trait to support writing stdlib Durations
as nanoseconds. Histogram values are extension to Statsd and may not
be supported on all servers. Where they are supported, this makes it easier
to record sub-millisecond times.
Note ... | diff --git a/examples/tag-view.rs b/examples/tag-view.rs
index 0d05d90..eedc351 100644
--- a/examples/tag-view.rs
+++ b/examples/tag-view.rs
@@ -154,6 +154,19 @@ impl Histogrammed for MetricTagDecorator {
builder
}
+
+ fn histogram_duration_with_tags<'a>(
+ &'a self,
+ key: &'a str,
+ ... | 2 | 100 | 11 |
aadc59be18ced3aa197a167c76655973038c64a4 | Nick Pillitteri | 2019-10-15T01:39:09 | Use Unix socket server test harness for example | diff --git a/examples/unix-socket.rs b/examples/unix-socket.rs
index cd3f516..14c9567 100644
--- a/examples/unix-socket.rs
+++ b/examples/unix-socket.rs
@@ -12,99 +12,31 @@
// agent running on the same machine as your application that is exposed via a Unix
// socket.
//
-// Note that this example should *not* be use... | 4 | 62 | 106 |
3f12454dc28bd4e295beea72f25ae598ab2e6be7 | Nick Pillitteri | 2019-10-14T15:13:26 | Make use of AsRef | diff --git a/src/sinks/unix.rs b/src/sinks/unix.rs
index c4d1b49..b4ea788 100644
--- a/src/sinks/unix.rs
+++ b/src/sinks/unix.rs
@@ -110,7 +110,7 @@ impl UnixWriteAdapter {
impl Write for UnixWriteAdapter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
- self.socket.send_to(buf, self.path.as_pat... | 1 | 1 | 1 |
c6ccfcf238a0abd8b714ed3da033ff84b5088b25 | Nick Pillitteri | 2019-10-13T16:37:47 | Move bounds to where clauses | diff --git a/src/io.rs b/src/io.rs
index 727e230..9ccece7 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -24,7 +24,10 @@ struct WriterMetrics {
/// writes the complete input in a single call to the underlying
/// writer.
#[derive(Debug)]
-pub(crate) struct MultiLineWriter<T: Write> {
+pub(crate) struct MultiLineWriter<T>... | 1 | 12 | 3 |
f4463ff6e095a537b7692a7c458db7ed84e368e5 | Nick Pillitteri | 2019-10-07T00:26:15 | Where clauses for generics | diff --git a/src/sinks/unix.rs b/src/sinks/unix.rs
index 74602fc..60abe7a 100644
--- a/src/sinks/unix.rs
+++ b/src/sinks/unix.rs
@@ -164,7 +164,10 @@ impl BufferedUnixMetricSink {
/// let socket = UnixDatagram::unbound().unwrap();
/// let sink = BufferedUnixMetricSink::from("/run/statsd.sock", socket);
/... | 1 | 8 | 6 |
2e79b4afc25bed42124f666804aa5545b7a4cf19 | Nick Pillitteri | 2019-10-01T23:47:33 | Unix cfg() shorthand | diff --git a/src/sinks/mod.rs b/src/sinks/mod.rs
index dbea334..3a46380 100644
--- a/src/sinks/mod.rs
+++ b/src/sinks/mod.rs
@@ -16,8 +16,8 @@ pub use crate::sinks::core::{MetricSink, NopMetricSink};
pub use crate::sinks::queuing::QueuingMetricSink;
pub use crate::sinks::udp::{BufferedUdpMetricSink, UdpMetricSink};
... | 1 | 2 | 2 |
939a96890860c74e904db49deba47a9b5fc08dcc | Nick Pillitteri | 2019-09-23T00:14:40 | Don't write a trailing newline when bypassing buffer
Don't write a trailing newline when bypassing the buffered
`Write` implementation. The point of the newline is to separate
multiple values sent as part of a single underlying `.write(buf)`
call. It doesn't make sense to add one when only a single piece
of data will ... | diff --git a/src/io.rs b/src/io.rs
index 713334d..9be8181 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -72,10 +72,14 @@ impl<T: Write> Write for MultiLineWriter<T> {
self.metrics.inner_write += 1;
// If the user has given us a value bigger than our buffer
// to write, bypass the buff... | 1 | 13 | 12 |
98c96cfcf397df9aa11a755bc8c6e013edb3f440 | Atul Bhosale | 2019-09-26T16:40:58 | Format code using 'cargo fmt' | diff --git a/benches/lib.rs b/benches/lib.rs
index 9512d6a..495135c 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -8,7 +8,7 @@ use std::net::UdpSocket;
use cadence::prelude::*;
use cadence::{
- BufferedUdpMetricSink, Counter, Gauge, Histogram, Meter, Set, NopMetricSink, QueuingMetricSink,
+ BufferedUdpM... | 9 | 46 | 26 |
388d5214b5ecd2ea32e3b83289c6a8cd022cf126 | Nick Pillitteri | 2019-09-25T00:14:33 | Deprecate the ::from_udp_host() method of the client | diff --git a/benches/lib.rs b/benches/lib.rs
index 27d9653..9512d6a 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -16,6 +16,7 @@ fn new_nop_client() -> StatsdClient {
StatsdClient::from_sink("client.bench", NopMetricSink)
}
+#[allow(warnings)]
fn new_udp_client() -> StatsdClient {
let host = ("127.0... | 3 | 4 | 2 |
98bc2bbf8243b34c7f7c1c6e867ee927df8b1ffe | Nick Pillitteri | 2019-06-29T16:01:32 | Move no-prefix logic to StatsdClientBuilder | diff --git a/src/builder.rs b/src/builder.rs
index bac8354..b59e28d 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -130,15 +130,11 @@ where
}
fn write_base_metric(&self, out: &mut String) {
- if self.prefix.is_empty() {
- let _ = write!(out, "{}:{}|{}", self.key, self.val, self.type_)... | 4 | 92 | 62 |
b60956910b67ee311534352b6f789271904e3b17 | Kevin Rauwolf | 2019-06-28T07:52:58 | Allow empty prefix | diff --git a/src/builder.rs b/src/builder.rs
index 0ff488e..bac8354 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -130,11 +130,15 @@ where
}
fn write_base_metric(&self, out: &mut String) {
- let _ = write!(
- out,
- "{}.{}:{}|{}",
- self.prefix, self.key, self.v... | 1 | 37 | 10 |
44ecd930368839265932a3e668e991af34c5d314 | Nick Pillitteri | 2019-02-12T03:18:51 | Replace uses of crossbeam MsQueue with crossbeam_channel
Replace all uses of crossbeam MsQueue (from 0.3 series) with senders
and receivers from the new crossbeam_channel crate. Use an unbounded
channel to keep the same behavior as MsQueue.
Keep the idea of using "posion pill" messages to allow the sink and
any worke... | diff --git a/Cargo.toml b/Cargo.toml
index c2e20f6..4e58b22 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ license = "Apache-2.0/MIT"
keywords = ["statsd", "metrics"]
[dependencies]
-crossbeam = "0.3.2"
+crossbeam-channel = "0.3.8"
[lib]
name = "cadence"
diff --git a/src/lib.rs b/src/lib.rs
index 90... | 3 | 48 | 28 |
abdc6e7707c8f2186f4fe72666e362564aa1f8db | Nick Pillitteri | 2018-11-30T14:00:49 | Update docs for QueuingMetricSink to mention panic safety | diff --git a/src/sinks/async.rs b/src/sinks/async.rs
index d7db712..a9848b3 100644
--- a/src/sinks/async.rs
+++ b/src/sinks/async.rs
@@ -23,10 +23,10 @@ use sinks::core::MetricSink;
/// Implementation of a `MetricSink` that wraps another implementation
/// and uses it to emit metrics asynchronously, in another thread... | 1 | 5 | 4 |
054f10d5c2f30cfcc4c4e52bbe0876b2baf65d9a | Nick Pillitteri | 2018-11-14T14:26:19 | Ensure that QueuingMetricSink can be used in a catch_unwind() closure | diff --git a/src/sinks/async.rs b/src/sinks/async.rs
index 6330b5e..d7db712 100644
--- a/src/sinks/async.rs
+++ b/src/sinks/async.rs
@@ -11,7 +11,7 @@
use std::fmt;
use std::io;
use std::panic::{AssertUnwindSafe, RefUnwindSafe};
-use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering};
+use std::sync::atomic::{At... | 1 | 29 | 5 |
c9abc4d9d6d8f51e647bb5282a528c5502900fbb | Nick Pillitteri | 2018-10-28T13:04:01 | Implement RefUnwindSafe for StatsdClient
Make sure that the StatsdClient is unwind (panic) safe by ensuring
that pointers to sinks and error handlers require the object to be
unwind safe.
Make the QueuingMetricSink unwind safe by not using a CondVar and
Mutex but instead using an AtomicBool to indicate when the worke... | diff --git a/src/client.rs b/src/client.rs
index 514cb79..8af6595 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -10,6 +10,7 @@
use std::fmt;
use std::net::{ToSocketAddrs, UdpSocket};
+use std::panic::RefUnwindSafe;
use std::sync::Arc;
use std::time::Duration;
@@ -345,15 +346,15 @@ pub trait MetricBackend {
... | 3 | 163 | 42 |
634698bba51cf378209257516b16caeb4ce3de9a | Nick Pillitteri | 2018-10-30T23:33:57 | Use thread::yield_now() to wait for the worker to stop
Since we're probably waiting for I/O to complete, it makes more
sense to give control back to the OS scheduler instead of just
hinting to the CPU that we'll be waiting. | diff --git a/src/sinks/async.rs b/src/sinks/async.rs
index b7a0798..6f90fe1 100644
--- a/src/sinks/async.rs
+++ b/src/sinks/async.rs
@@ -10,7 +10,7 @@
use std::fmt;
use std::io;
-use std::sync::atomic::{spin_loop_hint, AtomicUsize, AtomicBool, Ordering};
+use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering};
... | 1 | 4 | 5 |
e50f4c809a9827dfe1d1320741ea913ca186de60 | Nick Pillitteri | 2018-10-28T12:30:38 | Update docs describing locking / flags in QueuingMetricSink | diff --git a/src/sinks/async.rs b/src/sinks/async.rs
index 6402f97..b7a0798 100644
--- a/src/sinks/async.rs
+++ b/src/sinks/async.rs
@@ -250,15 +250,14 @@ where
/// locking.
///
/// However, in order to enable easier testing, after it stops receiving
-/// messages the `.run()` method will use a `Mutex` to set a "sto... | 1 | 4 | 5 |
36e809d93b64e38ab64ba94ab221a3dc071396a1 | Nick Pillitteri | 2018-10-28T01:30:53 | Switch to an AtomicBool for QueuingMetricSink stopped flag
Use an atomic bool instead of a mutex + condvar for setting the stopped
flag of the QueuingMetricSink. This avoids combining a mutex and atomics
(since clippy warns about this) and makes the code a bit simpler. The
cost of this is that the stop_and_wait method... | diff --git a/src/sinks/async.rs b/src/sinks/async.rs
index 9c78c18..6402f97 100644
--- a/src/sinks/async.rs
+++ b/src/sinks/async.rs
@@ -8,13 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// We actually need the Mutex since we use it with a Condvar
-#... | 1 | 14 | 18 |
840743d3733b94337ca653820430bb52ba42b684 | Nick Pillitteri | 2018-10-28T01:11:24 | Clippy cleanup | diff --git a/src/builder.rs b/src/builder.rs
index d0426a9..afc06b8 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -99,22 +99,22 @@ where
fn from_u64(prefix: &'a str, key: &'a str, val: u64, type_: MetricType) -> Self {
MetricFormatter {
- metric: PhantomData,
- prefix: prefix... | 2 | 11 | 11 |
d01cf54ff957178ff8f46a696433d33316a91804 | Nick Pillitteri | 2018-08-11T19:44:13 | Bench for Set creation | diff --git a/benches/lib.rs b/benches/lib.rs
index 98c1b90..48dabdb 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -8,7 +8,7 @@ use std::net::UdpSocket;
use cadence::prelude::*;
use cadence::{
- BufferedUdpMetricSink, Counter, Gauge, Histogram, Meter, NopMetricSink, QueuingMetricSink,
+ BufferedUdpMetric... | 1 | 6 | 1 |
14d8685051180f5a56fbd44590b0d31cee0f4388 | Nick Pillitteri | 2018-08-11T19:44:03 | Clippy cleanup | diff --git a/src/io.rs b/src/io.rs
index 3d73f2d..d8c6c22 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -13,23 +13,13 @@ use std::io::{BufWriter, Write};
use std::net::{SocketAddr, UdpSocket};
use std::str;
-#[derive(Debug)]
+#[derive(Debug, Default)]
struct WriterMetrics {
inner_write: u64,
buf_write: u64,
... | 3 | 13 | 23 |
950ad43709fda427db4a840de616e13242945589 | Nick Pillitteri | 2018-07-18T17:28:45 | Quiet, clippy! | diff --git a/src/client.rs b/src/client.rs
index cc4f4f9..e298c43 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -743,6 +743,7 @@ impl Setted for StatsdClient {
impl MetricClient for StatsdClient {}
+#[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
fn nop_error_handler(_err: MetricError) {
... | 1 | 1 | 0 |
96a46b2c6c959ec8e3feb1ecf7a60be0eb6e8ccc | Nick Pillitteri | 2018-07-18T17:28:26 | Reject unsafe code | diff --git a/src/lib.rs b/src/lib.rs
index 326d152..90f88c6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -351,6 +351,8 @@
//! ```
//!
+#![forbid(unsafe_code)]
+
extern crate crossbeam;
pub const DEFAULT_PORT: u16 = 8125; | 1 | 2 | 0 |
51dedaa956dc9a14cfa40b230267567b98e388cd | Nick Pillitteri | 2018-07-13T03:26:08 | Note set trait in client docs | diff --git a/src/client.rs b/src/client.rs
index 4468e45..cc4f4f9 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -400,6 +400,7 @@ impl StatsdClientBuilder {
/// * `Gauged` for emitting gauge values.
/// * `Metered` for emitting meter values.
/// * `Histogrammed` for emitting histogram values.
+/// * `Setted` for ... | 1 | 1 | 0 |
759d197d5c3bf2d2799e07b534ac148a334ffe0c | Nick Pillitteri | 2018-05-30T03:50:29 | Example implemention of stacking "tag view" decorators.
Example of decorators implementing `MetricClient` that can be stacked to
add certain tags to all metrics emitted by the instance.
Per #67 | diff --git a/examples/production-sink.rs b/examples/production-sink.rs
index 8fcdbea..170c718 100644
--- a/examples/production-sink.rs
+++ b/examples/production-sink.rs
@@ -4,7 +4,7 @@
// license: you are granted a perpetual, irrevocable license to copy, modify,
// publish, and distribute this file as you see fit.
... | 2 | 212 | 1 |
f2d76b53a3c67afbc13d6915a945a08789c98b2c | Nick Pillitteri | 2018-05-23T01:29:13 | Provide more default impls of trait methods | diff --git a/src/client.rs b/src/client.rs
index 6c83b61..4468e45 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -55,7 +55,9 @@ pub trait Counted {
}
/// Increment or decrement the counter by the given amount
- fn count(&self, key: &str, count: i64) -> MetricResult<Counter>;
+ fn count(&self, key: ... | 1 | 23 | 55 |
b5fa90432777165ac023af01c01bd75e1bc75cd3 | Nick Pillitteri | 2018-05-17T01:19:22 | rustfmt changes | diff --git a/benches/lib.rs b/benches/lib.rs
index b7e5217..98c1b90 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -7,8 +7,10 @@ use test::Bencher;
use std::net::UdpSocket;
use cadence::prelude::*;
-use cadence::{BufferedUdpMetricSink, Counter, Gauge, Histogram, Meter, NopMetricSink,
- QueuingMetr... | 14 | 61 | 48 |
7a57f936e10d392f6b4205f48ccd97f0ae0cc2d2 | Nick Pillitteri | 2018-05-05T22:10:09 | Add trait for exposing client extension points
Add a trait for exposing potential extension points for 3rd party
libraries that wish to implement custom metric types. The trait is
not exposed by default and only available via the `ext` module.
Fixes #73 | diff --git a/src/builder.rs b/src/builder.rs
index c4bb388..65fc06a 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -9,7 +9,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use client::StatsdClient;
+use client::{MetricBackend, StatsdClient};
use std::f... | 4 | 118 | 9 |
c660a024c93476db7fbfa30e5909bdb38d5e0e96 | Nick Pillitteri | 2018-05-05T22:38:09 | Formatter tests for Set type | diff --git a/src/builder.rs b/src/builder.rs
index fbfb5a0..c4bb388 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -410,7 +410,7 @@ fn write_datadog_tags(metric: &mut String, tags: &[(Option<&str>, &str)]) {
#[cfg(test)]
mod tests {
use super::{write_datadog_tags, MetricFormatter};
- use types::{Counter,... | 1 | 27 | 1 |
07418c78ab203c16c08636691ad49ceed7a322b9 | Nick Pillitteri | 2018-05-05T21:14:08 | Export set related types | diff --git a/src/lib.rs b/src/lib.rs
index b06db49..4b96973 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -357,14 +357,14 @@ pub const DEFAULT_PORT: u16 = 8125;
pub use self::builder::MetricBuilder;
-pub use self::client::{Counted, Gauged, Histogrammed, Metered, MetricClient, StatsdClient,
+pub use self::client::{Co... | 1 | 2 | 2 |
0731792efdf3b344d360e678bfb6ab746250ee5c | Nick Pillitteri | 2018-05-04T02:03:50 | Set example for MetricSink trait | diff --git a/src/sinks/core.rs b/src/sinks/core.rs
index 44b853c..a2b2473 100644
--- a/src/sinks/core.rs
+++ b/src/sinks/core.rs
@@ -46,6 +46,12 @@ use std::io;
/// some.histogram:4|h
/// ```
///
+/// ## Set
+///
+/// ``` text
+/// some.set:2|s
+/// ```
+///
/// See the [Statsd spec](https://github.com/b/statsd_spe... | 1 | 6 | 0 |
38f836c2370f5f6fc0c2677412c043a695b70b14 | Jose Narvaez | 2018-05-01T15:05:23 | Added support for Statsd Set metrics.
As discussed in https://github.com/tshlabs/cadence/pull/70 this PR
implements the Set metric types.
Details
- Set infrastructure.
- Tests. | diff --git a/src/builder.rs b/src/builder.rs
index b0f5835..fbfb5a0 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -40,6 +40,7 @@ enum MetricType {
Gauge,
Meter,
Histogram,
+ Set
}
impl fmt::Display for MetricType {
@@ -50,6 +51,7 @@ impl fmt::Display for MetricType {
MetricType:... | 5 | 105 | 5 |
5ff890788f71a0bec7429003c3ca489b421be089 | Nick Pillitteri | 2018-04-19T22:22:32 | Add default methods on client traits where it makes sense.
Fixes #68 | diff --git a/src/client.rs b/src/client.rs
index db1c058..ef8f4c5 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -31,18 +31,26 @@ use types::{Counter, ErrorKind, Gauge, Histogram, Meter, Metric, MetricError, Me
/// extension to Statsd and may not be supported by your server.
pub trait Counted {
/// Increment ... | 1 | 18 | 30 |
6253dc45ba8bfbcacfbb63c308caba4437db6d51 | Nick Pillitteri | 2018-04-19T22:09:47 | Fix up formatting | diff --git a/src/builder.rs b/src/builder.rs
index facf7c7..b0f5835 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -9,9 +9,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use client::StatsdClient;
use std::fmt::{self, Write};
use std::marker::Phantom... | 1 | 3 | 3 |
d68c6d84e9d08d71a25cd6cbf7c07e779aabce4a | Nick Pillitteri | 2018-04-08T23:59:03 | Update Debug impl for StatsdClient | diff --git a/src/client.rs b/src/client.rs
index bd53f69..db1c058 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -536,7 +536,7 @@ impl StatsdClient {
impl fmt::Debug for StatsdClient {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "StatsdClient {{ prefix: {:?}, sink: ... }}", self... | 1 | 1 | 1 |
0154246cbc95388dd94ffb93b1a7e2e72c9d794b | Nick Pillitteri | 2018-03-14T01:18:13 | Warn when MetricBuilder is unused
Fixes #63 | diff --git a/src/builder.rs b/src/builder.rs
index 00bc88f..44a5b47 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -229,6 +229,7 @@ where
///
/// In this example, two key-value tags and one value tag are added to the
/// metric before it is finally sent to the Statsd server.
+#[must_use = "Did you forget to cal... | 1 | 1 | 0 |
d3f2a5ba06a92d7141ee3a24cccabd50dd99b49a | Nick Pillitteri | 2018-02-25T21:53:54 | rustfmt changes (default config) | diff --git a/benches/lib.rs b/benches/lib.rs
index cef0a68..452b44f 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -1,28 +1,24 @@
#![feature(test)]
-extern crate test;
extern crate cadence;
+extern crate test;
use test::Bencher;
use std::net::UdpSocket;
use cadence::prelude::*;
-use cadence::{DEFAULT_PO... | 16 | 175 | 249 |
4e925b7d556855bbb86811aa0a0bd0a820beb588 | Nick Pillitteri | 2018-02-17T18:10:08 | Rework builder docs a little | diff --git a/src/builder.rs b/src/builder.rs
index bcfd182..8569547 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -182,22 +182,23 @@ enum BuilderRepr<'m, 'c, T> where T: Metric + From<String> {
/// Builder for adding tags to in-progress metrics.
///
-/// The only way to instantiate an instance of this builder... | 1 | 15 | 14 |
1afcfbcb9e2aecb65bc000eedd757f5d39e74d2b | Nick Pillitteri | 2018-02-06T23:47:42 | Simplify builder internal representation | diff --git a/src/builder.rs b/src/builder.rs
index c6ee231..44a4e8e 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -169,6 +169,17 @@ where
}
}
+/// Internal state of a MetricBuilder
+///
+/// The builder can either be in the process of formatting a metric to send
+/// via a client or it can be simply holdi... | 2 | 27 | 23 |
4ee7e5268cc2b8b185bc2b708d573929f82e1a17 | Nick Pillitteri | 2018-02-06T01:53:06 | Reduce visibility of internal only things | diff --git a/src/io.rs b/src/io.rs
index 31ebb1d..b4efbe3 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -39,7 +39,7 @@ impl WriterMetrics {
/// writes the complete input in a single call to the underlying
/// writer.
#[derive(Debug)]
-pub struct MultiLineWriter<T: Write> {
+pub(crate) struct MultiLineWriter<T: Write> {
... | 1 | 5 | 5 |
6c93fcab4f31b9ad2851324a87e15cfe29c42d8d | Nick Pillitteri | 2018-02-05T23:12:49 | Clean up client tests around metric formatting | diff --git a/src/client.rs b/src/client.rs
index b4ca1bd..4ead886 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -549,7 +549,7 @@ mod tests {
use super::{trim_key, Counted, Timed, Gauged, Metered, Histogrammed,
MetricClient, StatsdClient};
use ::sinks::NopMetricSink;
- use ::types::{Err... | 1 | 98 | 66 |
8629ae00e6aa6866cb2e7e2141b1794fbbfd3fbb | Nick Pillitteri | 2018-02-05T21:53:05 | Consume builder when calling `.send()`
Consume the builder when finally calling .send() so that we prevent
misuse of the API via multiple calls. Previously the first call would
consume the `Option<Error>`, the next call would then attempt to use
the dummy formatter. | diff --git a/src/builder.rs b/src/builder.rs
index 1e8ddca..c6ee231 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -267,8 +267,10 @@ where
/// res.unwrap().as_metric_str()
/// );
/// ```
- pub fn with_tag(&mut self, key: &'m str, value: &'m str) -> &mut Self {
- self.formatter.with_tag(... | 1 | 30 | 6 |
76af36154df263340fb6c1190308ccb248129096 | Nick Pillitteri | 2018-02-01T03:59:55 | Docs and examples | diff --git a/src/builder.rs b/src/builder.rs
index 610b851..1e8ddca 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -186,6 +186,36 @@ where
/// Currently, only Datadog style tags are supported. For more information on the
/// exact format used, see the
/// [Datadog docs](https://docs.datadoghq.com/developers/dog... | 4 | 82 | 7 |
0f7f2b8578ec5f330bde760a23968087f9a647b1 | Nick Pillitteri | 2018-01-30T05:20:05 | Cleanup + docs | diff --git a/benches/lib.rs b/benches/lib.rs
index 9582c09..cef0a68 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -44,6 +44,18 @@ fn test_benchmark_statsdclient_nop(b: &mut Bencher) {
}
+#[bench]
+fn test_benchmark_statsdclient_nop_with_tags(b: &mut Bencher) {
+ let client = new_nop_client();
+ b.iter(... | 5 | 121 | 13 |
acc6a4966f50c8fb670d65e7a5cf8df55cba88aa | Philip Jenvey | 2018-01-30T19:52:21 | add time_duration_with_tags w/ deferred error handling
and rearrange a bit to only allocate once, even w/ tags | diff --git a/src/builder.rs b/src/builder.rs
index d5d0974..b4ff4f2 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -1,6 +1,7 @@
// Cadence - An extensible Statsd client for Rust!
//
// Copyright 2018 Philip Jenvey <pjenvey@mozilla.com>
+// Copyright 2018 TSH Labs
//
// Licensed under the Apache License, Versi... | 2 | 106 | 62 |
b166ccfcf218c1ce06c1f59671ab42906553c5d6 | Nick Pillitteri | 2018-01-28T01:53:34 | Tests for MetricFormatter | diff --git a/src/builder.rs b/src/builder.rs
index 1428236..d5d0974 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -13,7 +13,7 @@ use std::marker::PhantomData;
use client::StatsdClient;
use types::{Metric, MetricResult};
-#[derive(Clone, Copy)]
+#[derive(PartialEq, Eq, Debug, Hash, Clone, Copy)]
enum MetricVa... | 1 | 129 | 8 |
91a5b33b35d489538911614e36b9383090d8f484 | Nick Pillitteri | 2018-01-28T22:05:37 | Fix tag formatting per Datadog docs | diff --git a/src/builder.rs b/src/builder.rs
index 81e1c36..1428236 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -188,7 +188,7 @@ fn push_datadog_tags(metric: &mut String, tags: &[(Option<&str>, &str)]) {
.sum();
// reserve enough space for prefix, tags/: separators and commas
- let prefix = "... | 1 | 3 | 3 |
280b9c8817675f985bcef019f6cbd2903838f9de | Nick Pillitteri | 2018-01-25T14:21:16 | Split metric builder and formatting and move all metric formatting to new module | diff --git a/src/builder.rs b/src/builder.rs
index fb134b8..81e1c36 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -8,66 +8,173 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use std::fmt::{self, Write};
+use std::marker::PhantomData;
use client::Stats... | 3 | 207 | 68 |
c929704ea787534f2002bed7ade168c9da775260 | Philip Jenvey | 2018-01-17T22:05:16 | initial support for datadog style tags
Issue #41 | diff --git a/src/builder.rs b/src/builder.rs
new file mode 100644
index 0000000..fb134b8
--- /dev/null
+++ b/src/builder.rs
@@ -0,0 +1,130 @@
+// Cadence - An extensible Statsd client for Rust!
+//
+// Copyright 2018 Philip Jenvey <pjenvey@mozilla.com>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APA... | 3 | 209 | 8 |
b67094941b9a6e66b8ee4cf40b2d07e7faba6d03 | Nick Pillitteri | 2017-11-30T03:30:55 | Fix out of date docs | diff --git a/src/client.rs b/src/client.rs
index 05cfe8a..24fcb3f 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -348,8 +348,7 @@ impl StatsdClient {
// Convert a metric to its Statsd string representation and then send
// it as UTF-8 bytes to the metric sink. Convert any I/O errors from the
- // sink... | 1 | 1 | 2 |
787a8887b0743bdd5d6943c4e0f1fe8ac7f64253 | Nick Pillitteri | 2017-11-30T02:54:38 | Include line ending in space required calculation
Include the trailing line ending when determining if there is
enough space in the buffer to write the given byte array. When
the line ending was not included, a write would be attempted
without sufficient space in the buffer which would cause an
excessive number of wri... | diff --git a/src/io.rs b/src/io.rs
index 1f7cc56..31ebb1d 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -15,6 +15,25 @@ use std::net::{SocketAddr, UdpSocket};
use std::str;
+#[derive(Debug)]
+struct WriterMetrics {
+ inner_write: u64,
+ buf_write: u64,
+ flushed: u64,
+}
+
+
+impl WriterMetrics {
+ fn new(... | 1 | 53 | 6 |
f80f880b8dbedca1774f1e26a2a29a5b80334a3d | Nick Pillitteri | 2017-09-22T00:13:24 | Clippy clean-ups | diff --git a/examples/arc-wrapped-client.rs b/examples/arc-wrapped-client.rs
index 52ab8ae..701f8a8 100644
--- a/examples/arc-wrapped-client.rs
+++ b/examples/arc-wrapped-client.rs
@@ -34,7 +34,7 @@ impl ThreadedHandler {
impl RequestHandler for ThreadedHandler {
fn handle(&self) -> Result<(), String> {
- ... | 4 | 5 | 5 |
39193cfda525576b158790e59a0eb7c26a1ff442 | Nick Pillitteri | 2017-07-17T01:04:32 | PHRASING | diff --git a/src/sinks/udp.rs b/src/sinks/udp.rs
index b8ae861..5ce3bc5 100644
--- a/src/sinks/udp.rs
+++ b/src/sinks/udp.rs
@@ -127,9 +127,9 @@ impl MetricSink for UdpMetricSink {
///
/// Metrics are line buffered, meaning that a trailing "\n" is added
/// after each metric written to this sink. When the buffer is ... | 1 | 3 | 3 |
7193b3fc6c28df2b7c4f84efdcba4800bc301e24 | Nick Pillitteri | 2017-07-12T22:29:07 | Split the sink module into several submodules | diff --git a/src/lib.rs b/src/lib.rs
index b1a712f..c6cb8d7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -298,10 +298,7 @@ pub use self::client::{Counted, Timed, Gauged, Metered, Histogrammed,
pub use self::sinks::{MetricSink, NopMetricSink, UdpMetricSink,
- BufferedUdpMetricSink};
-
-
-pub use... | 5 | 378 | 354 |
7f77760d4ed8d3b806260c24f911e01e12f3fc73 | Nick Pillitteri | 2017-02-10T01:44:04 | Add examples of some potential ways to use Cadence
Fixes #36 | diff --git a/examples/arc-wrapped-client.rs b/examples/arc-wrapped-client.rs
new file mode 100644
index 0000000..52ab8ae
--- /dev/null
+++ b/examples/arc-wrapped-client.rs
@@ -0,0 +1,52 @@
+// Cadence - An extensible Statsd client for Rust!
+//
+// This file is dual-licensed to the public domain and under the following... | 5 | 188 | 0 |
4fcbb8ec8160052dedef79b9900fbd747ca16eb5 | Nick Pillitteri | 2017-01-11T16:12:23 | Update StatsdClient usage in benchmarks | diff --git a/benches/lib.rs b/benches/lib.rs
index d8337d6..9582c09 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -8,23 +8,22 @@ use std::net::UdpSocket;
use cadence::prelude::*;
use cadence::{DEFAULT_PORT, StatsdClient, Counter, Timer, Gauge, Meter,
- Histogram, NopMetricSink, UdpMetricSink, Buf... | 1 | 6 | 7 |
0be716878d75583a5a058b489ffa4c10ab9c5a0e | Nick Pillitteri | 2017-01-11T02:02:11 | Remove errant threadpool dep | diff --git a/Cargo.toml b/Cargo.toml
index 6e85b70..f2fa6fc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ keywords = ["statsd", "metrics"]
[dependencies]
crossbeam = "0.2.10"
-threadpool = "1.3.1"
[lib]
name = "cadence" | 1 | 0 | 1 |
51e7b312c6e83d1439e301ec7e4c6d1957dced05 | Nick Pillitteri | 2017-01-03T03:57:16 | Add histogram to lib docs | diff --git a/src/lib.rs b/src/lib.rs
index 8e14f80..21dbfc3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -30,7 +30,7 @@
//!
//! ## Features
//!
-//! * Support for emitting counters, timers, gauges, and meters to Statsd over UDP.
+//! * Support for emitting counters, timers, histograms, gauges, and meters to Statsd ov... | 1 | 1 | 1 |
9c04d5468afff286d8be501824d08b917a327d7f | Nick Pillitteri | 2016-12-21T05:34:42 | Deprecate log and console metric sinks.
Doing this because they are trivial for users to implement themselves and
they just clutter up the namespace of the lib as well as add extra deps.
Fixes #32
Fixes #33 | diff --git a/src/sinks/mod.rs b/src/sinks/mod.rs
index 007cb4a..72ff166 100644
--- a/src/sinks/mod.rs
+++ b/src/sinks/mod.rs
@@ -305,6 +305,9 @@ impl MetricSink for NopMetricSink {
///
/// Metrics are emitted with the `println!` macro.
#[derive(Debug, Clone)]
+#[deprecated(since="0.9.0", note="If you with to use a c... | 1 | 6 | 0 |
a6f934321ba7c8c8e30b348a6ba5368f4c455691 | Nick Pillitteri | 2016-12-13T04:16:30 | Update version number for next release | diff --git a/Cargo.toml b/Cargo.toml
index 12d767a..f13cb57 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cadence"
-version = "0.8.1"
+version = "0.8.2"
authors = ["TSH Labs"]
description = "An extensible Statsd client for Rust"
homepage = "https://github.com/tshlabs/cadence" | 1 | 1 | 1 |
68fa2645eddca77632c5b230d53e4466fd9c370d | Nick Pillitteri | 2016-10-12T04:45:24 | Remove note about "most users" | diff --git a/src/client.rs b/src/client.rs
index 67db4d7..7101ec8 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -186,8 +186,7 @@ impl<T: MetricSink> StatsdClient<T> {
}
/// Create a new client instance that will use the given prefix to send
- /// metrics to the given host over UDP using an appropriat... | 1 | 1 | 2 |
77bcb021ba21f2c27acd6e424265cdaeb8090b4c | Nick Pillitteri | 2016-10-12T04:44:19 | Client doc changes | diff --git a/src/client.rs b/src/client.rs
index 5c99db4..67db4d7 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -120,7 +120,14 @@ pub trait MetricClient: Counted + Timed + Gauged + Metered {}
/// documentation for each mentioned trait.
///
/// The client uses some implementation of a `MetricSink` to emit the met... | 1 | 8 | 1 |
2ed728910d963c94024a36642f50af37a7853ca7 | Nick Pillitteri | 2016-09-10T15:53:17 | Use consistent prefixes for benches | diff --git a/benches/lib.rs b/benches/lib.rs
index 32cec78..781b09b 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -13,14 +13,14 @@ use cadence::{DEFAULT_PORT, StatsdClient, Counter, Timer, Gauge, Meter,
fn new_nop_client() -> StatsdClient<NopMetricSink> {
- StatsdClient::from_sink("test.bench.nop", NopMet... | 1 | 4 | 4 |
829d08ec7fef9c756302ca7a75919e53d5da5b66 | Nick Pillitteri | 2016-09-04T18:49:11 | Clippy doc fixes | diff --git a/src/client.rs b/src/client.rs
index 41c6994..5c99db4 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -86,8 +86,8 @@ pub trait Metered {
/// Trait that encompasses all other traits for sending metrics.
///
-/// If you wish to use StatsdClient with a generic type or place a
-/// StatsdClient instance b... | 2 | 3 | 3 |
6149f5084ee4c5c4e774ba36d1ff881f03b1e561 | Nick Pillitteri | 2016-08-31T02:54:11 | Oops, revert part about all sinks being threadsafe
Specifically, the async sink needs to be cloned to be shared between
threads, that's why we're even mentioning how all the other sinks
implement clone. | diff --git a/src/sinks/threading.rs b/src/sinks/threading.rs
index b43c39a..d598c47 100644
--- a/src/sinks/threading.rs
+++ b/src/sinks/threading.rs
@@ -41,8 +41,7 @@ const DEFAULT_THREAD_POOL_NAME: &'static str = "cadence";
/// itself cannot be shared between threads. Instead, callers may opt to
/// create a `.clone... | 1 | 1 | 2 |
ef321a71239079920530f312f70c7c32d9943b8d | Nick Pillitteri | 2016-08-31T02:49:41 | Clarify docs for MetricClient | diff --git a/src/client.rs b/src/client.rs
index a06c719..41c6994 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -84,7 +84,7 @@ pub trait Metered {
}
-/// Trait that encompasses all other traits for metrics.
+/// Trait that encompasses all other traits for sending metrics.
///
/// If you wish to use StatsdCli... | 1 | 1 | 1 |
937417fe3a454fe5558891b441c53287931ff2c7 | Nick Pillitteri | 2016-08-31T02:47:56 | Doc typos | diff --git a/src/sinks/mod.rs b/src/sinks/mod.rs
index 4a5e8b0..679f55a 100644
--- a/src/sinks/mod.rs
+++ b/src/sinks/mod.rs
@@ -202,7 +202,7 @@ impl BufferedUdpMetricSink {
/// local address with any desired configuration applied (blocking vs
/// non-blocking, timeouts, etc.).
///
- /// Writes to thi... | 2 | 4 | 3 |
9c84ba431997281f56474ea756317c8e8da3079d | Nick Pillitteri | 2016-08-28T00:12:17 | Version bump for 0.8.0 release | diff --git a/Cargo.toml b/Cargo.toml
index 9727af1..3823918 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cadence"
-version = "0.7.0"
+version = "0.8.0"
authors = ["TSH Labs"]
description = "An extensible Statsd client for Rust"
homepage = "https://github.com/tshlabs/cadence" | 1 | 1 | 1 |
60226fdc4da57a71cfbcf169e8f21512207e4f14 | Nick Pillitteri | 2016-08-27T23:40:17 | Set the name of threads in the async threadpool | diff --git a/src/sinks/threading.rs b/src/sinks/threading.rs
index 129941f..4ddb37b 100644
--- a/src/sinks/threading.rs
+++ b/src/sinks/threading.rs
@@ -25,6 +25,11 @@ use ::sinks::MetricSink;
const DEFAULT_THREAD_POOL_SIZE: usize = 4;
+// Default name of the threads in the thread pool used by the
+// `AsyncMetric... | 1 | 9 | 1 |
83a9be6068063445da3f0a928ed84f3908d429a1 | Nick Pillitteri | 2016-08-27T21:31:06 | Make threadpool module a required dependency
Make the threadpool module a required dependency since it
doesn't pull in any other dependencies and is rather light
weight. This is done since it seems that optional library
dependencies are an antipattern [1]
[1] - http://doc.crates.io/manifest.html#usage-in-packages
Cl... | diff --git a/Cargo.toml b/Cargo.toml
index 6fd5974..9727af1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,11 +12,7 @@ keywords = ["statsd", "metrics"]
[dependencies]
log = "0.3"
-threadpool = { version = "1.3.1", optional = true }
-
-[features]
-default = ["threading"]
-threading = ["threadpool"]
+threadpool = "1... | 4 | 165 | 143 |
1d3a2e8c35ee66e1dec6a0113ae3f45dc39a73ce | Nick Pillitteri | 2016-08-18T14:25:24 | Implement Clone trait for StatsdClient and other types
Implement the Clone trait for the client, various types, and all sinks
that can be cloned (anything not dealing with a UDP socket). This makes
it easier to potentially clone client instances to be sent between
threads in the future to support an async client.
Fix... | diff --git a/src/client.rs b/src/client.rs
index 4c00fcb..a06c719 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -121,7 +121,7 @@ pub trait MetricClient: Counted + Timed + Gauged + Metered {}
///
/// The client uses some implementation of a `MetricSink` to emit the metrics.
/// In most cases, users will want to u... | 4 | 53 | 18 |
3b6dbf7eff661f746a7d2b46f3396429a5d4cd9d | Nick Pillitteri | 2016-07-21T22:39:49 | Change comment phrasing a little | diff --git a/src/client.rs b/src/client.rs
index 73cec5b..2612bbd 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -82,10 +82,10 @@ pub trait Metered {
/// Trait that encompasses all other traits for metrics.
///
-/// If you wish to place a StatsdClient instance behind a pointer (such as
-/// a `Box`) this will al... | 1 | 4 | 4 |
ce7e6004b43be865d96e66a170481c0d2da86cf3 | Nick Pillitteri | 2016-07-19T01:12:53 | Move explicit address parsing | diff --git a/src/sinks.rs b/src/sinks.rs
index 24d10bf..b3ee450 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -13,7 +13,7 @@ use log::LogLevel;
use std::io;
use std::net::{ToSocketAddrs, SocketAddr, UdpSocket};
-use ::types::{MetricResult, ErrorKind};
+use ::types::{MetricResult, MetricError, ErrorKind};
/// T... | 1 | 10 | 13 |
de49f72ef8a8f0f71f455955a59684740f37c737 | Nick Pillitteri | 2016-07-16T22:36:35 | Expand on MetricSink trait documentation
Fixes #13 | diff --git a/src/sinks.rs b/src/sinks.rs
index 4da47ed..24d10bf 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -16,6 +16,36 @@ use std::net::{ToSocketAddrs, SocketAddr, UdpSocket};
use ::types::{MetricResult, ErrorKind};
/// Trait for various backends that send Statsd metrics somewhere.
+///
+/// The metric string... | 1 | 30 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.