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

Cherry-pick #18361 to 7.8: perfmon - remove negative counter value errors from the event output #18450

Merged
merged 1 commit into from
May 13, 2020

Conversation

narph
Copy link
Contributor

@narph narph commented May 12, 2020

Cherry-pick of PR #18361 to 7.8 branch. Original message:

What does this PR do?

  • ignores PDH_CALC_NEGATIVE_VALUE and PDH_INVALID_DATA type errors from the event output
  • adds cstatus value in the debug information

Why is it important?

When collecting a high number of counters values seems that for specific processes the counter values retrieved are negative and the win32 api returns the error:

0x800007D8 (PDH_CALC_NEGATIVE_VALUE) | A counter with a negative value was detected.

or

0xC0000BC6 (PDH_INVALID_DATA) | The data is not valid. with cstatus 0xC0000BBA (PDH_CSTATUS_INVALID_DATA) | The returned data is not valid.

Which means the counter was successfully found, but the data returned is not valid. This error can occur if the counter value is less than the previous value. (Because counter values always increment, the counter value rolls over to zero when it reaches its maximum value.) Another possible cause is a system timer that is not correct.

These errors do not cause the application to run unsuccessfully and the following calls return a positive value.
These types of errors are still logged as debug messages.

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.

How to test this PR locally

Create a perfmon configuration with a high number of perfmon counters including Process object counters since the errors are encountered only at that level and run the perfmon metricset with a small interval.

Related issues

Logs

	Line 236493: 2020-05-07T18:18:27.118+0200	DEBUG	[perfmon]	perfmon/data.go:51	Counter value retrieval returned	{"error": "A counter with a negative value was detected.", "cstatus": "A counter with a negative value was detected.", "perfmon": {"query": "\\\\DESKTOP-RFOOE09\\Process(SearchFilterHost)\\IO Other Bytes/sec"}}
	Line 236494: 2020-05-07T18:18:27.144+0200	DEBUG	[perfmon]	perfmon/data.go:51	Counter value retrieval returned	{"error": "A counter with a negative value was detected.", "cstatus": "A counter with a negative value was detected.", "perfmon": {"query": "\\\\DESKTOP-RFOOE09\\Process(SearchFilterHost)\\% Processor Time"}}
	Line 273453: 2020-05-07T18:18:42.141+0200	DEBUG	[perfmon]	perfmon/data.go:51	Counter value retrieval returned	{"error": "The data is not valid.", "cstatus": "The returned data is not valid.", "perfmon": {"query": "\\\\DESKTOP-RFOOE09\\Process(backgroundTaskHost)\\IO Read Bytes/sec"}}
	Line 273454: 2020-05-07T18:18:42.159+0200	DEBUG	[perfmon]	perfmon/data.go:51	Counter value retrieval returned	{"error": "The data is not valid.", "cstatus": "The returned data is not valid.", "perfmon": {"query": "\\\\DESKTOP-RFOOE09\\Process(backgroundTaskHost)\\IO Write Operations/sec"}}

…lastic#18361)

* handle errors

* update changelog

* fix tests

* address review

(cherry picked from commit 89a4f3a)
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 12, 2020
@narph narph added [zube]: In Review backport Metricbeat Metricbeat Team:Integrations Label for the Integrations team labels May 12, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@narph narph removed the needs_team Indicates that the issue/PR needs a Team:* label label May 12, 2020
@zube zube bot added [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label [zube]: In Review and removed [zube]: In Review [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label labels May 12, 2020
@narph narph self-assigned this May 12, 2020
@zube zube bot added [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label and removed [zube]: In Review labels May 12, 2020
@zube zube bot unassigned narph May 12, 2020
@zube zube bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 12, 2020
@zube zube bot assigned narph May 12, 2020
@zube zube bot added [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label and removed [zube]: In Review labels May 12, 2020
@zube zube bot unassigned narph May 12, 2020
@zube zube bot added [zube]: In Review and removed [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label labels May 12, 2020
@zube zube bot assigned narph May 12, 2020
@zube zube bot added [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label and removed [zube]: In Review labels May 12, 2020
@zube zube bot unassigned narph May 12, 2020
@zube zube bot added [zube]: In Review and removed [zube]: Inbox needs_team Indicates that the issue/PR needs a Team:* label labels May 12, 2020
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

Test stats 🧪

Test Results
Failed 0
Passed 2323
Skipped 560
Total 2883

@narph narph merged commit 2bded59 into elastic:7.8 May 13, 2020
@narph narph deleted the backport_18361_7.8 branch May 13, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Metricbeat Metricbeat Team:Integrations Label for the Integrations team [zube]: Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants