mirror of https://github.com/fralalonde/dipstick
Clippy + Format
This commit is contained in:
parent
46241ad439
commit
a5939a794e
|
@ -1,10 +1,10 @@
|
|||
//! An app demonstrating the basics of the metrics front-end.
|
||||
//! Defines metrics of each kind and use them to print values to the console in multiple ways.
|
||||
|
||||
use dipstick::{time, Input, InputScope, Prefixed, Stream};
|
||||
use std::io;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use dipstick::{Stream, Input, InputScope, Prefixed, time};
|
||||
|
||||
fn main() {
|
||||
// for this demo, print metric values to the console
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//! A sample application asynchronously printing metrics to stdout.
|
||||
|
||||
use dipstick::{stats_all, AtomicBucket, Input, InputScope, Stream};
|
||||
use std::env::args;
|
||||
use std::str::FromStr;
|
||||
use std::thread;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use dipstick::{AtomicBucket, stats_all, InputScope, Stream, Input};
|
||||
|
||||
fn main() {
|
||||
let bucket = AtomicBucket::new();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//! A sample application asynchronously printing metrics to stdout.
|
||||
|
||||
use dipstick::{AtomicBucket, Input, InputScope, Proxy, Stream};
|
||||
use std::env::args;
|
||||
use std::str::FromStr;
|
||||
use std::thread;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use dipstick::{Proxy, AtomicBucket, InputScope, Stream, Input};
|
||||
|
||||
fn main() {
|
||||
let event = Proxy::default().marker("a");
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//! A sample application asynchronously printing metrics to stdout.
|
||||
|
||||
use dipstick::{AtomicBucket, Input, InputQueueScope, InputScope, Stream};
|
||||
use std::env::args;
|
||||
use std::str::FromStr;
|
||||
use std::thread;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use dipstick::{AtomicBucket, InputQueueScope, InputScope, Stream, Input};
|
||||
|
||||
fn main() {
|
||||
let bucket = AtomicBucket::new();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Use the metrics backend directly to log a metric value.
|
||||
//! Applications should use the metrics()-provided instruments instead.
|
||||
|
||||
use dipstick::{Input, InputScope, Labels, labels};
|
||||
use dipstick::{labels, Input, InputScope, Labels};
|
||||
|
||||
fn main() {
|
||||
raw_write()
|
||||
|
|
|
@ -10,12 +10,12 @@ use crate::{Flush, MetricValue, Void};
|
|||
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::BTreeMap;
|
||||
use std::{fmt, io};
|
||||
use std::isize;
|
||||
use std::mem;
|
||||
use std::sync::atomic::AtomicIsize;
|
||||
use std::sync::atomic::Ordering::*;
|
||||
use std::sync::Arc;
|
||||
use std::{fmt, io};
|
||||
|
||||
#[cfg(not(feature = "parking_lot"))]
|
||||
use std::sync::RwLock;
|
||||
|
|
|
@ -79,8 +79,8 @@ pub use crate::input::{
|
|||
};
|
||||
pub use crate::label::{AppLabel, Labels, ThreadLabel};
|
||||
pub use crate::name::{MetricName, NameParts};
|
||||
pub use crate::scheduler::{Cancel, CancelGuard, CancelHandle, ScheduleFlush};
|
||||
pub use crate::output::void::Void;
|
||||
pub use crate::scheduler::{Cancel, CancelGuard, CancelHandle, ScheduleFlush};
|
||||
|
||||
#[cfg(test)]
|
||||
pub use crate::clock::{mock_clock_advance, mock_clock_reset};
|
||||
|
|
|
@ -5,8 +5,8 @@ use crate::input::{Input, InputDyn, InputKind, InputMetric, InputScope};
|
|||
use crate::name::MetricName;
|
||||
use crate::Flush;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::io;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Opens multiple scopes at a time from just as many outputs.
|
||||
#[derive(Clone, Default)]
|
||||
|
|
|
@ -3,9 +3,9 @@ use crate::input::InputKind;
|
|||
use crate::name::MetricName;
|
||||
use crate::MetricValue;
|
||||
|
||||
use std::io::{Write};
|
||||
use std::sync::Arc;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Print commands are steps in the execution of output templates.
|
||||
pub enum LineOp {
|
||||
|
@ -49,12 +49,7 @@ impl LineTemplate {
|
|||
}
|
||||
|
||||
/// Template execution applies commands in turn, writing to the output.
|
||||
pub fn print<L>(
|
||||
&self,
|
||||
output: &mut dyn Write,
|
||||
value: MetricValue,
|
||||
lookup: L,
|
||||
) -> io::Result<()>
|
||||
pub fn print<L>(&self, output: &mut dyn Write, value: MetricValue, lookup: L) -> io::Result<()>
|
||||
where
|
||||
L: Fn(&str) -> Option<Arc<String>>,
|
||||
{
|
||||
|
|
|
@ -157,7 +157,7 @@ impl GraphiteScope {
|
|||
Err(e) => {
|
||||
metrics::GRAPHITE_SEND_ERR.mark();
|
||||
debug!("Failed to send buffer to graphite: {}", e);
|
||||
Err(e.into())
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ use std::sync::RwLock;
|
|||
#[cfg(feature = "parking_lot")]
|
||||
use parking_lot::RwLock;
|
||||
|
||||
use std::io::Write;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
|
||||
/// Buffered metrics log output.
|
||||
#[derive(Clone)]
|
||||
|
|
|
@ -5,8 +5,8 @@ use crate::{Flush, MetricValue};
|
|||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::io;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
/// A BTreeMap wrapper to receive metrics or stats values.
|
||||
/// Every received value for a metric replaces the previous one (if any).
|
||||
|
|
|
@ -5,10 +5,10 @@ use crate::attributes::{
|
|||
};
|
||||
use crate::input::InputKind;
|
||||
use crate::input::{Input, InputMetric, InputScope};
|
||||
use crate::metrics;
|
||||
use crate::name::MetricName;
|
||||
use crate::pcg32;
|
||||
use crate::{CachedInput, QueuedInput};
|
||||
use crate::{metrics};
|
||||
use crate::{Flush, MetricValue};
|
||||
|
||||
use std::net::ToSocketAddrs;
|
||||
|
@ -187,7 +187,7 @@ impl StatsdScope {
|
|||
}
|
||||
Err(e) => {
|
||||
metrics::STATSD_SEND_ERR.mark();
|
||||
return Err(e.into());
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
buffer.clear();
|
||||
|
|
|
@ -83,10 +83,7 @@ impl Stream<File> {
|
|||
///
|
||||
/// Creates a new file to dump data into. If `clobber` is set to true, it allows overwriting
|
||||
/// existing file, if false, the attempt will result in an error.
|
||||
pub fn write_to_new_file<P: AsRef<Path>>(
|
||||
file: P,
|
||||
clobber: bool,
|
||||
) -> io::Result<Stream<File>> {
|
||||
pub fn write_to_new_file<P: AsRef<Path>>(file: P, clobber: bool) -> io::Result<Stream<File>> {
|
||||
let file = OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
|
|
|
@ -3,8 +3,8 @@ use crate::Flush;
|
|||
|
||||
use crate::attributes::MetricId;
|
||||
use crate::{Input, InputDyn, InputKind, InputMetric, InputScope};
|
||||
use std::sync::Arc;
|
||||
use std::io;
|
||||
use std::sync::Arc;
|
||||
|
||||
lazy_static! {
|
||||
/// The reference instance identifying an uninitialized metric config.
|
||||
|
|
|
@ -7,8 +7,8 @@ use crate::output::void::VOID_INPUT;
|
|||
use crate::Flush;
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::{fmt, io};
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::{fmt, io};
|
||||
|
||||
#[cfg(not(feature = "parking_lot"))]
|
||||
use std::sync::RwLock;
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::{Flush, MetricValue};
|
|||
#[cfg(not(feature = "crossbeam-channel"))]
|
||||
use std::sync::mpsc;
|
||||
use std::sync::Arc;
|
||||
use std::{thread, io};
|
||||
use std::{io, thread};
|
||||
|
||||
#[cfg(feature = "crossbeam-channel")]
|
||||
use crossbeam_channel as crossbeam;
|
||||
|
|
Loading…
Reference in New Issue