-
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
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
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.
Approving for the data plane side as we are only owning the yml files.
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
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 comment
The 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.
Endpoint string `config:"endpoint"` | |
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 |
CHANGELOG.next.asciidoc
Outdated
@@ -59,6 +59,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff] | |||
- Mark system process metricsets as running if metrics are partially available {pull}40565[40565] | |||
- Added back `elasticsearch.node.stats.jvm.mem.pools.*` to the `node_stats` metricset {pull}40571[40571] | |||
- Add GCP organization and project details to ECS cloud fields. {pull}40461[40461] | |||
- Add `endpoint` field to the GCP configuration in order to append it to the metric client. {issue}40848[40848] {pull}40918[40918] |
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.
- Add `endpoint` field to the GCP configuration in order to append it to the metric client. {issue}40848[40848] {pull}40918[40918] | |
- Add support for specifying a custom endpoint for GCP service clients. {issue}40848[40848] {pull}40918[40918] |
- 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 comment
The 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 endpoint
config param. I would probably add endpoint
to an existing config in that file.
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)) | ||
} |
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.
Add a new line to improve readability.
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)) | |
} | |
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)) | |
} |
… endpoint in metric client (#40938) * x-pack/metricbeat/module/gcp: Override GCP API endpoint in metric client (#40918) * override endpoint to etric client * config and changelog * doc * resolved comments * lint fix (cherry picked from commit 7720c90) * Update CHANGELOG.next.asciidoc --------- Co-authored-by: Linu-Elias <[email protected]>
Proposed commit message
The GCP metric client does not currently allow overriding with a custom endpoint, which is necessary for testing against a mock GCP API endpoint.
Resolved this issue by implementing a check to determine if an endpoint is specified in the GCP configuration, and subsequently overriding the
ClientOption
with that endpoint.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs