Skip to content

Commit

Permalink
fix: use accumulated count in buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Aug 30, 2023
1 parent 14ed071 commit 46ccf4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/servers/src/otlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ fn encode_histogram(
let mut sum_lines = LinesWriter::with_lines(data_points_len);
let mut count_lines = LinesWriter::with_lines(data_points_len);

let mut accumulated_count = 0;
for data_point in &hist.data_points {
for (idx, count) in data_point.bucket_counts.iter().enumerate() {
write_tags_and_timestamp(
Expand All @@ -279,8 +280,9 @@ fn encode_histogram(
.context(error::OtlpMetricsWriteSnafu)?;
}

accumulated_count += count;
bucket_lines
.write_u64(GREPTIME_VALUE, *count)
.write_u64(GREPTIME_VALUE, accumulated_count)
.context(error::OtlpMetricsWriteSnafu)?;

bucket_lines.commit();
Expand Down

0 comments on commit 46ccf4d

Please sign in to comment.