Perflib often exposes duplicate IIS entries, suffixed with '#' and a
number (I.E. iis_site_name#1).
These duplicate entries were causing the exporter to fail scraping due
to duplicate metrics.
Based on user feedback, the entry with the highest suffix
value is kept, with other duplicate entries discarded.
E.G. Given the following list of site names, "Site_B" would be
discarded, and "Site_B#2" would be kept and presented as "Site_B" in the
collector metrics.
[ "Site_A", "Site_B", "Site_C", "Site_B#2" ]
Signed-off-by: Ben Reedy <breed808@breed808.com>
Collector builder functions are only used internally in the `collector`
package, and shouldn't needlessly be exposed as part of the package API
to downstream clients.
Signed-off-by: Ben Reedy <breed808@breed808.com>
Behaviour of init functions has been centralised in `collector/init.go`,
and can be called during exporter startup. This allows the exporter to
control the timing of collector initialisation, rather than relying on
the import & `init()` method.
This should reduce unexpected behaviour arising from the use of
`init()`, such as #551.
Signed-off-by: Ben Reedy <breed808@breed808.com>
Bumps [github.com/alecthomas/kingpin](https://github.com/alecthomas/kingpin) from
v2.2.6 to v2.3.2.
This also changes the upstream package name from
gopkg.in/alecthomas/kingpin.v2 to github.com/alecthomas/kingpin/v2 which
is required by the upstream exporter-toolkit package.
Signed-off-by: Ben Reedy <breed808@breed808.com>
Collector would previously break from loop rather than skip nameless
entries, with the additional result of spamming event logs.
Signed-off-by: Ben Reedy <breed808@breed808.com>
The IIS >= 8 metrics was updated two times by application and caused a fatal error. The purpose
of this fix is to update metrics one time by application.
Signed-off-by: Aymeric Daurelle <aymeric.daurelle@cdiscount.com>
Allows the following metrics to be exposed again, they had disappeared after the migration to perflib :
- worker_request_errors_total
- worker_current_websocket_requests
- worker_websocket_connection_accepted_total
- worker_websocket_connection_rejected_total
Signed-off-by: Souen Mazouin <souen.mazouin@cdiscount.com>
If an WMI query were to return an empty result set, trying to access the
first element in the result set would result in a `panic: runtime error:
index out of range` error.
add logic to explicitly check if the result set size is 0 and return an
error rather.
Fixes https://github.com/martinlindhe/wmi_exporter/issues/240
If the `dst_cache` slice is empty, the program panics when trying to access `dst_cache[0]`
added a `if len(dst_cache) > 0 {}` block around the use of that variable to prevent that panic.
* Initial attempt at app pool collector
* Rename and tweak
* Attempt to convert uptime to unix timestamp
* Merge app pool metrics with existing IIS modules
* Update comments to reference new class
* Add state label to CurrentApplicationPoolState metric
* Return 0 value metrics for all non-active app states
Return 1 for active state
* Remove unnecessary float cast
* Add calculation for uptime
* Convert iis uptimes to unix timestamps and alter help msg
* Rename application pool uptime to start_time