Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ public void writeTo(Serializer output) throws IOException {
if (hasMax) {
output.serializeDoubleOptional(HistogramDataPoint.MAX, max);
}
output.serializeRepeatedFixed64(
HistogramDataPoint.BUCKET_COUNTS, PrimitiveLongList.toArray(bucketCounts));
// The HistogramDataPoint proto docs require both explicit_bounds and bucket_counts or neither.
if (!explicitBounds.isEmpty()) {
output.serializeRepeatedFixed64(
HistogramDataPoint.BUCKET_COUNTS, PrimitiveLongList.toArray(bucketCounts));
}
output.serializeRepeatedDouble(HistogramDataPoint.EXPLICIT_BOUNDS, explicitBounds);
output.serializeRepeatedMessage(HistogramDataPoint.EXEMPLARS, exemplars);
output.serializeRepeatedMessage(HistogramDataPoint.ATTRIBUTES, attributes);
Expand Down Expand Up @@ -143,7 +146,9 @@ private static int calculateSize(
if (hasMax) {
size += MarshalerUtil.sizeDoubleOptional(HistogramDataPoint.MAX, max);
}
size += MarshalerUtil.sizeRepeatedFixed64(HistogramDataPoint.BUCKET_COUNTS, bucketCounts);
if (!explicitBounds.isEmpty()) {
size += MarshalerUtil.sizeRepeatedFixed64(HistogramDataPoint.BUCKET_COUNTS, bucketCounts);
}
size += MarshalerUtil.sizeRepeatedDouble(HistogramDataPoint.EXPLICIT_BOUNDS, explicitBounds);
size += MarshalerUtil.sizeRepeatedMessage(HistogramDataPoint.EXEMPLARS, exemplars);
size += MarshalerUtil.sizeRepeatedMessage(HistogramDataPoint.ATTRIBUTES, attributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public void writeTo(Serializer output, HistogramPointData point, MarshalerContex
if (point.hasMax()) {
output.serializeDoubleOptional(HistogramDataPoint.MAX, point.getMax());
}
output.serializeRepeatedFixed64(HistogramDataPoint.BUCKET_COUNTS, point.getCounts());
if (!point.getBoundaries().isEmpty()) {
output.serializeRepeatedFixed64(HistogramDataPoint.BUCKET_COUNTS, point.getCounts());
}
output.serializeRepeatedDouble(HistogramDataPoint.EXPLICIT_BOUNDS, point.getBoundaries());
output.serializeRepeatedMessageWithContext(
HistogramDataPoint.EXEMPLARS,
Expand Down Expand Up @@ -64,7 +66,10 @@ public int getBinarySerializedSize(HistogramPointData point, MarshalerContext co
if (point.hasMax()) {
size += MarshalerUtil.sizeDoubleOptional(HistogramDataPoint.MAX, point.getMax());
}
size += MarshalerUtil.sizeRepeatedFixed64(HistogramDataPoint.BUCKET_COUNTS, point.getCounts());
if (!point.getBoundaries().isEmpty()) {
size +=
MarshalerUtil.sizeRepeatedFixed64(HistogramDataPoint.BUCKET_COUNTS, point.getCounts());
}
size +=
MarshalerUtil.sizeRepeatedDouble(HistogramDataPoint.EXPLICIT_BOUNDS, point.getBoundaries());
size +=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ void histogramDataPoints(MarshalerSource marshalerSource) {
.setSum(15.3)
.setMin(3.3)
.setMax(12.0)
.addBucketCounts(7)
.addExemplars(
Exemplar.newBuilder()
.setTimeUnixNano(2)
Expand Down Expand Up @@ -996,7 +995,6 @@ void toProtoMetric_histogram(MarshalerSource marshalerSource) {
.setSum(4.0)
.setMin(1.0)
.setMax(3.0)
.addBucketCounts(33)
.build())
.build())
.build());
Expand Down
Loading