Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zero bucket boundary to default explicit bucket histogram #4819

Merged
merged 1 commit into from Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -21,7 +21,7 @@ private ExplicitBucketHistogramUtils() {}
public static final List<Double> DEFAULT_HISTOGRAM_BUCKET_BOUNDARIES =
Collections.unmodifiableList(
Arrays.asList(
5d, 10d, 25d, 50d, 75d, 100d, 250d, 500d, 750d, 1_000d, 2_500d, 5_000d, 7_500d,
0d, 5d, 10d, 25d, 50d, 75d, 100d, 250d, 500d, 750d, 1_000d, 2_500d, 5_000d, 7_500d,
10_000d));

/** Converts bucket boundary "convenient" configuration into the "more efficient" array. */
Expand Down
Expand Up @@ -112,10 +112,10 @@ void collectMetrics_WithEmptyAttributes() {
.hasCount(2)
.hasSum(24)
.hasBucketBoundaries(
5, 10, 25, 50, 75, 100, 250, 500, 750, 1_000, 2_500,
5_000, 7_500, 10_000)
0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1_000,
2_500, 5_000, 7_500, 10_000)
.hasBucketCounts(
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))));
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))));
}

@Test
Expand Down Expand Up @@ -150,7 +150,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(3)
.hasSum(566.3d)
.hasBucketCounts(
0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0)
0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry("K", "V")),
point ->
point
Expand All @@ -159,7 +159,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(2)
.hasSum(22.2d)
.hasBucketCounts(
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(Attributes.empty()))));

// Histograms are cumulative by default.
Expand All @@ -183,7 +183,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(4)
.hasSum(788.3)
.hasBucketCounts(
0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0)
0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry("K", "V")),
point ->
point
Expand All @@ -192,7 +192,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(3)
.hasSum(39.2)
.hasBucketCounts(
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(Attributes.empty()))));
} finally {
bound.unbind();
Expand Down Expand Up @@ -387,7 +387,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(4_000)
.hasSum(40_000)
.hasBucketCounts(
0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[0], values[0])),
point ->
point
Expand All @@ -396,7 +396,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(4_000)
.hasSum(40_000)
.hasBucketCounts(
0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[1], values[1])),
point ->
point
Expand All @@ -405,7 +405,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(4_000)
.hasSum(40_000)
.hasBucketCounts(
0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[2], values[2])),
point ->
point
Expand All @@ -414,7 +414,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(4_000)
.hasSum(40_000)
.hasBucketCounts(
0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 2000, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[3], values[3])))));
}

Expand Down
Expand Up @@ -112,10 +112,10 @@ void collectMetrics_WithEmptyAttributes() {
.hasCount(2)
.hasSum(24)
.hasBucketBoundaries(
5, 10, 25, 50, 75, 100, 250, 500, 750, 1_000, 2_500,
5_000, 7_500, 10_000)
0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1_000,
2_500, 5_000, 7_500, 10_000)
.hasBucketCounts(
0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))));
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))));
}

@Test
Expand Down Expand Up @@ -150,7 +150,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(3)
.hasSum(445)
.hasBucketCounts(
1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)
0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry("K", "V")),
point ->
point
Expand All @@ -159,7 +159,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(2)
.hasSum(23)
.hasBucketCounts(
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(Attributes.empty()))));

// Histograms are cumulative by default.
Expand All @@ -183,7 +183,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(4)
.hasSum(667)
.hasBucketCounts(
1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0)
0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry("K", "V")),
point ->
point
Expand All @@ -192,7 +192,7 @@ void collectMetrics_WithMultipleCollects() {
.hasCount(3)
.hasSum(40)
.hasBucketCounts(
0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(Attributes.empty()))));
} finally {
bound.unbind();
Expand Down Expand Up @@ -388,7 +388,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(2_000)
.hasSum(20_000)
.hasBucketCounts(
0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[0], values[0])),
point ->
point
Expand All @@ -397,7 +397,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(2_000)
.hasSum(20_000)
.hasBucketCounts(
0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[1], values[1])),
point ->
point
Expand All @@ -406,7 +406,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(2_000)
.hasSum(20_000)
.hasBucketCounts(
0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[2], values[2])),
point ->
point
Expand All @@ -415,7 +415,7 @@ void stressTest_WithDifferentLabelSet() {
.hasCount(2_000)
.hasSum(20_000)
.hasBucketCounts(
0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
0, 0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
.hasAttributes(attributeEntry(keys[3], values[3])))));
}

Expand Down
Expand Up @@ -131,7 +131,7 @@ void collectAllSyncInstruments() {
.hasCount(1)
.hasSum(10.1)
.hasBucketCounts(
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))),
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))),
metric ->
assertThat(metric)
.hasName("testDoubleCounter")
Expand Down Expand Up @@ -160,7 +160,7 @@ void collectAllSyncInstruments() {
.hasCount(1)
.hasSum(10)
.hasBucketCounts(
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))),
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))),
metric ->
assertThat(metric)
.hasName("testLongUpDownCounter")
Expand Down