-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
x-pack/metricbeat/module/gcp: Override GCP API endpoint in metric client #40918
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,13 @@ | |
credentials_file_path: "your JSON credentials file path" | ||
dataset_id: "dataset id" | ||
table_pattern: "table pattern" | ||
|
||
- module: gcp | ||
metricsets: | ||
- compute | ||
region: "us-" | ||
project_id: "your project id" | ||
credentials_file_path: "your JSON credentials file path" | ||
endpoint: http://your-endpoint | ||
exclude_labels: false | ||
period: 1m | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The yaml block is not properly formatted and it might be redundant to add it again just to showcase the |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -107,12 +107,12 @@ type config struct { | |||||||||||||||||||||||||||
ExcludeLabels bool `config:"exclude_labels"` | ||||||||||||||||||||||||||||
CredentialsFilePath string `config:"credentials_file_path"` | ||||||||||||||||||||||||||||
CredentialsJSON string `config:"credentials_json"` | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
opt []option.ClientOption | ||||||||||||||||||||||||||||
period *durationpb.Duration | ||||||||||||||||||||||||||||
organizationID string | ||||||||||||||||||||||||||||
organizationName string | ||||||||||||||||||||||||||||
projectName string | ||||||||||||||||||||||||||||
Endpoint string `config:"endpoint"` | ||||||||||||||||||||||||||||
opt []option.ClientOption | ||||||||||||||||||||||||||||
period *durationpb.Duration | ||||||||||||||||||||||||||||
organizationID string | ||||||||||||||||||||||||||||
organizationName string | ||||||||||||||||||||||||||||
projectName string | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's keep a new line between these exported and unexported struct fields like it was before.
Suggested change
|
||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
// New creates a new instance of the MetricSet. New is responsible for unpacking | ||||||||||||||||||||||||||||
|
@@ -143,6 +143,10 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { | |||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||
return m, fmt.Errorf("no credentials_file_path or credentials_json specified") | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
if m.config.Endpoint != "" { | ||||||||||||||||||||||||||||
m.Logger().Warnf("You are using a custom endpoint '%s' for the GCP API calls.", m.config.Endpoint) | ||||||||||||||||||||||||||||
m.config.opt = append(m.config.opt, option.WithEndpoint(m.config.Endpoint)) | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
Comment on lines
+148
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a new line to improve readability.
Suggested change
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
m.config.period = &durationpb.Duration{ | ||||||||||||||||||||||||||||
Seconds: int64(m.Module().Config().Period.Seconds()), | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.