Merge pull request #887 from SouenMazouin/fix/request-error-total-iis

fix: add missing metrics for IIS version >= 8
This commit is contained in:
Calle Pettersson 2021-12-18 15:28:17 +01:00 committed by GitHub
commit 524bfde5a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,11 +4,12 @@ package collector
import (
"fmt"
"regexp"
"github.com/prometheus-community/windows_exporter/log"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/sys/windows/registry"
"gopkg.in/alecthomas/kingpin.v2"
"regexp"
)
func init() {
@ -411,7 +412,7 @@ func NewIISCollector() (Collector, error) {
nil,
),
// W3WP_W3SVC
// W3SVC_W3WP
Threads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_threads"),
"",
@ -604,6 +605,37 @@ func NewIISCollector() (Collector, error) {
[]string{"app", "pid"},
nil,
),
// W3SVC_W3WP_IIS8
RequestErrorsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_request_errors_total"),
"",
[]string{"app", "pid", "status_code"},
nil,
),
WebSocketRequestsActive: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_current_websocket_requests"),
"",
[]string{"app", "pid"},
nil,
),
WebSocketConnectionAttempts: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_attempts_total"),
"",
[]string{"app", "pid"},
nil,
),
WebSocketConnectionsAccepted: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_accepted_total"),
"",
[]string{"app", "pid"},
nil,
),
WebSocketConnectionsRejected: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "worker_websocket_connection_rejected_total"),
"",
[]string{"app", "pid"},
nil,
),
// Web Service Cache
ServiceCache_ActiveFlushedEntries: prometheus.NewDesc(
@ -1543,7 +1575,7 @@ func (c *IISCollector) collectW3SVC_W3WP(ctx *ScrapeContext, ch chan<- prometheu
if c.iis_version.major >= 8 {
var W3SVC_W3WP_IIS8 []perflibW3SVC_W3WP_IIS8
if err := unmarshalObject(ctx.perfObjects["W3SVC_W3WP"], &W3SVC_W3WP); err != nil {
if err := unmarshalObject(ctx.perfObjects["W3SVC_W3WP"], &W3SVC_W3WP_IIS8); err != nil {
return nil, err
}