-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce number of buckets for auto-generated metrics (#780)
For the auto-generated histogram metrics, we use a large number of buckets. The largest bucket captures values up to 50 quintillion. However, having a large number of buckets results in a significant size for exported metrics, even if they carry 0 data (as most buckets will have 0 values). This leads to: (1) higher costs for the user (e.g., Google Cloud monitoring charges you based on the volume of metrics exported), and (2) increased system load due to handling large metrics data. This PR reduces the number of buckets to capture values up to 5 billion (5e9), which seems reasonable in practice. E.g., auto-generated metrics using these buckets: 1) http_request_latency_micros - even if this is 10 minutes, the value is still 6e7 2) http_request_bytes_received - http request size of more than 5 GB seem rare 3) http_request_bytes_returned - http response size of more than 5 GB seem rare 4) serviceweaver_method_latency_micros - component method execution of more than 1.3 hours seem rare 5) serviceweaver_method_bytes_request - request size of more than 5 GB seem rare 6) serviceweaver_method_bytes_reply - response size of more than 5 GB seem rare
- Loading branch information
Showing
7 changed files
with
92 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package metrics | ||
|
||
// Names of automatically populated metrics. | ||
const ( | ||
MethodCountsName = "serviceweaver_method_count" | ||
MethodErrorsName = "serviceweaver_method_error_count" | ||
MethodLatenciesName = "serviceweaver_method_latency_micros" | ||
MethodBytesRequestName = "serviceweaver_method_bytes_request" | ||
MethodBytesReplyName = "serviceweaver_method_bytes_reply" | ||
) | ||
|
||
// GeneratedBuckets provides rounded bucket boundaries for histograms | ||
// that will only store non-negative values. | ||
// | ||
// Note that these buckets are intended to be used only by the metrics generated | ||
// by the weaver runtime. | ||
var GeneratedBuckets = []float64{ | ||
// Adjacent buckets differ from each other by 2x or 2.5x. | ||
1, 2, 5, | ||
10, 20, 50, | ||
100, 200, 500, | ||
1000, 2000, 5000, | ||
10000, 20000, 50000, | ||
100000, 200000, 500000, | ||
1000000, 2000000, 5000000, | ||
10000000, 20000000, 50000000, | ||
100000000, 200000000, 500000000, | ||
1000000000, 2000000000, 5000000000, // i.e., 5e9 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters