Skip to content

Commit

Permalink
Switch internal telemetry to Sum from Set (#403)
Browse files Browse the repository at this point in the history
This commit changes our internal telemetry to be aggregated as a
Sum instead of a Set by default. This brings the cheap telemetry
in-line with the report_full_telemetry aggregation. Additionally,
the value is no longer reset to zero after reads.

Resolves #402

Signed-off-by: Brian L. Troutwine <blt@postmates.com>
  • Loading branch information
blt authored Jan 25, 2018
1 parent d8df212 commit c6abe6b
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 75 deletions.
14 changes: 9 additions & 5 deletions src/metric/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl Telemetry {
/// # Examples
///
/// ```
/// use cernan::metric::{Telemetry,AggregationMethod};
/// use cernan::metric::{AggregationMethod, Telemetry};
///
/// let m = Telemetry::new().name("foo").value(1.1).harden().unwrap();
///
Expand Down Expand Up @@ -622,7 +622,7 @@ impl Telemetry {
/// # Examples
///
/// ```
/// use cernan::metric::{Telemetry,TagMap};
/// use cernan::metric::{TagMap, Telemetry};
///
/// let mut m = Telemetry::new().name("foo").value(1.1).harden().unwrap();
///
Expand Down Expand Up @@ -656,7 +656,7 @@ impl Telemetry {
/// # Examples
///
/// ```
/// use cernan::metric::{Telemetry,TagMap};
/// use cernan::metric::{TagMap, Telemetry};
///
/// let mut m = Telemetry::new().name("foo").value(1.1).harden().unwrap();
///
Expand Down Expand Up @@ -901,8 +901,12 @@ impl Telemetry {
/// ```
/// use cernan::metric::Telemetry;
///
/// let m = Telemetry::new().name("foo").value(1.1).harden().unwrap().
/// timestamp(10101);
/// let m = Telemetry::new()
/// .name("foo")
/// .value(1.1)
/// .harden()
/// .unwrap()
/// .timestamp(10101);
///
/// assert_eq!(10101, m.timestamp);
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/sink/kinesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn connect(
) -> Box<KinesisClient<DefaultCredentialsProvider, hyper::client::Client>> {
let tls = default_tls_client().unwrap();
let provider = DefaultCredentialsProvider::new().unwrap();
return Box::new(KinesisClient::new(tls, provider, region));
Box::new(KinesisClient::new(tls, provider, region))
}

/// Kinesis sink internal state.
Expand Down
4 changes: 3 additions & 1 deletion src/sink/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ impl Sink<NativeConfig> for Native {
metric::AggregationMethod::Histogram => AggregationMethod::BIN,
metric::AggregationMethod::Sum => AggregationMethod::SUM,
metric::AggregationMethod::Set => AggregationMethod::SET,
metric::AggregationMethod::Summarize => AggregationMethod::SUMMARIZE,
metric::AggregationMethod::Summarize => {
AggregationMethod::SUMMARIZE
}
};
let persist = m.persist;
telem.set_persisted(persist);
Expand Down
Loading

0 comments on commit c6abe6b

Please sign in to comment.