Skip to content

Commit d6c4bc6

Browse files
authored
feat(googlecloudmonitoring): set minimum collection interval as 60s (#37261)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes part of #36898 <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
1 parent 814307e commit d6c4bc6

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: googlecloudmonitoringreceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: set the minimum collection interval as 60s
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [36898]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

receiver/googlecloudmonitoringreceiver/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ receivers:
3333
- metric_name: "connectors.googleapis.com/flex/instance/cpu/usage_time"
3434
```
3535
36-
- `collection_interval` (Optional): The interval at which metrics are collected. Default is 300s.
36+
- `collection_interval` (Optional): The interval at which metrics are collected. Default is 300s, minimum is 60s. Be careful of the [costs](https://cloud.google.com/stackdriver/pricing#monitoring-costs) and [quotas](https://cloud.google.com/monitoring/quotas#api_quotas) when setting a low interval.
3737
- `initial_delay` (default = `1s`): defines how long this receiver waits before starting.
3838
- `timeout`: (default = `1m`) The timeout of running commands against the GCP Monitoring REST API.
3939
- `project_id` (Required): The GCP project ID.

receiver/googlecloudmonitoringreceiver/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
const (
1515
defaultCollectionInterval = 300 * time.Second // Default value for collection interval
16+
minCollectionInterval = 60 * time.Second // Minimum value for collection interval
1617
defaultFetchDelay = 60 * time.Second // Default value for fetch delay
1718
)
1819

@@ -28,8 +29,8 @@ type MetricConfig struct {
2829
}
2930

3031
func (config *Config) Validate() error {
31-
if config.CollectionInterval < defaultCollectionInterval {
32-
return fmt.Errorf("\"collection_interval\" must be not lower than the collection interval: %v, current value is %v", defaultCollectionInterval, config.CollectionInterval)
32+
if config.CollectionInterval < minCollectionInterval {
33+
return fmt.Errorf("\"collection_interval\" must be not lower than the collection interval: %v, current value is %v", minCollectionInterval, config.CollectionInterval)
3334
}
3435

3536
if len(config.MetricsList) == 0 {

0 commit comments

Comments
 (0)