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

Use PDH native functions as alternative to Registry Calls #1350

Open
jkroepke opened this issue Nov 25, 2023 · 4 comments
Open

Use PDH native functions as alternative to Registry Calls #1350

jkroepke opened this issue Nov 25, 2023 · 4 comments

Comments

@jkroepke
Copy link
Member

Reading the documentation about PerfCounter

Microsoft highly recommends to fetch data via PHD function instead native registry. It seems like that PDH function are more performance.

We have issues like #724 and the exporter does not work well under load and the mentioned Zabbix exporter is using PDH functions, too. Also datadog and telegraf using PDF library.

Ref:

We should look into it, since the Registry supports V1 PerfCounter only, while the PDH functions support both V1 and V2.

Since telegraph is using the same OSS license, we should consider to use telegraf libraries as base instead starting from scratch. The OTEL collector is doing the same.

@breed808
Copy link
Contributor

I'm very much in favour of moving to PDH, though I'm not currently in a position to implement and test this myself. Are you comfortable implementing this, if you have the time?

@jkroepke
Copy link
Member Author

I play with PDH function today. However I got different values back. It seems like that the perfcounter exporter mutate the values (e.g. from 100ns to 1sec).

ref:

switch ctr.Def.CounterType {
case PERF_ELAPSED_TIME:
target.Field(i).SetFloat(float64(ctr.Value-WindowsEpoch) / float64(obj.Frequency))
case PERF_100NSEC_TIMER, PERF_PRECISION_100NS_TIMER:
target.Field(i).SetFloat(float64(ctr.Value) * TicksToSecondScaleFactor)
default:
target.Field(i).SetFloat(float64(ctr.Value))
}

Additionally, I have no clue, what the "secondValue" is.

HasSecondValue: def.CounterType == averageCount64Type,

I can't find anything at the MS documentation and no clue, whats the source of windows_cpu_processor_rtc_total is.

Copy link

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

@github-actions github-actions bot added the Stale label Feb 25, 2024
@jkroepke jkroepke removed the Stale label Apr 21, 2024
@jkroepke jkroepke changed the title Consider to use PHD functions as alternative to Registry Calls Consider to use PDH functions as alternative to Registry Calls Apr 27, 2024
@jkroepke
Copy link
Member Author

jkroepke commented May 11, 2024

@breed808 I thought after the future use of PHD in favor registry based collectors.

Since we can't guarantee the exact metrics value between registry based collectors PHD, I had the idea the offer both source at once.

What did you think would be the best possible approach here?

  • Dedicated collector, eg. cpu2, disk2, memory2 and leave the old one as is.
  • Integrate a global toggle
  • Integrate a separate toggle for each collector (similar to service collector)

Everyone else in the community is invited to provide feedback here.

@jkroepke jkroepke pinned this issue May 11, 2024
@jkroepke jkroepke changed the title Consider to use PDH functions as alternative to Registry Calls Use PDH native functions as alternative to Registry Calls May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants