Skip to content

Commit 0549c44

Browse files
committed
fix broken gauge merge behavior
1 parent efd8a8d commit 0549c44

File tree

6 files changed

+400
-31
lines changed

6 files changed

+400
-31
lines changed

lib/saluki-components/src/transforms/aggregate/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,6 @@ impl AggregationState {
533533
// This means we'll always remove all-closed/empty non-counter metrics, and we _may_ remove all-closed/empty
534534
// counters.
535535
if let Some(closed_bucket_values) = am.values.split_at_timestamp(split_timestamp) {
536-
trace!(
537-
metric_name = &**context.name(),
538-
metric_tags = %context.tags(),
539-
points = %closed_bucket_values,
540-
"Flushing closed buckets."
541-
);
542-
543536
// We got some closed bucket values, so flush those out.
544537
transform_and_push_metric(
545538
context.clone(),

lib/saluki-event/src/metric/value/histogram.rs

+36
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,15 @@ impl From<f64> for HistogramPoints {
225225
}
226226
}
227227

228+
impl From<(u64, f64)> for HistogramPoints {
229+
fn from((ts, value): (u64, f64)) -> Self {
230+
let mut histogram = Histogram::default();
231+
histogram.insert(value, SampleRate::unsampled());
232+
233+
Self(TimestampedValue::from((ts, histogram)).into())
234+
}
235+
}
236+
228237
impl<const N: usize> From<[f64; N]> for HistogramPoints {
229238
fn from(values: [f64; N]) -> Self {
230239
let mut histogram = Histogram::default();
@@ -236,6 +245,33 @@ impl<const N: usize> From<[f64; N]> for HistogramPoints {
236245
}
237246
}
238247

248+
impl<const N: usize> From<(u64, [f64; N])> for HistogramPoints {
249+
fn from((ts, values): (u64, [f64; N])) -> Self {
250+
let mut histogram = Histogram::default();
251+
for value in values {
252+
histogram.insert(value, SampleRate::unsampled());
253+
}
254+
255+
Self(TimestampedValue::from((ts, histogram)).into())
256+
}
257+
}
258+
259+
impl<const N: usize> From<[(u64, f64); N]> for HistogramPoints {
260+
fn from(values: [(u64, f64); N]) -> Self {
261+
Self(
262+
values
263+
.into_iter()
264+
.map(|(ts, value)| {
265+
let mut histogram = Histogram::default();
266+
histogram.insert(value, SampleRate::unsampled());
267+
268+
(ts, histogram)
269+
})
270+
.into(),
271+
)
272+
}
273+
}
274+
239275
impl<'a> From<&'a [f64]> for HistogramPoints {
240276
fn from(values: &'a [f64]) -> Self {
241277
let mut histogram = Histogram::default();

0 commit comments

Comments
 (0)