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 |
|---|---|---|---|---|---|---|---|
88e0e42aba189ba62ccb91454ec71b4a3017fc95 | Nick Pillitteri | 2016-07-02T17:23:59 | Unit tests for types::MetricError
Fixes #10 | diff --git a/src/types.rs b/src/types.rs
index e1234a7..2f570a1 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -201,7 +201,9 @@ pub type MetricResult<T> = Result<T, MetricError>;
#[cfg(test)]
mod tests {
- use super::{Counter, Timer, Gauge, Meter, Metric};
+ use std::io;
+ use std::error::Error;
+ use ... | 1 | 42 | 1 |
a4dadd190602cae19f591ee931b318ddc3f7a9b9 | Nick Pillitteri | 2016-07-01T01:30:16 | Clean up metric names in integration tests | diff --git a/tests/lib.rs b/tests/lib.rs
index 21f3119..c8f7856 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -1,6 +1,7 @@
extern crate cadence;
use std::thread;
+use std::time::Duration;
use std::sync::Arc;
use cadence::prelude::*;
@@ -86,7 +87,7 @@ fn test_statsd_client_nop_sink_single_threaded() {
#[ignor... | 1 | 9 | 7 |
17d7ba6d592e77373db547e81fa6af872a83a4d8 | Nick Pillitteri | 2016-07-01T01:29:18 | Fix line length | diff --git a/benches/lib.rs b/benches/lib.rs
index 48adb6d..4717cfd 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -5,8 +5,8 @@ extern crate cadence;
use test::Bencher;
use cadence::prelude::*;
-use cadence::{DEFAULT_PORT, StatsdClient, Counter, Timer, Gauge, Meter, NopMetricSink,
- UdpMetricSink}... | 1 | 2 | 2 |
292a2c835d9cd15016984002fdfd56a81821694a | ngaut | 2016-06-04T10:56:47 | remove debug log in send_metric
Remove debug! calls since this results in quite verbose logs that
don't provide a lot of value. | diff --git a/src/client.rs b/src/client.rs
index 53faf01..6d8692c 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -166,8 +166,7 @@ impl<T: MetricSink> StatsdClient<T> {
// responses.
fn send_metric<M: Metric>(&self, metric: &M) -> MetricResult<()> {
let metric_string = metric.as_metric_str();
- ... | 1 | 1 | 2 |
8f5cb3e4e3b9d3920bb201b6bee6e9e3df33ea80 | Nick Pillitteri | 2016-02-27T16:28:50 | Rename metric string trait | diff --git a/src/client.rs b/src/client.rs
index 4ea1d53..ad2a00b 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -19,7 +19,7 @@ use std::net::{ToSocketAddrs, UdpSocket};
use ::sinks::{MetricSink, UdpMetricSink};
-use ::types::{MetricResult, Counter, Timer, Gauge, Meter, AsMetricStr};
+use ::types::{MetricResult... | 2 | 8 | 8 |
01bb988c5e6b1fc70c1bb29bf1d1a40f8440cc67 | Nick Pillitteri | 2016-02-27T16:27:56 | Missed some imports | diff --git a/src/prelude.rs b/src/prelude.rs
index d7058c0..f2e5cb7 100644
--- a/src/prelude.rs
+++ b/src/prelude.rs
@@ -27,4 +27,4 @@
//! let client = StatsdClient::<UdpMetricSink>::from_udp_host("some.prefix", host);
//! ```
-pub use client::{Counted, Timed, Gauged, Metered};
+pub use ::client::{Counted, Timed, G... | 1 | 1 | 1 |
059bc1fa8e00e508cc6cc75798d80e4af4af479c | Nick Pillitteri | 2016-02-26T05:38:33 | Use qualified imports | diff --git a/src/client.rs b/src/client.rs
index 2800fa9..4ea1d53 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -17,9 +17,9 @@
use std::net::{ToSocketAddrs, UdpSocket};
-use sinks::{MetricSink, UdpMetricSink};
+use ::sinks::{MetricSink, UdpMetricSink};
-use types::{MetricResult, Counter, Timer, Gauge, Meter,... | 2 | 3 | 3 |
21bf8ae208972dd4622ba175fcaba4611f2cf4e7 | Nick Pillitteri | 2016-02-22T03:35:09 | Don't run example code in cadence::prelude
Fixes #5 | diff --git a/src/prelude.rs b/src/prelude.rs
index 30bb78d..d7058c0 100644
--- a/src/prelude.rs
+++ b/src/prelude.rs
@@ -19,7 +19,7 @@
//!
//! # Example
//!
-//! ```
+//! ```no_run
//! use cadence::prelude::*;
//! use cadence::{DEFAULT_PORT, StatsdClient, UdpMetricSink};
//! | 1 | 1 | 1 |
1232cf6619b8a9921f2df957112dfb92deb2333a | Nick Pillitteri | 2016-02-19T04:45:19 | Update copyright for 2016 | diff --git a/src/client.rs b/src/client.rs
index 11474be..2800fa9 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,6 +1,6 @@
// Cadence - An extensible Statsd client for Rust!
//
-// Copyright 2015 TSH Labs
+// Copyright 2015-2016 TSH Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
/... | 5 | 5 | 5 |
b277a546b699f405243e6678b50b8c4746a9fc6a | Nick Pillitteri | 2016-02-19T04:31:06 | Use rustfmt on the code base
Made almost all the suggested changes except for places where it really
does some weird stuff with method chaining. | diff --git a/src/client.rs b/src/client.rs
index 0e814bc..11474be 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -15,24 +15,11 @@
// limitations under the License.
-use std::net::{
- ToSocketAddrs,
- UdpSocket
-};
-
-use sinks::{
- MetricSink,
- UdpMetricSink
-};
-
-use types::{
- MetricResult,
-... | 4 | 47 | 92 |
4cfde3ff7c891b44e3f5ac381e65e54f66f58031 | Nick Pillitteri | 2016-02-19T01:29:10 | Add doc link | diff --git a/Cargo.toml b/Cargo.toml
index c44ccdc..9d32d70 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.4.0"
authors = ["TSH Labs"]
description = "An extensible Statsd client for Rust"
homepage = "https://github.com/tshlabs/cadence"
+documentation = "https://tshlabs.github.io/cadence/"
rep... | 1 | 1 | 0 |
e01b5fa0c811e85f1c551386f8657f1c4911d369 | Nick Pillitteri | 2016-02-11T17:33:19 | Add benchmarks for client with UDP sink | diff --git a/benches/lib.rs b/benches/lib.rs
index 874b6fe..372838b 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -5,6 +5,7 @@ extern crate cadence;
use test::Bencher;
use cadence::{
+ DEFAULT_PORT,
StatsdClient,
Counted,
Timed,
@@ -14,63 +15,120 @@ use cadence::{
Timer,
Gauge,
... | 1 | 67 | 12 |
f300189a95f74d487557275cfc83f8d2405134e4 | Nick Pillitteri | 2016-02-11T17:00:38 | Add benchmarks for metric creation | diff --git a/benches/lib.rs b/benches/lib.rs
index ecd6dc7..874b6fe 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -10,6 +10,10 @@ use cadence::{
Timed,
Gauged,
Metered,
+ Counter,
+ Timer,
+ Gauge,
+ Meter,
NopMetricSink
};
@@ -66,3 +70,36 @@ fn test_benchmark_statsdclient_mark(... | 1 | 37 | 0 |
0581eb7ac6c45694a2a2401931ec168b6a5ff9bb | Nick Pillitteri | 2016-02-11T17:00:05 | Add gauge and timer calls to integration tests | diff --git a/tests/lib.rs b/tests/lib.rs
index 205e2dd..8d7634b 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -104,7 +104,7 @@ fn test_statsd_client_udp_sink_single_threaded() {
const NUM_THREADS: u64 = 100;
-const NUM_ITERATIONS: u64 = 10_000;
+const NUM_ITERATIONS: u64 = 1_000;
#[ignore]
@@ -133,6 +133,8 ... | 1 | 3 | 1 |
4a8a3628c99e48551382662488c64673c3938939 | Nick Pillitteri | 2016-02-07T20:31:32 | Update version for next release | diff --git a/Cargo.toml b/Cargo.toml
index b471c20..9467c67 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cadence"
-version = "0.2.2"
+version = "0.3.0"
authors = ["TSH Labs"]
description = "An extensible Statsd client for Rust"
homepage = "https://github.com/tshlabs/cadence" | 1 | 1 | 1 |
509a5a28d4fc2e0516cbe4d04bfe978e4380b2b6 | Nick Pillitteri | 2016-02-04T02:59:55 | Clarify what `T` is | diff --git a/src/client.rs b/src/client.rs
index 79fe83b..a0da775 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -142,7 +142,7 @@ impl<T: MetricSink> StatsdClient<T> {
/// the contruction method that most users of this library will use.
///
/// **Note** that you must include a type parameter when you ... | 1 | 1 | 1 |
a25e69a1dce4f4eb52f330afe8dec915895b0d3e | Nick Pillitteri | 2016-01-14T01:50:15 | Add hash trait to ErrorKind | diff --git a/src/types.rs b/src/types.rs
index 40dbfaf..16427e3 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -125,7 +125,7 @@ impl ToMetricString for Meter {
/// Potential categories an error from this library falls into.
-#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+#[derive(PartialEq, Eq, Debug, Hash, Clone,... | 1 | 1 | 1 |
966154770e45fe7536c0b65816f57a6661b7e438 | Nick Pillitteri | 2016-01-08T06:29:44 | Benchmarks for all public methods | diff --git a/benches/lib.rs b/benches/lib.rs
index ddf4927..ecd6dc7 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -14,30 +14,55 @@ use cadence::{
};
+fn new_nop_client() -> StatsdClient<NopMetricSink> {
+ StatsdClient::from_sink("test.bench", NopMetricSink)
+}
+
+
#[bench]
-fn test_benchmark_statsdclient... | 1 | 31 | 6 |
e3ce528ac4a59bbd96642806f1d04fafa9867eaf | Nick Pillitteri | 2015-12-30T03:34:03 | Move benchmarks to separate crate so they are not run during tests | diff --git a/benches/lib.rs b/benches/lib.rs
new file mode 100644
index 0000000..ddf4927
--- /dev/null
+++ b/benches/lib.rs
@@ -0,0 +1,43 @@
+#![feature(test)]
+extern crate test;
+extern crate cadence;
+
+use test::Bencher;
+
+use cadence::{
+ StatsdClient,
+ Counted,
+ Timed,
+ Gauged,
+ Metered,
+ ... | 3 | 44 | 42 |
4ced15ef70d46ec6607e4bc3ee405165f3a5747c | Nick Pillitteri | 2015-12-27T00:26:29 | Module level examples and docs | diff --git a/src/lib.rs b/src/lib.rs
index f1138c5..0db3aa5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,34 +6,172 @@
//
-//! # Cadence
-//!
//! An extensible Statsd client for Rust!
//!
//! ## Features
//!
-//!
+//! * Support for emitting counters, timers, gauges, and meters to Statsd over UDP.
+//! * Suppo... | 1 | 146 | 8 |
a5fb4de83954c8f72b1cb05aa3f9f8bfcb38954c | Nick Pillitteri | 2015-12-26T22:59:53 | Derive Hash traits | diff --git a/src/types.rs b/src/types.rs
index 228affe..e3de704 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -21,7 +21,7 @@ pub trait ToMetricString {
/// Counters are simple values incremented or decremented by a client.
///
/// See the `Counted` trait for more information.
-#[derive(PartialEq, Eq, Debug)]
+#[de... | 1 | 4 | 4 |
0a4c8993c296f1b60f16d72df6d5bb12bfe25d60 | Nick Pillitteri | 2015-12-26T21:45:09 | Get rid of header for test module | diff --git a/tests/lib.rs b/tests/lib.rs
index 3709f63..06a8c1e 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -1,7 +1,3 @@
-//!
-//!
-//!
-
extern crate cadence;
use std::thread; | 1 | 0 | 4 |
4035e86f78c9cadbdda9a0898eaafb912efd4cde | Nick Pillitteri | 2015-12-26T21:44:50 | Add file headers and start module documentation | diff --git a/src/client.rs b/src/client.rs
index 082871d..570c2b5 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,3 +1,10 @@
+// Cadence - An extensible Statsd client for Rust!
+//
+// Copyright 2015 TSH Labs
+//
+// Available under the MIT license. See LICENSE for details.
+//
+
use std::net::{
ToSocketAddr... | 4 | 57 | 0 |
8180c8f2f237adaab5d715160f622d98dd8c9373 | Nick Pillitteri | 2015-12-26T00:29:55 | Add "no_run" to docs that touch the network | diff --git a/src/client.rs b/src/client.rs
index 0fff94e..082871d 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -129,7 +129,7 @@ impl<T: MetricSink> StatsdClient<T> {
///
/// # Example
///
- /// ```
+ /// ```no_run
/// use cadence::{StatsdClient, UdpMetricSink};
///
/// let prefi... | 2 | 2 | 2 |
18ee1628241832b180642e1dfb76c50694bf6de4 | Nick Pillitteri | 2015-12-25T21:05:11 | Remove unused dev dependency | diff --git a/Cargo.toml b/Cargo.toml
index b09d4f4..5e5ae56 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,9 +12,6 @@ keywords = ["statsd", "metrics"]
[dependencies]
log = "0.3"
-[dev-dependencies]
-env_logger = "0.3"
-
[lib]
name = "cadence"
path = "src/lib.rs" | 1 | 0 | 3 |
4c64479649c03c90c61d67c0578845aced4d03b9 | Nick Pillitteri | 2015-12-23T03:46:39 | Add author | diff --git a/Cargo.toml b/Cargo.toml
index 78d4b69..b09d4f4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,7 @@
[package]
name = "cadence"
version = "0.1.0"
+authors = ["TSH Labs"]
description = "An extensible Statsd client for Rust"
homepage = "https://github.com/tshlabs/cadence"
repository = "https://githu... | 1 | 1 | 0 |
5b192b007eeec46e8a273b8694dd1b328a83567a | Nick Pillitteri | 2015-12-23T03:38:46 | Add metadata for cargo | diff --git a/Cargo.toml b/Cargo.toml
index 26e5573..78d4b69 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,12 @@
[package]
name = "cadence"
version = "0.1.0"
+description = "An extensible Statsd client for Rust"
+homepage = "https://github.com/tshlabs/cadence"
+repository = "https://github.com/tshlabs/cadence.g... | 1 | 6 | 0 |
4ba694f3145d3830eba051a34d68c52e974a960b | Nick Pillitteri | 2015-12-22T02:45:49 | Remove tests feature since we aren't doing benchmarks | diff --git a/tests/lib.rs b/tests/lib.rs
index 2cecd83..3709f63 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -2,9 +2,6 @@
//!
//!
-#![feature(test)]
-
-extern crate test;
extern crate cadence;
use std::thread; | 1 | 0 | 3 |
3b371a1dca0e0c0a65a3e774b66dedd9cd5fe175 | Nick Pillitteri | 2015-12-22T02:17:17 | Rename project to "cadence" | diff --git a/Cargo.toml b/Cargo.toml
index bad3462..26e5573 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "statsd-client"
+name = "cadence"
version = "0.1.0"
[dependencies]
@@ -9,5 +9,5 @@ log = "0.3"
env_logger = "0.3"
[lib]
-name = "statsd"
+name = "cadence"
path = "src/lib.rs"
... | 4 | 7 | 7 |
bfc5f543efdf9108c88fe39f9496b94906c6d24b | Nick Pillitteri | 2015-12-21T04:18:27 | More docs and random cleanup | diff --git a/src/client.rs b/src/client.rs
index 166aceb..3a05cce 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -90,7 +90,7 @@ pub trait Metered {
/// * `Counted` for emitting counters.
/// * `Timed` for emitting timings.
/// * `Gauged` for emitting gauge values.
-/// * `Metered` for emitting metered values.
+//... | 4 | 18 | 9 |
163dbb3342efc059ee5b62aaa146aff78d1000b2 | Nick Pillitteri | 2015-12-21T02:44:55 | Cleanup client factory methods in tests | diff --git a/tests/lib.rs b/tests/lib.rs
index d066926..fc2c99f 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -28,15 +28,13 @@ use statsd::{
fn new_nop_client(prefix: &str) -> StatsdClient<NopMetricSink> {
- let sink = NopMetricSink;
- StatsdClient::from_sink(prefix, sink)
+ StatsdClient::from_sink(pref... | 1 | 2 | 4 |
697f3c18c90f9491666e68123135bc9221ccf0c6 | Nick Pillitteri | 2015-12-21T02:44:32 | Comment for private send method | diff --git a/src/client.rs b/src/client.rs
index cd0472a..166aceb 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -153,6 +153,10 @@ impl<T: MetricSink> StatsdClient<T> {
Ok(StatsdClient::from_sink(prefix, sink))
}
+ // Convert a metric to its Statsd string representation and then send
+ // it as... | 1 | 4 | 0 |
512eb271ab46c7110ddd7e8cfe58baa94b5b02e0 | Nick Pillitteri | 2015-12-20T21:44:08 | Docs for the MetricSink trait | diff --git a/src/sinks.rs b/src/sinks.rs
index 49ab533..b5f6dc4 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -11,8 +11,10 @@ use types::{
ErrorKind
};
-///
+/// Trait for various backends that send Statsd metrics somewhere.
pub trait MetricSink {
+ /// Send the Statsd metric using this sink and return th... | 1 | 5 | 3 |
9458ec19293835800dbd295b1d496a8bfa9287e3 | Nick Pillitteri | 2015-12-20T20:22:14 | Add tests for various traits/methods implemented by StatsdClient | diff --git a/src/client.rs b/src/client.rs
index 623374e..cd0472a 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -46,7 +46,7 @@ pub trait Counted {
///
/// See the [Statsd spec](https://github.com/b/statsd_spec) for more information.
pub trait Timed {
- /// Record a timing in milliseconds under the given key
+... | 3 | 54 | 48 |
8048731d8b76ee1b424d4af24b95d2905ed9548d | Nick Pillitteri | 2015-12-18T14:10:29 | Make Counters, Timers, etc. part of the trait return types
This should make testing the client itself easier now that there's some
logic in it (incr and decr methods, for example). This means making the
types part of the public API of the client (not thrilled about that) and
removing "sampling" from counters since f32... | diff --git a/src/client.rs b/src/client.rs
index 8f497e4..623374e 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -28,17 +28,13 @@ use types::{
/// See the [Statsd spec](https://github.com/b/statsd_spec) for more information.
pub trait Counted {
/// Increment the counter by `1`
- fn incr(&self, key: &str) -... | 4 | 64 | 74 |
08982d45ff4ffee7bd54912fcc284ee86ca6b4b9 | Nick Pillitteri | 2015-12-18T00:06:08 | Clean up UDP sink smoke test | diff --git a/src/sinks.rs b/src/sinks.rs
index 297bb2c..49ab533 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -169,8 +169,7 @@ mod tests {
#[test]
fn test_udp_metric_sink() {
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
- let host = ("127.0.0.1", 8215);
- let sink = UdpMetricSi... | 1 | 1 | 2 |
5d4d08dcc941630d95aa1a8ce100033b1a659f78 | Nick Pillitteri | 2015-12-18T00:05:50 | Spacing in doc examples | diff --git a/src/client.rs b/src/client.rs
index 58caf73..8f497e4 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -116,6 +116,7 @@ impl<T: MetricSink> StatsdClient<T> {
///
/// ```
/// use statsd::{StatsdClient, NopMetricSink};
+ ///
/// let prefix = "my.stats";
/// let client = StatsdClie... | 1 | 2 | 0 |
df432c65f0a6dc6948f0746267bc068de53861a1 | Nick Pillitteri | 2015-12-17T14:12:15 | Add "unit test" for UDP metric sink | diff --git a/src/sinks.rs b/src/sinks.rs
index 84a47b6..297bb2c 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -60,6 +60,7 @@ impl UdpMetricSink {
// this sink goes.
let mut addr_iter = try!(sink_addr.to_socket_addrs());
let addr = try!(addr_iter.next().ok_or(
+ // Tuple that Metr... | 1 | 16 | 3 |
32d668a9df862fc70088966afb063a50b08e0b93 | Nick Pillitteri | 2015-12-17T14:02:47 | More docs for UDP sink | diff --git a/src/sinks.rs b/src/sinks.rs
index 80d8f5e..84a47b6 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -34,6 +34,24 @@ impl UdpMetricSink {
/// The address should be the address of the remote metric server to
/// emit metrics to over UDP. The socket should already be bound to a
/// local address... | 1 | 18 | 0 |
8a78abf6dbc7243f7e678f7da909a36ab7ded616 | Nick Pillitteri | 2015-12-17T05:55:25 | Add more docs and a method to easily get a configured client | diff --git a/src/client.rs b/src/client.rs
index 1deea5d..58caf73 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,4 +1,12 @@
-use sinks::MetricSink;
+use std::net::{
+ ToSocketAddrs,
+ UdpSocket
+};
+
+use sinks::{
+ MetricSink,
+ UdpMetricSink
+};
use types::{
MetricResult,
@@ -16,6 +24,8 @@ u... | 2 | 79 | 17 |
a1d510815d3ae37a16db42a0c533e621ad45e044 | Nick Pillitteri | 2015-12-17T02:56:11 | Remove generic parameter from UDP sink
* Add new "ErrorKind" enum to MetricErrors
* Add error kind that corresponds to invalid input
* Use invalid input kind to allow parsing of ToSocketAddrs in
construction of the UDP metric sink to make it less awkward to
work with | diff --git a/src/lib.rs b/src/lib.rs
index 98d3f5b..081d117 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -26,7 +26,8 @@ pub use self::sinks::{
pub use self::types::{
MetricResult,
- MetricError
+ MetricError,
+ ErrorKind
};
mod client;
diff --git a/src/sinks.rs b/src/sinks.rs
index c1996d0..80d8f5e ... | 3 | 59 | 11 |
893bdb1e2a29872b434e5fa62e0bfb8f1d814f89 | Nick Pillitteri | 2015-12-16T22:50:50 | Documentation for sinks and various traits | diff --git a/src/client.rs b/src/client.rs
index 640284b..1deea5d 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -10,7 +10,7 @@ use types::{
};
-/// Trait for incrementing and decrementing counters
+/// Trait for incrementing and decrementing counters.
///
/// Counters are simple values incremented or decreme... | 2 | 24 | 3 |
0474ac39f2d51f866d503b88608df8c88d4efd84 | Nick Pillitteri | 2015-12-16T20:11:45 | Start documenting the client | diff --git a/src/client.rs b/src/client.rs
index 38a117c..640284b 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -1,7 +1,3 @@
-//!
-//!
-//!
-
use sinks::MetricSink;
use types::{
@@ -14,29 +10,62 @@ use types::{
};
+/// Trait for incrementing and decrementing counters
///
+/// Counters are simple values in... | 3 | 38 | 13 |
af13077e74d2523973c623d5043519bea9553edf | Nick Pillitteri | 2015-12-16T18:14:05 | Rename metrics -> client module | diff --git a/src/metrics.rs b/src/client.rs
similarity index 100%
rename from src/metrics.rs
rename to src/client.rs
diff --git a/src/lib.rs b/src/lib.rs
index 4ce0438..98d3f5b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,7 +7,7 @@ extern crate log;
pub const DEFAULT_PORT: u16 = 8125;
-pub use self::metrics::{
+... | 2 | 4 | 2 |
b7a5b0686c1ba4eb48e2ef5e468dbd0017edb49c | Nick Pillitteri | 2015-12-16T02:49:57 | Make log level configurable | diff --git a/src/sinks.rs b/src/sinks.rs
index 99f7354..fed9ddb 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -2,6 +2,7 @@
//!
//!
+use log::LogLevel;
use std::io;
use std::net::{ToSocketAddrs, UdpSocket};
@@ -55,12 +56,21 @@ impl MetricSink for ConsoleMetricSink {
}
-pub struct LoggingMetricSink;
+pub s... | 1 | 15 | 3 |
3c79eed58573c6d21a6afd2c592d61542793eea5 | Nick Pillitteri | 2015-12-16T02:35:53 | MetricSink implementations that might be useful for debugging | diff --git a/src/sinks.rs b/src/sinks.rs
index 219e2f4..99f7354 100644
--- a/src/sinks.rs
+++ b/src/sinks.rs
@@ -44,8 +44,57 @@ impl MetricSink for NopMetricSink {
}
+pub struct ConsoleMetricSink;
+
+
+impl MetricSink for ConsoleMetricSink {
+ fn emit(&self, metric: &str) -> io::Result<usize> {
+ println... | 1 | 49 | 0 |
3a6ccc0e76892930de356d531a025a77bd2be31c | Nick Pillitteri | 2015-12-16T02:25:28 | Remove Option from .sample() signature | diff --git a/src/metrics.rs b/src/metrics.rs
index 8634c5e..38a117c 100644
--- a/src/metrics.rs
+++ b/src/metrics.rs
@@ -19,7 +19,7 @@ pub trait Counted {
fn incr(&self, key: &str) -> MetricResult<()>;
fn decr(&self, key: &str) -> MetricResult<()>;
fn count(&self, key: &str, count: i64) -> MetricResult<(... | 2 | 6 | 5 |
be0b16e4bde0332651e9fd820c976f85b5c6bae0 | Nick Pillitteri | 2015-12-15T21:13:21 | Add new methods to Counted trait and remote sampling from Timed | diff --git a/src/metrics.rs b/src/metrics.rs
index c0462d8..8634c5e 100644
--- a/src/metrics.rs
+++ b/src/metrics.rs
@@ -16,13 +16,16 @@ use types::{
///
pub trait Counted {
- fn count(&self, key: &str, count: i64, sampling: Option<f32>) -> MetricResult<()>;
+ fn incr(&self, key: &str) -> MetricResult<()>;
+ ... | 3 | 29 | 23 |
a908439d49f4920315cbab514488892409292c3b | Nick Pillitteri | 2015-12-14T23:56:28 | Change repo to be only a client impl | diff --git a/Cargo.toml b/Cargo.toml
index 065de55..bad3462 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "statsd"
+name = "statsd-client"
version = "0.1.0"
[dependencies]
@@ -11,8 +11,3 @@ env_logger = "0.3"
[lib]
name = "statsd"
path = "src/lib.rs"
-
-[[bin]]
-name = "statsd"
-pat... | 9 | 29 | 68 |
822e60445522690d69ac326fde0a3d851b84ee48 | Nick Pillitteri | 2015-12-14T03:24:45 | Rename metric sink method and random cleanup | diff --git a/src/bin.rs b/src/bin.rs
index bb55f4c..4913ff7 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -11,7 +11,6 @@ fn main() {
let metric_host = ("127.0.0.1", DEFAULT_PORT);
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
let sink = UdpMetricSink::new(metric_host, socket);
- //let sink = Conso... | 5 | 16 | 9 |
86c8aa6d00d7ebc86d7bc0d645094448816a85fd | Nick Pillitteri | 2015-12-07T02:10:09 | Remove explicit use of heap allocation (via Box) | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 1a31b9f..e9c0349 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -40,8 +40,8 @@ pub trait Metered {
///
pub struct StatsdClient<T: MetricSink> {
- key_gen: Box<KeyGenerator>,
- sink: Box<T>
+ key_gen: KeyGenerator,
+ sink... | 2 | 8 | 10 |
4010be356014fe877b8a986ef72e71dd255b3318 | Nick Pillitteri | 2015-12-05T23:09:29 | Add implementation of the "meter" metric type and move traits out of the types module | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 74f1016..1a31b9f 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -2,20 +2,40 @@
//!
//!
+use client::sinks::MetricSink;
+
use client::types::{
- MetricSink,
MetricResult,
Counter,
Timer,
Gauge,
- Counted,
-... | 5 | 89 | 34 |
eeda65e28e18eac552a43219d889b6fb6b52fdb1 | Nick Pillitteri | 2015-12-05T22:45:56 | Use struct for error and private enum for the inner repr | diff --git a/src/client/types.rs b/src/client/types.rs
index 928ed27..80ea721 100644
--- a/src/client/types.rs
+++ b/src/client/types.rs
@@ -107,17 +107,22 @@ impl ToMetricString for Gauge {
}
}
+#[derive(Debug)]
+pub struct MetricError {
+ repr: ErrorRepr
+}
+
#[derive(Debug)]
-pub enum MetricError {
+en... | 1 | 13 | 8 |
72abaf41aed4410f179d32316610722553978dd5 | Nick Pillitteri | 2015-12-05T22:44:38 | Update argument types to match the StatsD spec[1]
[1] - https://github.com/b/statsd_spec | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index e40a8fa..74f1016 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -46,7 +46,7 @@ impl<T: MetricSink> StatsdClient<T> {
impl<T: MetricSink> Counted for StatsdClient<T> {
- fn count(&self, key: &str, count: u64, sampling: Option<f32... | 3 | 11 | 11 |
22bb1d01589cc58852597d17200f96d21b0210ff | Nick Pillitteri | 2015-12-04T04:19:49 | Make threads and iterations parameters and actually inspect the results of the threads | diff --git a/tests/lib.rs b/tests/lib.rs
index ae6a2de..e6d2b8c 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -82,7 +82,7 @@ fn test_statsd_client_as_gauge() {
#[test]
fn test_statsd_client_nop_sink_single_threaded() {
let client = new_nop_client("counter.threaded.nop");
- run_threaded_test(client, 1);
+ ... | 1 | 19 | 9 |
af16ea868a16fc01b863252b1e37e912f9061d77 | Nick Pillitteri | 2015-12-04T04:19:00 | Move key generation logic to separate struct | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 624c55e..e40a8fa 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -15,29 +15,27 @@ use client::types::{
};
+// TODO: Make a sink impl that send metrics to a thread?
+
+
///
pub struct StatsdClient<T: MetricSink> {
- prefix: Stri... | 1 | 45 | 26 |
a468898986c0c4a7da563854418ff823eed485af | Nick Pillitteri | 2015-12-01T04:38:57 | Move all traits to types module and move some funcs to StatsdClient impl | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 10bd3ea..624c55e 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -2,49 +2,19 @@
//!
//!
-use client::sinks::MetricSink;
use client::types::{
+ MetricSink,
MetricResult,
Counter,
Timer,
Gauge,
+ Counted,
+ ... | 4 | 56 | 61 |
6e07eb7011033ce2530e69e52b269c15fcb3fd58 | Nick Pillitteri | 2015-11-30T22:36:42 | Only need to manually borrow the address | diff --git a/src/client/sinks.rs b/src/client/sinks.rs
index 1c64c6f..a99fc25 100644
--- a/src/client/sinks.rs
+++ b/src/client/sinks.rs
@@ -30,8 +30,7 @@ impl<A: ToSocketAddrs> UdpMetricSink<A> {
impl<A: ToSocketAddrs> MetricSink for UdpMetricSink<A> {
fn send(&self, metric: &str) -> io::Result<usize> {
... | 1 | 1 | 2 |
7145d1558746f3dabacbb11d5d007617977ee06d | Nick Pillitteri | 2015-11-30T22:26:27 | Use reference for sending actual metric | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 99de2c7..10bd3ea 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -59,7 +59,7 @@ impl<T: MetricSink> StatsdClient<T> {
StatsdClient{prefix: trimmed.to_string(), sink: Box::new(sink)}
}
- fn send_metric<M: ToMetricSt... | 1 | 4 | 4 |
497502cc8c0df1c35e4ee35372f7673c93d7dabc | Nick Pillitteri | 2015-11-30T22:25:28 | Rename net module to sinks | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index cc72be6..99de2c7 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -2,7 +2,7 @@
//!
//!
-use client::net::MetricSink;
+use client::sinks::MetricSink;
use client::types::{
MetricResult,
Counter,
diff --git a/src/client/mod.rs... | 3 | 3 | 3 |
ee469fd59e1b0e269e9cb2f35437306cc922b7e3 | Nick Pillitteri | 2015-11-30T19:36:16 | Move impls next to each struct | diff --git a/src/client/types.rs b/src/client/types.rs
index e8aab99..2af3c82 100644
--- a/src/client/types.rs
+++ b/src/client/types.rs
@@ -15,6 +15,13 @@ pub struct Counter {
}
+impl Counter {
+ ///
+ pub fn new<S: Into<String>>(key: S, count: u64, sampling: Option<f32>) -> Counter {
+ Counter{key: ... | 1 | 26 | 24 |
904a975bbfff4a54ddd500b9d6f1235a492db298 | Nick Pillitteri | 2015-11-30T18:32:24 | Remove unused console sink | diff --git a/src/client/mod.rs b/src/client/mod.rs
index edc0dff..592620c 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -15,7 +15,6 @@ pub use self::metrics::{
pub use self::net::{
MetricSink,
UdpMetricSink,
- ConsoleMetricSink,
NopMetricSink
};
diff --git a/src/client/net.rs b/src/cli... | 2 | 0 | 14 |
516b60b26e8ce62b79fdafb74922098ddbb76bdb | Nick Pillitteri | 2015-11-30T04:34:46 | Add tests the use the real UDP client | diff --git a/tests/lib.rs b/tests/lib.rs
index 41570ec..ae6a2de 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -7,11 +7,14 @@
extern crate test;
extern crate statsd;
+use std::net::UdpSocket;
use std::thread;
use std::sync::Arc;
use statsd::client::{
+ DEFAULT_PORT,
NopMetricSink,
+ UdpMetricSink,
... | 1 | 30 | 4 |
9dcffbf7c1c3ee817a1f478bc0f64f75a8cb5482 | Nick Pillitteri | 2015-11-30T04:19:36 | Remove benchmark tests and add threaded integration tests (nop MetricSink impl) | diff --git a/tests/lib.rs b/tests/lib.rs
index b96f0b8..41570ec 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -7,11 +7,12 @@
extern crate test;
extern crate statsd;
-use test::Bencher;
+use std::thread;
+use std::sync::Arc;
use statsd::client::{
- ConsoleMetricSink,
NopMetricSink,
+ MetricSink,
... | 1 | 33 | 29 |
4a715060010ad29708947b493db1d597495d1794 | Nick Pillitteri | 2015-11-30T03:25:38 | Use self keyword for module exports | diff --git a/src/client/mod.rs b/src/client/mod.rs
index 184a2dc..edc0dff 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -5,21 +5,21 @@
pub const DEFAULT_PORT: u16 = 8125;
-pub use client::metrics::{
+pub use self::metrics::{
Counted,
Timed,
Gauged,
StatsdClient
};
-pub use client... | 1 | 3 | 3 |
5d40efe1c19dff0404bdb0b0608ef33d7cdf8ba9 | Nick Pillitteri | 2015-11-29T21:58:14 | Use Into trait to avoid an extra String allocation | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 2a93434..cc72be6 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -70,8 +70,7 @@ impl<T: MetricSink> StatsdClient<T> {
impl<T: MetricSink> Counted for StatsdClient<T> {
fn count(&self, key: &str, count: u64, sampling: Option<f32>)... | 2 | 10 | 12 |
f07b0cc70e0d4100f2e1531e487163c558d142b6 | Nick Pillitteri | 2015-11-29T20:21:15 | Use Option methods instead of case matching | diff --git a/src/client/types.rs b/src/client/types.rs
index 6884795..2358e54 100644
--- a/src/client/types.rs
+++ b/src/client/types.rs
@@ -59,20 +59,18 @@ pub trait ToMetricString {
impl ToMetricString for Counter {
fn to_metric_string(&self) -> String {
- match self.sampling {
- Some(val) =... | 1 | 6 | 8 |
145a92832e99a6b093568e3ccdf14245f993ebfa | Nick Pillitteri | 2015-11-27T03:53:54 | Remove todo | diff --git a/src/client/net.rs b/src/client/net.rs
index d26a2ae..8a29284 100644
--- a/src/client/net.rs
+++ b/src/client/net.rs
@@ -7,9 +7,6 @@ use std::io;
use std::net::{ToSocketAddrs, UdpSocket};
-// TODO: Should this accept a Metric? Do we need to accept multiple
-// metrics and add '\n' for TCP sockets?
-
/... | 1 | 0 | 3 |
a4969e06947c8a701930151045734d7df874983c | Nick Pillitteri | 2015-11-27T03:50:32 | Use console impl for tests and nop impl for benchmarks | diff --git a/tests/lib.rs b/tests/lib.rs
index 1d99cee..b96f0b8 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -7,13 +7,11 @@
extern crate test;
extern crate statsd;
-use std::net::{UdpSocket};
-
use test::Bencher;
use statsd::client::{
- DEFAULT_PORT,
- UdpMetricSink,
+ ConsoleMetricSink,
+ NopMet... | 1 | 16 | 18 |
2b66426ff03406a1cb5db6233c62948a413b52ae | Nick Pillitteri | 2015-11-27T03:50:10 | Unwrap results | diff --git a/src/bin.rs b/src/bin.rs
index dc42839..bb55f4c 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -11,9 +11,10 @@ fn main() {
let metric_host = ("127.0.0.1", DEFAULT_PORT);
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
let sink = UdpMetricSink::new(metric_host, socket);
+ //let sink = Cons... | 1 | 4 | 3 |
5512fda8ab94e2da9ebb0ff9959122bdd0c6515a | Nick Pillitteri | 2015-11-27T03:47:53 | Implement start of MetricResult and MetricError
* Implement From and Error traits to remove use of explicit matching for error handling
* Change MetricSink trait to accept &str to allow useful alternate impls
* Add console and no-op implementations of MetricSink | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 585ea4e..2a93434 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -5,7 +5,6 @@
use client::net::MetricSink;
use client::types::{
MetricResult,
- MetricError,
Counter,
Timer,
Gauge,
@@ -62,18 +61,9 @@ impl<T: Metri... | 4 | 56 | 35 |
f8eaca6170bbe4db9fdf979340915cc2faa12a7c | Nick Pillitteri | 2015-11-26T00:41:44 | Remove superfluous returns | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 139e169..585ea4e 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -67,11 +67,11 @@ impl<T: MetricSink> StatsdClient<T> {
match self.sink.send(bytes) {
Ok(n) => {
debug!("Wrote {} bytes to socket", n)... | 1 | 2 | 2 |
0212a9a168c731463b38e768cacf6febf24e1b24 | Nick Pillitteri | 2015-11-26T00:40:19 | Add performance integration tests (can't get them to run yet) | diff --git a/tests/lib.rs b/tests/lib.rs
index f77c448..1d99cee 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -2,10 +2,15 @@
//!
//!
+#![feature(test)]
+
+extern crate test;
extern crate statsd;
use std::net::{UdpSocket};
+use test::Bencher;
+
use statsd::client::{
DEFAULT_PORT,
UdpMetricSink,
@@... | 1 | 29 | 9 |
52d0822b0bca52ccd847592e7f7e2b72987f8aa0 | Nick Pillitteri | 2015-11-26T00:39:34 | Start of result/error handling for metric calls | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 998ba2a..139e169 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -3,34 +3,46 @@
//!
use client::net::MetricSink;
-use client::types::{Counter, Timer, Gauge, ToMetricString};
+use client::types::{
+ MetricResult,
+ MetricError,
... | 4 | 98 | 31 |
52d3b18210482866f88dea9c91d5c2bbe08c04ac | Nick Pillitteri | 2015-11-25T13:44:03 | Change counters/timers/gauges to use 64 bit values | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index b3ab501..998ba2a 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -18,19 +18,19 @@ fn make_key(prefix: &str, key: &str) -> String {
///
pub trait Counted {
- fn count(&self, key: &str, count: u32, sampling: Option<f32>) -> ();
+ ... | 2 | 12 | 12 |
86256283017398fd34ea6e0b679a5de5ad689c63 | Nick Pillitteri | 2015-11-25T05:02:38 | Integration tests that hit a local statsd instance | diff --git a/tests/lib.rs b/tests/lib.rs
new file mode 100644
index 0000000..f77c448
--- /dev/null
+++ b/tests/lib.rs
@@ -0,0 +1,76 @@
+//!
+//!
+//!
+
+extern crate statsd;
+
+use std::net::{UdpSocket};
+
+use statsd::client::{
+ DEFAULT_PORT,
+ UdpMetricSink,
+ StatsdClient,
+ Counted,
+ Timed,
+ Ga... | 1 | 76 | 0 |
1411d56e4cc9ec939f0c7db423e00d1be9a26414 | Nick Pillitteri | 2015-11-25T05:02:19 | Use boxes and/or heap allocation for things the client should own | diff --git a/src/bin.rs b/src/bin.rs
index 795110b..dc42839 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -10,8 +10,8 @@ fn main() {
let metric_host = ("127.0.0.1", DEFAULT_PORT);
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
- let sink = UdpMetricSink::new(&metric_host, &socket);
- let client = S... | 4 | 51 | 45 |
f68a065e27abc550fd00cd067dad6b43d026fd80 | Nick Pillitteri | 2015-11-23T03:34:29 | Changes to demo program to work with latest lib | diff --git a/src/bin.rs b/src/bin.rs
index 5224434..795110b 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -7,10 +7,13 @@ use statsd::client::*;
fn main() {
println!("This is the thing!!");
+
+ let metric_host = ("127.0.0.1", DEFAULT_PORT);
let socket = UdpSocket::bind("0.0.0.0:0").unwrap();
- let clien... | 1 | 5 | 2 |
88e59a46b892a345ff60bd348b6add0714f21432 | Nick Pillitteri | 2015-11-23T03:34:08 | Give up on trying to have constructor that creates a sink | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index c3f9bad..66576fe 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -2,11 +2,20 @@
//!
//!
-use std::net::{ToSocketAddrs, UdpSocket};
-
-use client::net::{MetricSink, UdpMetricSink};
+use client::net::MetricSink;
use client::types::{Co... | 2 | 14 | 32 |
e11f07219a37bdbae967b2e2c22d884ef3970907 | Nick Pillitteri | 2015-11-20T22:04:06 | Introduce MetricSink abstraction and remove unit from timing calls | diff --git a/src/client/metrics.rs b/src/client/metrics.rs
index 80f17a2..c3f9bad 100644
--- a/src/client/metrics.rs
+++ b/src/client/metrics.rs
@@ -2,7 +2,9 @@
//!
//!
-use client::net::ByteSink;
+use std::net::{ToSocketAddrs, UdpSocket};
+
+use client::net::{MetricSink, UdpMetricSink};
use client::types::{Counte... | 4 | 61 | 43 |
1a763f9a6248ee181739c4391e8700272416f035 | Nick Pillitteri | 2015-11-15T21:59:32 | Remove author from cargo config | diff --git a/Cargo.toml b/Cargo.toml
index 4827461..065de55 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,6 @@
[package]
name = "statsd"
version = "0.1.0"
-authors = ["Nick Pillitteri <nick@tshlabs.org>"]
[dependencies]
log = "0.3" | 1 | 0 | 1 |
1f2bd02f48e98cc6a82b427bbdf142124a170bb8 | Nick Pillitteri | 2015-11-15T21:50:32 | More appropriate generic name | diff --git a/src/client.rs b/src/client.rs
index 31c7771..3579550 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -114,7 +114,7 @@ impl<'a, T: ByteSink> StatsdClient<'a, T> {
}
}
- fn send_metric<B: ToMetricString>(&self, metric: B) -> () {
+ fn send_metric<M: ToMetricString>(&self, metric: M) -... | 1 | 1 | 1 |
c39cf2f07bd27786bd5a9c67c4f6b3c1716795ab | Nick Pillitteri | 2015-11-15T21:47:51 | Expose the client module directly | diff --git a/src/bin.rs b/src/bin.rs
index bd9d3b0..5224434 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -2,7 +2,7 @@ extern crate statsd;
use std::net::UdpSocket;
-use statsd::*;
+use statsd::client::*;
fn main() {
diff --git a/src/lib.rs b/src/lib.rs
index 7d82ba9..9674af3 100644
--- a/src/lib.rs
+++ b/src/l... | 2 | 3 | 11 |
db70f2702f975b775c450d409e4ee82bc11afaf4 | Nick Pillitteri | 2015-11-14T23:18:44 | Change test to reflect gauge functionality | diff --git a/src/client.rs b/src/client.rs
index dfe5f77..31c7771 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -205,7 +205,7 @@ mod tests {
}
#[test]
- fn test_gauge_to_metric_string_sampling() {
+ fn test_gauge_to_metric_string() {
let gauge = Gauge{key: "foo.events", value: 2};
... | 1 | 1 | 1 |
b757699aca134d21068696a55acb6498fbf66c1a | Nick Pillitteri | 2015-11-14T23:13:02 | Have metrics know how to convert to a String, not bytes | diff --git a/src/client.rs b/src/client.rs
index d9a1d90..dfe5f77 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -4,8 +4,7 @@
//
//
-use std::ops::Deref;
-use std::io::{Error, Write};
+use std::io::Error;
use std::net::{ToSocketAddrs, UdpSocket};
@@ -33,48 +32,34 @@ struct Gauge<'a> {
}
-trait ToBytes ... | 2 | 79 | 39 |
64d5673491a097ca39b1e41d237e563d217f3a3d | Nick Pillitteri | 2015-11-13T05:52:48 | Add prefix to key for metrics when creating them | diff --git a/src/client.rs b/src/client.rs
index f0344bc..d9a1d90 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -116,8 +116,11 @@ pub struct StatsdClient<'a, T: ByteSink + 'a> {
impl<'a, T: ByteSink> StatsdClient<'a, T> {
pub fn from_host(
- host: &'a str, port: u16,
- prefix: &'a str, sink: &... | 1 | 21 | 5 |
50c42f66a51c745cfaaf23be8009e926ceddf50d | Nick Pillitteri | 2015-11-12T03:53:28 | Start actually writing to UDP socket! | diff --git a/Cargo.toml b/Cargo.toml
index 0f0cc86..4827461 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,11 @@ name = "statsd"
version = "0.1.0"
authors = ["Nick Pillitteri <nick@tshlabs.org>"]
+[dependencies]
+log = "0.3"
+
+[dev-dependencies]
+env_logger = "0.3"
[lib]
name = "statsd"
diff --git a/src/b... | 4 | 84 | 24 |
40580b86663133206d105ebe1bdb273e61ecdf91 | Nick Pillitteri | 2015-11-11T14:06:24 | Make counter/timer/gauge structs private to client | diff --git a/src/bin.rs b/src/bin.rs
index e0eca9b..35dce7a 100644
--- a/src/bin.rs
+++ b/src/bin.rs
@@ -8,11 +8,10 @@ use statsd::*;
fn main() {
println!("This is the thing!!");
- let mut socket = UdpSocket::bind(("localhost", DEFAULT_PORT)).unwrap();
- let client = StatsdClientUdp::from_socket(&mut sock... | 3 | 54 | 29 |
e7d851bc8e888200d6d08ab612d4cb9b5e53bdf7 | Andrew Gallant | 2025-10-17T12:41:27 | lint: fix an unused return value warning | diff --git a/src/unix.rs b/src/unix.rs
index fb3d19f..ba30a30 100644
--- a/src/unix.rs
+++ b/src/unix.rs
@@ -20,7 +20,7 @@ impl Drop for Handle {
if self.is_std {
// unwrap() will not panic. Since we were able to open an
// std stream successfully, then `file` is guaranteed to be Some... | 1 | 1 | 1 |
515331d881205ed5ae962eefdd19ab04641c964c | Soroosh Srd | 2025-02-05T12:04:52 | cfg: remove redundant Redox cfg attributes
Redox has been part of the Unix family since 2019, so we can simplify
the cfg attributes by removing the explicit Redox checks.
Fixes #58 | diff --git a/src/lib.rs b/src/lib.rs
index c52a8fc..1c3ff0b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -75,16 +75,16 @@ use std::fs::File;
use std::io;
use std::path::Path;
-#[cfg(any(target_os = "redox", unix))]
+#[cfg(unix)]
use crate::unix as imp;
-#[cfg(not(any(target_os = "redox", unix, windows)))]
+#[cfg(no... | 1 | 6 | 6 |
6db8cd9dcffee487e2769fef492361859ea2655d | Andrew Gallant | 2023-10-06T01:44:58 | rust: fix for 2021 edition | diff --git a/src/lib.rs b/src/lib.rs
index be2ffff..c52a8fc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,7 +10,7 @@ same file or directory:
# use std::error::Error;
use same_file::is_same_file;
-# fn try_main() -> Result<(), Box<Error>> {
+# fn try_main() -> Result<(), Box<dyn Error>> {
assert!(is_same_file("/b... | 1 | 8 | 8 |
c807412ef1ddda2498e2ea7a98df66308ad34cca | Guillaume Gomez | 2020-05-07T12:06:31 | tests: replace "cfg(test)" with "cfg(doctest)" for readme testing
PR #51 | diff --git a/src/lib.rs b/src/lib.rs
index ed7ccf5..be2ffff 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -68,7 +68,7 @@ See [`examples/is_stderr.rs`] for a runnable example and compare the output of:
#![allow(bare_trait_objects, unknown_lints)]
#![deny(missing_docs)]
-#[cfg(test)]
+#[cfg(doctest)]
doc_comment::doct... | 1 | 1 | 1 |
0185dfdc9425a7b8c7e5e639691d5b83af735e89 | Alex Crichton | 2020-01-11T16:47:02 | api: reexport `Hash` impl for top-level `Handle`
This looks like it may have been intended in #17 but appears to
have been omitted by accident.
PR #49 | diff --git a/src/lib.rs b/src/lib.rs
index 247f812..903a4b6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -105,7 +105,7 @@ mod unknown;
/// implementation details.
///
/// [source]: https://github.com/BurntSushi/same-file/tree/master/src
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Debug, Eq, PartialEq, Hash)]
pub stru... | 2 | 2 | 2 |
dcbd9099b85af4d93691cce7d10ba84a3242eae3 | Andrew Gallant | 2019-07-16T12:08:17 | cleanup: drop rand, fix warnings | diff --git a/Cargo.toml b/Cargo.toml
index ed9289e..e5d5161 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,3 @@ exclude = ["/.travis.yml", "/appveyor.yml"]
[target.'cfg(windows)'.dependencies.winapi-util]
version = "0.1.1"
-
-[dev-dependencies]
-rand = "0.4"
diff --git a/examples/is_same_file.rs b/examples/i... | 3 | 52 | 20 |
b121320aa324632db66749072b375bb554790cdb | Robert Masen | 2019-07-16T11:59:55 | api: add unknown module
This commit adds an "unknown" module as a catch-all for
unsupported platforms (non-Unix, non-Windows). This is
useful for platforms like WASM that don't support these
primitives.
While one defensible approach would be the status quo,
this would require dependents to treat `same-file` (an... | diff --git a/src/lib.rs b/src/lib.rs
index 69831db..13f76eb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -79,11 +79,15 @@ use std::path::Path;
use unix as imp;
#[cfg(windows)]
use win as imp;
+#[cfg(not(any(target_os = "redox", unix, windows)))]
+use unknown as imp;
#[cfg(any(target_os = "redox", unix))]
mod unix... | 2 | 56 | 0 |
bd9fc8c58abbe4f920631b0bf7fbc5c8d7e2d11e | Igor Gnatenko | 2018-10-27T21:29:39 | exclude CI files | diff --git a/Cargo.toml b/Cargo.toml
index 629492f..82e40a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,7 @@ repository = "https://github.com/BurntSushi/same-file"
readme = "README.md"
keywords = ["same", "file", "equal", "inode"]
license = "Unlicense/MIT"
+exclude = ["/.travis.yml", "/appveyor.yml"]
[t... | 1 | 1 | 0 |
c238a23ff69164f8fb8e33d089f9b6946b52d6ae | Andrew Gallant | 2018-08-25T03:04:20 | windows: use winapi-util
This replaces various ffi bindings in the Windows implementation with
nicer wrappers from winapi-util. | diff --git a/Cargo.toml b/Cargo.toml
index cf2f651..f9b3713 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,15 +12,8 @@ readme = "README.md"
keywords = ["same", "file", "equal", "inode"]
license = "Unlicense/MIT"
-[target.'cfg(windows)'.dependencies.winapi]
-version = "0.3"
-features = [
- "std",
- "fileapi",
- ... | 3 | 55 | 97 |
f6dde6e51aa9cb8f2dc2e853b52e4e523a0a6a2c | Andrew Gallant | 2018-08-25T03:15:02 | doc: fix example documentation | diff --git a/examples/is_stderr.rs b/examples/is_stderr.rs
index ec2f987..8ddf849 100644
--- a/examples/is_stderr.rs
+++ b/examples/is_stderr.rs
@@ -13,7 +13,7 @@ fn main() {
}
fn run() -> io::Result<()> {
- // Run with `cargo run is_stderr 2> examples/stderr` to see
+ // Run with `cargo run --example is_stde... | 2 | 3 | 3 |
8393a32036dde5131d3c6d8f45946b907c741871 | Chae Jubb | 2018-01-10T01:02:58 | win: Eq impls should be reflexive
Fixes #36 | diff --git a/src/win.rs b/src/win.rs
index bb9bb7d..30966d5 100644
--- a/src/win.rs
+++ b/src/win.rs
@@ -90,7 +90,11 @@ impl Eq for Handle {}
impl PartialEq for Handle {
fn eq(&self, other: &Handle) -> bool {
- if self.key.is_none() || other.key.is_none() {
+ // Need this branch to satisfy `Eq` si... | 1 | 5 | 1 |
ab8af2afcefc81c2e609f22cc79f479e19574f56 | Igor Gnatenko | 2017-12-31T13:58:26 | bump rand to 0.4 | diff --git a/Cargo.toml b/Cargo.toml
index 19e2d8b..12142bd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,4 +23,4 @@ features = [
]
[dev-dependencies]
-rand = "0.3"
+rand = "0.4" | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.