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

perfdata: add experimental generic collector #1459

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

jkroepke
Copy link
Member

@jkroepke jkroepke commented Apr 27, 2024

Ref #1350
Fixes #1414

This PR setup a generic performance data collectors based on the users configuration.

Instead existing collectors that is using the perflib, the perfdata collector using the Performance Data Helpers function. See #1350

Implement the Performance Data Helpers as separate collector may have multiple oppunities:

It's easier to compare data between Performance Data Helpers and Performance Data from perflib

Any PerfData custom metrics can be implement now, without having the hard requirement of implement collector of each single subsystem.

Example:

--collectors.enabled="perfdata" --collector.perfdata.objects='[
  {"object":"Processor Information","instances":["*"],"counters": {"% Processor Time": {}}},
  {"object":"Memory","counters": {"Cache Faults/sec": {"type": "counter"}}}
]'

Produces this:

Details
# HELP windows_perfdata_memory_cache_faults_sec 
# TYPE windows_perfdata_memory_cache_faults_sec counter
windows_perfdata_memory_cache_faults_sec 2.3861366e+07
# HELP windows_perfdata_processor_information__processor_time 
# TYPE windows_perfdata_processor_information__processor_time gauge
windows_perfdata_processor_information__processor_time{instance="0,0"} 1.7665375e+11
windows_perfdata_processor_information__processor_time{instance="0,1"} 1.797465625e+11
windows_perfdata_processor_information__processor_time{instance="0,10"} 2.315621875e+11
windows_perfdata_processor_information__processor_time{instance="0,11"} 2.3535375e+11
windows_perfdata_processor_information__processor_time{instance="0,12"} 2.37738125e+11
windows_perfdata_processor_information__processor_time{instance="0,13"} 2.3755578125e+11
windows_perfdata_processor_information__processor_time{instance="0,14"} 2.3753984375e+11
windows_perfdata_processor_information__processor_time{instance="0,15"} 2.3741625e+11
windows_perfdata_processor_information__processor_time{instance="0,16"} 2.3767484375e+11
windows_perfdata_processor_information__processor_time{instance="0,17"} 2.3750421875e+11
windows_perfdata_processor_information__processor_time{instance="0,18"} 2.3664765625e+11
windows_perfdata_processor_information__processor_time{instance="0,19"} 2.370809375e+11
windows_perfdata_processor_information__processor_time{instance="0,2"} 1.997065625e+11
windows_perfdata_processor_information__processor_time{instance="0,20"} 2.373096875e+11
windows_perfdata_processor_information__processor_time{instance="0,21"} 2.3738828125e+11
windows_perfdata_processor_information__processor_time{instance="0,22"} 2.3773328125e+11
windows_perfdata_processor_information__processor_time{instance="0,23"} 2.37351875e+11
windows_perfdata_processor_information__processor_time{instance="0,3"} 1.9896265625e+11
windows_perfdata_processor_information__processor_time{instance="0,4"} 2.2467421875e+11
windows_perfdata_processor_information__processor_time{instance="0,5"} 2.3189421875e+11
windows_perfdata_processor_information__processor_time{instance="0,6"} 2.301384375e+11
windows_perfdata_processor_information__processor_time{instance="0,7"} 2.3463625e+11
windows_perfdata_processor_information__processor_time{instance="0,8"} 2.3394984375e+11
windows_perfdata_processor_information__processor_time{instance="0,9"} 2.360415625e+11

In case it works well, some collectors will be migrate from perflib to PDH, too.

@DerfOh
Copy link

DerfOh commented May 10, 2024

Any PerfData custom metrics can be implement now, without having the hard requirement of implement collector of each single subsystem.

Seems this might resolve #1414 as well

Copy link
Contributor

@breed808 breed808 left a comment

Choose a reason for hiding this comment

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

Excellent work on getting this implemented! I've left a few minor questions, let me know if they require any clarification.

pkg/pdh/win_perf_counters.go Outdated Show resolved Hide resolved
pkg/pdh/win_perf_counters.go Outdated Show resolved Hide resolved
pkg/pdh/win_perf_counters.go Outdated Show resolved Hide resolved
pkg/perflib/const.go Outdated Show resolved Hide resolved
pkg/collector/perfdata/perfdata.go Outdated Show resolved Hide resolved
pkg/collector/perfdata/perfdata.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@jkroepke jkroepke requested a review from breed808 May 11, 2024 07:04
@jkroepke jkroepke changed the title perfdata collector Add experimental generic perfdata collector May 11, 2024
@jkroepke jkroepke modified the milestones: v0.26.0, v0.27.0 Jul 29, 2024
@jkroepke jkroepke marked this pull request as draft August 31, 2024 21:15
@jkroepke jkroepke removed this from the v0.27.0 milestone Sep 1, 2024
@jkroepke jkroepke changed the base branch from master to next September 1, 2024 18:23
@jkroepke jkroepke changed the title Add experimental generic perfdata collector perfdata: add experimental generic collector Sep 1, 2024
@jkroepke jkroepke marked this pull request as ready for review September 1, 2024 18:28
@jkroepke jkroepke merged commit f7432aa into prometheus-community:next Sep 6, 2024
7 checks passed
@jkroepke jkroepke deleted the pdh branch September 6, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom performance counters
3 participants