Skip to content

Commit

Permalink
[Exporter.Geneva][Patch for 1.3.0] Fix overflow bucket serialization …
Browse files Browse the repository at this point in the history
…for GenevaExporter (#807)

* Fix overflow bucket serialization for GenevaExporter
  • Loading branch information
utpilla authored Dec 7, 2022
1 parent 19f44ad commit c9c747a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

## 1.3.1

Released 2022-Dec-07

* Fix the overflow bucket value serialization for Histogram.
([#807](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/807))

## 1.3.0

Released 2022-Jul-28
Expand Down
3 changes: 2 additions & 1 deletion src/OpenTelemetry.Exporter.Geneva/GenevaMetricExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ internal unsafe ushort SerializeHistogramMetric(
if (bucket.ExplicitBound != double.PositiveInfinity)
{
MetricSerializer.SerializeUInt64(this.bufferForHistogramMetrics, ref bufferIndex, Convert.ToUInt64(bucket.ExplicitBound));
lastExplicitBound = bucket.ExplicitBound;
}
else
{
Expand All @@ -404,6 +403,8 @@ internal unsafe ushort SerializeHistogramMetric(
MetricSerializer.SerializeUInt32(this.bufferForHistogramMetrics, ref bufferIndex, Convert.ToUInt32(bucket.BucketCount));
bucketCount++;
}

lastExplicitBound = bucket.ExplicitBound;
}

// Write the number of items in distribution emitted and reset back to end.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ private void CheckSerializationForSingleMetricPoint(Metric metric, GenevaMetricE
if (bucket.ExplicitBound != double.PositiveInfinity)
{
Assert.Equal(bucket.ExplicitBound, valueCountPairs.Columns[listIterator].Value);
lastExplicitBound = bucket.ExplicitBound;
}
else
{
Expand All @@ -683,6 +682,8 @@ private void CheckSerializationForSingleMetricPoint(Metric metric, GenevaMetricE
listIterator++;
bucketsWithPositiveCount++;
}

lastExplicitBound = bucket.ExplicitBound;
}

Assert.Equal(bucketsWithPositiveCount, valueCountPairs.DistributionSize);
Expand Down

0 comments on commit c9c747a

Please sign in to comment.