Commit Graph

18 Commits

Author SHA1 Message Date
Jan-Otto Kröpke
6890f391d4
fix lint
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2023-07-09 22:42:00 +02:00
Jan-Otto Kröpke
8509bc69a6
switch to go-kit logger
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2023-07-09 22:37:27 +02:00
Ben Reedy
04257a1b25
chore: Ensure collector build funcs are private
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>
2023-04-01 17:54:41 +10:00
Ben Reedy
9214a87d0d
feat: Remove init functions from collectors
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>
2023-04-01 17:54:40 +10:00
Mario Trangoni
0f1eb4a936 Fix counter metrics should have "_total" suffix issue
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2022-01-02 18:47:17 +01:00
Mario Trangoni
b98a956d51 gofmt: Fix File is not gofmt-ed with -s for go1.17
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2021-12-18 19:01:29 +01:00
Calle Pettersson
c5a545540d Take over prometheus/common/log into local log package
Signed-off-by: Calle Pettersson <carlpett@users.noreply.github.com>
2021-01-30 11:53:51 +01:00
Michael Allen
94bda6aa79 Expose TCPv6 performance counters in the tcp collector
Signed-off-by: Michael Allen <MAllen@laserfiche.com>
2020-10-08 11:43:39 -07:00
Michael Allen
380eff24c9 Convert the tcp collector to use perflib instead of WMI
Using perflib is substantially faster and more reliable than using WMI to
retrieve Windows performance counter data.

Signed-off-by: Michael Allen <MAllen@laserfiche.com>
2020-10-07 22:25:58 -07:00
Calle Pettersson
21a02c4fbe Only query the perflib objects we need 2020-02-29 10:40:53 +01:00
Ben Reedy
c23a98ae90
Set tcp_connections_established to gauge type
While the ConnectionsEstablished property in the
Win32_PerfRawData_Tcpip_TCP class is listed as a counter, real-world
metric values have been shown to increase *and* decrease.

Documentation for the property states "Number of TCP connections for
which the *current* state is either ESTABLISHED or CLOSE-WAIT" which
would imply the metric is a gauge.
2019-09-27 19:48:16 +10:00
Calle Pettersson
33879449a2 Refactor cpu collector to use perflib instead of WMI. 2019-05-25 13:48:40 +02:00
Calle Pettersson
f2462b26c8 Lint-fix: Package comments 2019-01-23 09:56:24 +01:00
Dave Henderson
5d4cafc0a1
Adding windows build constraints
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
2018-11-29 19:51:12 -05:00
Steve Zook
c156f2bcbe protect against emtpy wmi query result sets
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
2018-08-07 15:47:39 -04:00
Calle Pettersson
667d06116d Refactor wmi query generator to use wildcard selector 2018-06-06 10:38:36 +02:00
Calle Pettersson
be5ac7b440 Switch to prometheus/common/log for all logging 2018-04-05 07:27:26 +02:00
Jorrit Salverda
a52df7696a Add TCP collector (#142)
add tcp collector to get tcp connection usage stats from Win32_PerfRawData_Tcpip_TCPv4
2017-12-20 14:26:30 +01:00