-
Notifications
You must be signed in to change notification settings - Fork 711
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
Add App Pool metrics to IIS module #70
Conversation
Nice, really good work! This looks pretty good from a quick lookover. The one thing I would like to change is to map the
So basically, add another label to |
Ah good thinking. I'll see if I can work out how to do that. |
How does that look? I wasn't sure if the state values should be lower case and/or snake case? I've left them proper cased with spaces as they were described in the docs for now. |
Nice! Only one minor point, we should expose even the states which are not currently active, but with a value of 0. I think we're doing this somewhere already, let's see if I can find it. Edit: Found it: f5365c9#diff-55a5701e10d779d0c16948d45e6c0422R86 |
Ah beautiful - thanks for that. I'll make that change, and so should the value of the metric be just 1 for the active states or leave them as their current value? Having them as just 1 might make them more easier to use when querying perhaps? |
Exactly, set it to 1 if it is the active state, 0 otherwise. Makes for easy querying, as you say. |
Return 1 for active state
I think that should do the trick. Thanks for the example too, that helped a lot 😄 |
Looks fantastic! Great work @simonwillcock, I hope you found golang enjoyable |
collector/iis.go
Outdated
ch <- prometheus.MustNewConstMetric( | ||
c.CurrentApplicationPoolState, | ||
prometheus.GaugeValue, | ||
float64(isCurrentState), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this cast is unneeded, as you create a float value implicit already by isCurrentState := 0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right you are. I'll fix that up
Looks all good to me, but since @carlpett started the review, I'll let him merge it |
Took it for a test run on one of my machines, and I think there might be something off with the uptime-metrics: In the service collector we do some normalization to get around this, but it doesn't look like that exact normalization works here (I get 17000 days of uptime). Trying to find some documentation. |
@carlpett days since Jan 1, 1970 = 17277, related? |
Aha, well spotted. The |
Oh good pickup! |
If it's available, expose the time it started rather than uptime. This lets you use |
I don't believe it is unfortunately - only uptime |
Quick question - do I need to cast the result of that equation? Or cast the value first and then do the calculation? Something like this |
Ended up doing the same what is done in I'm not at work any more though, so I can't test these unfortunately |
@simonwillcock if the underlying type of a and b is an int, then float64(a / b) will first calc the integer result of a/b, then cast to float, so you'll loose precision. The way you solved it is correct! |
Ah rightio, thanks for explaining that for me! |
Are you sure CurrentApplicationPoolUptime isn't the time it started at? That you're doing a subtraction indicates to me that that number is not uptime. |
Its possible that I'm misunderstanding.. the docs I found said this for CurrentApplicationPoolUptime: "The length of time, in seconds, that the application pool has been running since it was started" but they didn't appear to be official msdn docs though. |
@simonwillcock Yeah, the docs are for the processed metrics that Windows uses in ProcMon, so you'll have to take those with a pinch of salt... |
Interesting. I think it sounds like you guys know about this than me so I'll take your word for it! |
It looks like @brian-brazil is on the money and I'll push an update to make it return the uptime instead so that it matches |
@simonwillcock Great! Just one last thing (sorry): with this change, the metric should probably be renamed from |
@simonwillcock Thanks, and kudos on a very nice first Go PR! |
Thanks very much for guiding me through it 😊 |
As discussed in #69 this adds metrics exposed by the
Win32_PerfRawData_APPPOOLCountersProvider_APPPOOLWAS
class