Skip to content

Commit

Permalink
feat(googlecloudmonitoring): set minimum collection interval as 60s (#…
Browse files Browse the repository at this point in the history
…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.-->
  • Loading branch information
chenlujjj authored Jan 16, 2025
1 parent 814307e commit d6c4bc6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .chloggen/feat_googlecloudmonitoring-interval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: googlecloudmonitoringreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: set the minimum collection interval as 60s

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [36898]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
2 changes: 1 addition & 1 deletion receiver/googlecloudmonitoringreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ receivers:
- metric_name: "connectors.googleapis.com/flex/instance/cpu/usage_time"
```
- `collection_interval` (Optional): The interval at which metrics are collected. Default is 300s.
- `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.
- `initial_delay` (default = `1s`): defines how long this receiver waits before starting.
- `timeout`: (default = `1m`) The timeout of running commands against the GCP Monitoring REST API.
- `project_id` (Required): The GCP project ID.
Expand Down
5 changes: 3 additions & 2 deletions receiver/googlecloudmonitoringreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

const (
defaultCollectionInterval = 300 * time.Second // Default value for collection interval
minCollectionInterval = 60 * time.Second // Minimum value for collection interval
defaultFetchDelay = 60 * time.Second // Default value for fetch delay
)

Expand All @@ -28,8 +29,8 @@ type MetricConfig struct {
}

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

if len(config.MetricsList) == 0 {
Expand Down

0 comments on commit d6c4bc6

Please sign in to comment.