prometheus-node-exporter-ucode: new modules and extended info#28016
prometheus-node-exporter-ucode: new modules and extended info#28016systemcrash wants to merge 2 commits intoopenwrt:masterfrom
Conversation
|
Nice, generally this looks good to me!
(But I haven't yet checked the metric themselves.)
Thanks for the `uname` replacement! I knew my solution was lame (I even
added a comment about it), but I wonder why I didn't use your way to
begin with...
The watchdog collector needs to be added to the Makefile.
Some of the next comments may sound nitpicking, but let's optimize each
collector for a minimal runtime. Using many on slow devices in a tight
polling interval really adds up:
- hwmon and realtek_poe add and just call scrape(), please fold the
function content out to the main scope to get rid of it
- don't use snprintf() like expression if not necessary (like
realtek_poe's METRIC_NAMESPACE, I'd just fold it into each usage)
- creating metrics of the same name should always happen once in the
main scope, and not in a loop (time, watchdog)
- watchdog looks like it could use some cleanup, can the `const metric =
{ ...}` logic applied here? To keep the code simple, it uses a metric
map to loop oneline() over it
If you didn't know: you can run selected collectors from the cmdline and
check the `node_scrape_collector_duration_seconds` metric for the runtime:
e.g.: `prometheus-node-exporter-ucode netclass`
I did that alot to get each collectors runtime down back then ;)
|
|
Wow, micro-optimisations! Yeah, I ran
So we get ordered results like this? (IIRC this accelerates ingestion?):
Maniacs crushing their routers with 5 seconds of polling :D
It's in base, so it's installed automatically. Should it be an extra? @GeorgeSapkin this commit length problem is not good. See how many characters one has to work with on this module?? :/ |
|
@systemcrash like I said before, I'm not married to the exact number. That one was the only thing in the official guidelines, so that's what I went with. If more people feel differently we can change the limit to something else, which I do think is important to have. We don't need to look far for whole commit messages being one long line. Edit: this also comes back to blocking build if formal fails. Which I'm still on the fence about. |
I'm OK with a limit at the established 72 characters. But I don't see why that should be a hard-limit. A warning perhaps. A hard-limit at like 120-150 likely flags that there're no newlines used anywhere. |
|
@dhewg if you could take another look? I optimised netdev and netclass for ordered output. |
|
pinging @dhewg - think I've addressed everything here. |
Sorry, I just meant: instead of: I appreciate the optimizations, but is the ordered output really worth it? Like in terms of time spend by the prometheus daemon to parse the output? It makes the collectors less readable, especially
Let's make it an extra. This is what I get one one of my devices: On another device I get: For hwmon, Is this the expected That's from: |
Yes, that looks correct. It pulls the chip_name from: Can you check that file content? Here's what I get from node-exporter v1.9 on an i3: vs:
It makes output less jumbled and more readable (since HELP strings occur with the TYPE, they're grouped together and that type appears once, rather than only appearing the first time in multiple appearances of that row type later on), and it contributes to lower data-cardinality at ingestion, which IIRC helps coalesce writes. I think it makes the code more readable - since the loops are distinct and not nested. |
|
OK. It's an extra now. Much appreciated if you could take hwmon for another spin @dhewg |
| let line = oneline(devroot + m); | ||
| metrics[m]({ device }, line); | ||
| for (let m in metrics) { | ||
| for (let i = 0; i < dev_length; i++) { |
There was a problem hiding this comment.
Does ucode not support for..of?
There was a problem hiding this comment.
No. But were we to do it that way, it creates a new object on every iteration, whereas the classic loop does not. Aiming for speed, here :)
| release: oneline("/proc/sys/kernel/osrelease"), | ||
| version: oneline("/proc/sys/kernel/version"), | ||
| machine: poneline("uname -m"), // TODO lame | ||
| machine: oneline("/proc/sys/kernel/arch"), |
There was a problem hiding this comment.
I prefer not to modify how it was already there. I know you want consistency...
There was a problem hiding this comment.
(they all align whatever the width anyway)
| identity: iden, | ||
| state: stat, | ||
| status: stus, | ||
| pretimeout_governor: prtg, |
There was a problem hiding this comment.
(they all align whatever the width anyway)
|
ping @dhewg for final test run |
|
Sorry for the delay, pre-xmas stress... Well, I agree to not modify the whitespaces!
Sorry, still disagreeing. While it's not rocket science, it's just more code to read. In netdev we now have 4 loops instead of one. You even added comments to make it clear what it does. It wasn't unclear before at all. So again: Is this reduced readability really worth it? As for hwmon/watchdog, the |
(my) Reasoning being that we output ordered, rather than revisiting the same metrics for different devices. It makes stare and compare in the scrape output clearer, among other downstream benefits.
I'll take another look at that. Empty isn't bad per-se, but we might as well avoid the output altogether. could you paste an example of the output? Edit: never mind. Found it :) |
-netdev -netclass Fix metric output to be ordered per-metric (and not per-device) as is done by node_exporter. In testing, netdev and netclass scrape time increased a mean 2msec as a result of the extra loops. In netdev, we skip some checks since the format of /proc/net/dev is stable. Signed-off-by: Paul Donald <newtwen+github@gmail.com>
-thermal management (temp and cooling devices) -uname amendment to oneline and help string -realtek-poe -odhcp6c -entropy help strings -time help string -hwmon -time clocksources -watchdog -metrics help strings Signed-off-by: Paul Donald <newtwen+github@gmail.com>
I got that, but why should scrape output readability trump code readability? Debugging comes to mind, but we can go just use our standard tools like "Other downstream benefits" may be the reason to go this way, but that's a bit too hand-wavy argument for my taste ;) Here's |
|
|
Fair. Well, when you're comparing with Prometheus node_exporter, it helps quite a bit.
Ah, thanks!
These should all be resolved with the latest push.
As should this, without things like The same fixes should also work on the Fritz. We now skip it if the path is unavailable. |
Copy variant from PR: openwrt/packages#28016 Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
-thermal management (temp and cooling devices)
-uname amendment to oneline and help string
-realtek-poe
-odhcp6c
-entropy help strings
-time help string
-hwmon
-time clocksources
-watchdog
-metrics help strings
📦 Package Details
Maintainer: @dhewg (?) @feckert
🧪 Run Testing Details
✅ Formalities