Skip to content
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

[Metricbeat] gcp: log metrics without descriptors #26982

Merged

Conversation

endorama
Copy link
Member

@endorama endorama commented Jul 20, 2021

What does this PR do?

Add an error log statement reporting metrics for which GCP Monitoring APIs report no metric descriptors.

Why is it important?

Before metric collection, the gcp module request metric descriptors for all metrics specified in the fields file.
Is possible that the GCP Monitoring API return an empty metric descriptor set, upon request. The most probable reason is due to the metric being not found.

The current behaviour for these occurrences is to ignore the metric and proceed. This silently discard a requested metric without any visible output to the developer/operator, and I consider it a bad developer experience.

I don't consider this behaviour a fatal error, but surely worthy to be reported as error in the logs.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Scenario: silent wrong code implementation

	As a gcp module metricbeat developer
	When I'm adding a new metricset in the gcp module
	Given I added new metrics
	Then I want to be alerted if they are not being collected

Scenario: silent missing collection for metric

	As a metricbeat operator
	Given I'm using the metrics metricset
	Given I configured custom metrics to be collected
	Then I want to be alerted if they are not being collected

Screenshots

Logs

@endorama endorama added enhancement Team:Integrations Label for the Integrations team backport-v7.15.0 Automated backport with mergify labels Jul 20, 2021
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 20, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 20, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-07-28T10:16:44.708+0000

  • Duration: 73 min 42 sec

  • Commit: 67bbc70

Test stats 🧪

Test Results
Failed 0
Passed 2605
Skipped 231
Total 2836

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 2605
Skipped 231
Total 2836

Metrics listed in the light-weight modules are checked with GCP
Stackdriver APIs to gather further information about them.

In case the metric is not valid, the request to the API returns an empty
response and the metric in question is excluded from collection.
There is no error returned from APIs.

In such a case a log line at error level is produced, notifying the user
of the wrong behaviour.
@endorama endorama force-pushed the gcp-refactor-metric-without-descriptors branch from b895204 to 67bbc70 Compare July 28, 2021 10:16
@endorama endorama requested a review from kaiyan-sheng July 28, 2021 10:17
@endorama endorama marked this pull request as ready for review July 28, 2021 10:17
@endorama endorama self-assigned this Jul 28, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

Copy link
Contributor

@kaiyan-sheng kaiyan-sheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@endorama endorama merged commit 452f0fa into elastic:master Aug 4, 2021
@endorama endorama deleted the gcp-refactor-metric-without-descriptors branch August 4, 2021 07:51
mergify bot pushed a commit that referenced this pull request Aug 4, 2021
Metrics listed in the light-weight modules are checked with GCP
Stackdriver APIs to gather further information about them.

In case the metric is not valid, the request to the API returns an empty
response and the metric in question is excluded from collection.
There is no error returned from APIs.

In such a case a log line at error level is produced, notifying the user
of the wrong behaviour.

(cherry picked from commit 452f0fa)
endorama added a commit that referenced this pull request Aug 4, 2021
…ors (#27227)

Metrics listed in the light-weight modules are checked with GCP
Stackdriver APIs to gather further information about them.

In case the metric is not valid, the request to the API returns an empty
response and the metric in question is excluded from collection.
There is no error returned from APIs.

In such a case a log line at error level is produced, notifying the user
of the wrong behaviour.

(cherry picked from commit 452f0fa)

Co-authored-by: endorama <526307+endorama@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.15.0 Automated backport with mergify enhancement Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants