Merge branch 'master' into feat/add_owner_node

This commit is contained in:
Jan-Otto Kröpke
2024-04-21 08:47:43 +02:00
committed by GitHub
17 changed files with 155 additions and 97 deletions

View File

@@ -174,7 +174,7 @@ func (c *collector) Build() error {
)
c.ProcessorPrivUtility = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_privileged_utility_total"),
"Processor Privilieged Utility represents is the amount of time the core has spent executing instructions inside the kernel",
"Processor Privileged Utility represents is the amount of time the core has spent executing instructions inside the kernel",
[]string{"core"},
nil,
)

View File

@@ -57,7 +57,7 @@ func (c *collector) GetPerfCounter() ([]string, error) {
func (c *collector) Build() error {
c.CpuInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, "", Name),
"Labeled CPU information as provided provided by Win32_Processor",
"Labelled CPU information as provided provided by Win32_Processor",
[]string{
"architecture",
"device_id",

View File

@@ -63,7 +63,7 @@ func (c *collector) Build() error {
)
c.Hostname = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "hostname"),
"Labeled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain",
"Labelled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain",
[]string{
"hostname",
"domain",

View File

@@ -14,8 +14,8 @@ import (
"github.com/prometheus-community/windows_exporter/pkg/types"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/version"
)
func (c *Collectors) BuildServeHTTP(disableExporterMetrics bool, timeoutMargin float64) http.HandlerFunc {
@@ -32,7 +32,14 @@ func (c *Collectors) BuildServeHTTP(disableExporterMetrics bool, timeoutMargin f
}
filteredCollectors[name] = col
}
return nil, NewPrometheus(timeout, c, c.logger)
filtered := Collectors{
logger: c.logger,
collectors: filteredCollectors,
perfCounterQuery: c.perfCounterQuery,
}
return nil, NewPrometheus(timeout, &filtered, c.logger)
}
return func(w http.ResponseWriter, r *http.Request) {

View File

@@ -3,6 +3,7 @@
package os
import (
"errors"
"fmt"
"os"
"strings"
@@ -224,7 +225,9 @@ func (c *collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
}
revision, _, err := ntKey.GetIntegerValue("UBR")
if err != nil {
if errors.Is(err, registry.ErrNotExist) {
revision = 0
} else if err != nil {
return nil, err
}

View File

@@ -19,9 +19,10 @@ import (
)
const (
Name = "process"
FlagProcessExclude = "collector.process.exclude"
FlagProcessInclude = "collector.process.include"
Name = "process"
FlagProcessExclude = "collector.process.exclude"
FlagProcessInclude = "collector.process.include"
FlagEnableWorkerProcess = "collector.process.iis"
)
type Config struct {
@@ -91,7 +92,7 @@ func NewWithFlags(app *kingpin.Application) types.Collector {
).Default(ConfigDefaults.ProcessExclude).String(),
enableWorkerProcess: app.Flag(
"collector.process.iis",
FlagEnableWorkerProcess,
"Enable IIS worker process name queries. May cause the collector to leak memory.",
).Default("false").Bool(),
}