jmpsec / osctrl

Fast and efficient osquery management
https://osctrl.net
MIT License
391 stars 51 forks source link

Add prometheus metrics to osctrl-tls #522

Closed zhuoyuan-liu closed 1 month ago

zhuoyuan-liu commented 1 month ago

This PR added Prometheus metrics support for osctrl-tls. Issue: https://github.com/jmpsec/osctrl/issues/504

Currently, it has all default metrics go metrics such as memory info and gc duration etc. Also, we added one custom histogram metric to measure the total request/latency to each osquery endpoint.

The metric server would run as a separate service in a different port. We can query e.g. P90 latency for each endpoint with different environments with the histogram metric.

image

Also the request rate for different path and status code.

image
javuto commented 1 month ago

Thank you for the PR! I will add some comments in a code review 🙂

zhuoyuan-liu commented 1 month ago

I have updated the flag. Should I start to clean up the old metrics components for osctrl-tls?

javuto commented 1 month ago

I have updated the flag. Should I start to clean up the old metrics components for osctrl-tls?

You mean the emitted metrics? Instead of removing them, it would be better if we can find a way for those to be utilized by prometheus too.

zhuoyuan-liu commented 1 month ago

@javuto I have added the flag, could you please take another look?

zhuoyuan-liu commented 1 month ago

@javuto I Just fixed the conflicts.