*: cleanup collector API 3 (#1556)

This commit is contained in:
Jan-Otto Kröpke
2024-08-10 20:02:07 +02:00
committed by GitHub
parent b2548e02bd
commit 27a3553dac
27 changed files with 1545 additions and 1538 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -21,10 +21,10 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
NumberOfExceptionsThrown *prometheus.Desc numberOfExceptionsThrown *prometheus.Desc
NumberOfFilters *prometheus.Desc numberOfFilters *prometheus.Desc
NumberOfFinally *prometheus.Desc numberOfFinally *prometheus.Desc
ThrowToCatchDepth *prometheus.Desc throwToCatchDepth *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -55,25 +55,25 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.NumberOfExceptionsThrown = prometheus.NewDesc( c.numberOfExceptionsThrown = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "exceptions_thrown_total"), prometheus.BuildFQName(types.Namespace, Name, "exceptions_thrown_total"),
"Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions.", "Displays the total number of exceptions thrown since the application started. This includes both .NET exceptions and unmanaged exceptions that are converted into .NET exceptions.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberOfFilters = prometheus.NewDesc( c.numberOfFilters = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "exceptions_filters_total"), prometheus.BuildFQName(types.Namespace, Name, "exceptions_filters_total"),
"Displays the total number of .NET exception filters executed. An exception filter evaluates regardless of whether an exception is handled.", "Displays the total number of .NET exception filters executed. An exception filter evaluates regardless of whether an exception is handled.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberOfFinally = prometheus.NewDesc( c.numberOfFinally = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "exceptions_finallys_total"), prometheus.BuildFQName(types.Namespace, Name, "exceptions_finallys_total"),
"Displays the total number of finally blocks executed. Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter.", "Displays the total number of finally blocks executed. Only the finally blocks executed for an exception are counted; finally blocks on normal code paths are not counted by this counter.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.ThrowToCatchDepth = prometheus.NewDesc( c.throwToCatchDepth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "throw_to_catch_depth_total"), prometheus.BuildFQName(types.Namespace, Name, "throw_to_catch_depth_total"),
"Displays the total number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception.", "Displays the total number of stack frames traversed, from the frame that threw the exception to the frame that handled the exception.",
[]string{"process"}, []string{"process"},
@@ -115,28 +115,28 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberOfExceptionsThrown, c.numberOfExceptionsThrown,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberofExcepsThrown), float64(process.NumberofExcepsThrown),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberOfFilters, c.numberOfFilters,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberofFiltersPersec), float64(process.NumberofFiltersPersec),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberOfFinally, c.numberOfFinally,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberofFinallysPersec), float64(process.NumberofFinallysPersec),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ThrowToCatchDepth, c.throwToCatchDepth,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.ThrowToCatchDepthPersec), float64(process.ThrowToCatchDepthPersec),
process.Name, process.Name,

View File

@@ -21,9 +21,9 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
NumberofCCWs *prometheus.Desc numberOfCCWs *prometheus.Desc
Numberofmarshalling *prometheus.Desc numberOfMarshalling *prometheus.Desc
NumberofStubs *prometheus.Desc numberOfStubs *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -54,19 +54,19 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.NumberofCCWs = prometheus.NewDesc( c.numberOfCCWs = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "com_callable_wrappers_total"), prometheus.BuildFQName(types.Namespace, Name, "com_callable_wrappers_total"),
"Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client.", "Displays the current number of COM callable wrappers (CCWs). A CCW is a proxy for a managed object being referenced from an unmanaged COM client.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.Numberofmarshalling = prometheus.NewDesc( c.numberOfMarshalling = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "interop_marshalling_total"), prometheus.BuildFQName(types.Namespace, Name, "interop_marshalling_total"),
"Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started.", "Displays the total number of times arguments and return values have been marshaled from managed to unmanaged code, and vice versa, since the application started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberofStubs = prometheus.NewDesc( c.numberOfStubs = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "interop_stubs_created_total"), prometheus.BuildFQName(types.Namespace, Name, "interop_stubs_created_total"),
"Displays the current number of stubs created by the common language runtime. Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call.", "Displays the current number of stubs created by the common language runtime. Stubs are responsible for marshaling arguments and return values from managed to unmanaged code, and vice versa, during a COM interop call or a platform invoke call.",
[]string{"process"}, []string{"process"},
@@ -108,21 +108,21 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofCCWs, c.numberOfCCWs,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberofCCWs), float64(process.NumberofCCWs),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Numberofmarshalling, c.numberOfMarshalling,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.Numberofmarshalling), float64(process.Numberofmarshalling),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofStubs, c.numberOfStubs,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberofStubs), float64(process.NumberofStubs),
process.Name, process.Name,

View File

@@ -21,10 +21,10 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
NumberofMethodsJitted *prometheus.Desc numberOfMethodsJitted *prometheus.Desc
TimeinJit *prometheus.Desc timeInJit *prometheus.Desc
StandardJitFailures *prometheus.Desc standardJitFailures *prometheus.Desc
TotalNumberofILBytesJitted *prometheus.Desc totalNumberOfILBytesJitted *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -55,25 +55,25 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.NumberofMethodsJitted = prometheus.NewDesc( c.numberOfMethodsJitted = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "jit_methods_total"), prometheus.BuildFQName(types.Namespace, Name, "jit_methods_total"),
"Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods.", "Displays the total number of methods JIT-compiled since the application started. This counter does not include pre-JIT-compiled methods.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TimeinJit = prometheus.NewDesc( c.timeInJit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "jit_time_percent"), prometheus.BuildFQName(types.Namespace, Name, "jit_time_percent"),
"Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled.", "Displays the percentage of time spent in JIT compilation. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase occurs when a method and its dependencies are compiled.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.StandardJitFailures = prometheus.NewDesc( c.standardJitFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "jit_standard_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "jit_standard_failures_total"),
"Displays the peak number of methods the JIT compiler has failed to compile since the application started. This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler.", "Displays the peak number of methods the JIT compiler has failed to compile since the application started. This failure can occur if the MSIL cannot be verified or if there is an internal error in the JIT compiler.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalNumberofILBytesJitted = prometheus.NewDesc( c.totalNumberOfILBytesJitted = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "jit_il_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "jit_il_bytes_total"),
"Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started", "Displays the total number of Microsoft intermediate language (MSIL) bytes compiled by the just-in-time (JIT) compiler since the application started",
[]string{"process"}, []string{"process"},
@@ -117,28 +117,28 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofMethodsJitted, c.numberOfMethodsJitted,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberofMethodsJitted), float64(process.NumberofMethodsJitted),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TimeinJit, c.timeInJit,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.PercentTimeinJit)/float64(process.Frequency_PerfTime), float64(process.PercentTimeinJit)/float64(process.Frequency_PerfTime),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StandardJitFailures, c.standardJitFailures,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.StandardJitFailures), float64(process.StandardJitFailures),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalNumberofILBytesJitted, c.totalNumberOfILBytesJitted,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalNumberofILBytesJitted), float64(process.TotalNumberofILBytesJitted),
process.Name, process.Name,

View File

@@ -21,15 +21,15 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
BytesinLoaderHeap *prometheus.Desc bytesInLoaderHeap *prometheus.Desc
Currentappdomains *prometheus.Desc currentAppDomains *prometheus.Desc
CurrentAssemblies *prometheus.Desc currentAssemblies *prometheus.Desc
CurrentClassesLoaded *prometheus.Desc currentClassesLoaded *prometheus.Desc
TotalAppdomains *prometheus.Desc totalAppDomains *prometheus.Desc
Totalappdomainsunloaded *prometheus.Desc totalAppDomainsUnloaded *prometheus.Desc
TotalAssemblies *prometheus.Desc totalAssemblies *prometheus.Desc
TotalClassesLoaded *prometheus.Desc totalClassesLoaded *prometheus.Desc
TotalNumberofLoadFailures *prometheus.Desc totalNumberOfLoadFailures *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -60,55 +60,55 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.BytesinLoaderHeap = prometheus.NewDesc( c.bytesInLoaderHeap = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "loader_heap_size_bytes"), prometheus.BuildFQName(types.Namespace, Name, "loader_heap_size_bytes"),
"Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file.", "Displays the current size, in bytes, of the memory committed by the class loader across all application domains. Committed memory is the physical space reserved in the disk paging file.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.Currentappdomains = prometheus.NewDesc( c.currentAppDomains = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "appdomains_loaded_current"), prometheus.BuildFQName(types.Namespace, Name, "appdomains_loaded_current"),
"Displays the current number of application domains loaded in this application.", "Displays the current number of application domains loaded in this application.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.CurrentAssemblies = prometheus.NewDesc( c.currentAssemblies = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "assemblies_loaded_current"), prometheus.BuildFQName(types.Namespace, Name, "assemblies_loaded_current"),
"Displays the current number of assemblies loaded across all application domains in the currently running application. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.", "Displays the current number of assemblies loaded across all application domains in the currently running application. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.CurrentClassesLoaded = prometheus.NewDesc( c.currentClassesLoaded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "classes_loaded_current"), prometheus.BuildFQName(types.Namespace, Name, "classes_loaded_current"),
"Displays the current number of classes loaded in all assemblies.", "Displays the current number of classes loaded in all assemblies.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalAppdomains = prometheus.NewDesc( c.totalAppDomains = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "appdomains_loaded_total"), prometheus.BuildFQName(types.Namespace, Name, "appdomains_loaded_total"),
"Displays the peak number of application domains loaded since the application started.", "Displays the peak number of application domains loaded since the application started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.Totalappdomainsunloaded = prometheus.NewDesc( c.totalAppDomainsUnloaded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "appdomains_unloaded_total"), prometheus.BuildFQName(types.Namespace, Name, "appdomains_unloaded_total"),
"Displays the total number of application domains unloaded since the application started. If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded.", "Displays the total number of application domains unloaded since the application started. If an application domain is loaded and unloaded multiple times, this counter increments each time the application domain is unloaded.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalAssemblies = prometheus.NewDesc( c.totalAssemblies = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "assemblies_loaded_total"), prometheus.BuildFQName(types.Namespace, Name, "assemblies_loaded_total"),
"Displays the total number of assemblies loaded since the application started. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.", "Displays the total number of assemblies loaded since the application started. If the assembly is loaded as domain-neutral from multiple application domains, this counter is incremented only once.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalClassesLoaded = prometheus.NewDesc( c.totalClassesLoaded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "classes_loaded_total"), prometheus.BuildFQName(types.Namespace, Name, "classes_loaded_total"),
"Displays the cumulative number of classes loaded in all assemblies since the application started.", "Displays the cumulative number of classes loaded in all assemblies since the application started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalNumberofLoadFailures = prometheus.NewDesc( c.totalNumberOfLoadFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "class_load_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "class_load_failures_total"),
"Displays the peak number of classes that have failed to load since the application started.", "Displays the peak number of classes that have failed to load since the application started.",
[]string{"process"}, []string{"process"},
@@ -161,63 +161,63 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesinLoaderHeap, c.bytesInLoaderHeap,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.BytesinLoaderHeap), float64(process.BytesinLoaderHeap),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Currentappdomains, c.currentAppDomains,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Currentappdomains), float64(process.Currentappdomains),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentAssemblies, c.currentAssemblies,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.CurrentAssemblies), float64(process.CurrentAssemblies),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentClassesLoaded, c.currentClassesLoaded,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.CurrentClassesLoaded), float64(process.CurrentClassesLoaded),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalAppdomains, c.totalAppDomains,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalAppdomains), float64(process.TotalAppdomains),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Totalappdomainsunloaded, c.totalAppDomainsUnloaded,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.Totalappdomainsunloaded), float64(process.Totalappdomainsunloaded),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalAssemblies, c.totalAssemblies,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalAssemblies), float64(process.TotalAssemblies),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalClassesLoaded, c.totalClassesLoaded,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalClassesLoaded), float64(process.TotalClassesLoaded),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalNumberofLoadFailures, c.totalNumberOfLoadFailures,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalNumberofLoadFailures), float64(process.TotalNumberofLoadFailures),
process.Name, process.Name,

View File

@@ -21,13 +21,13 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
CurrentQueueLength *prometheus.Desc currentQueueLength *prometheus.Desc
NumberofcurrentlogicalThreads *prometheus.Desc numberOfCurrentLogicalThreads *prometheus.Desc
NumberofcurrentphysicalThreads *prometheus.Desc numberOfCurrentPhysicalThreads *prometheus.Desc
Numberofcurrentrecognizedthreads *prometheus.Desc numberOfCurrentRecognizedThreads *prometheus.Desc
Numberoftotalrecognizedthreads *prometheus.Desc numberOfTotalRecognizedThreads *prometheus.Desc
QueueLengthPeak *prometheus.Desc queueLengthPeak *prometheus.Desc
TotalNumberofContentions *prometheus.Desc totalNumberOfContentions *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -58,43 +58,43 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.CurrentQueueLength = prometheus.NewDesc( c.currentQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "current_queue_length"),
"Displays the total number of threads that are currently waiting to acquire a managed lock in the application.", "Displays the total number of threads that are currently waiting to acquire a managed lock in the application.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberofcurrentlogicalThreads = prometheus.NewDesc( c.numberOfCurrentLogicalThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_logical_threads"), prometheus.BuildFQName(types.Namespace, Name, "current_logical_threads"),
"Displays the number of current managed thread objects in the application. This counter maintains the count of both running and stopped threads. ", "Displays the number of current managed thread objects in the application. This counter maintains the count of both running and stopped threads. ",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberofcurrentphysicalThreads = prometheus.NewDesc( c.numberOfCurrentPhysicalThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_threads_current"), prometheus.BuildFQName(types.Namespace, Name, "physical_threads_current"),
"Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process.", "Displays the number of native operating system threads created and owned by the common language runtime to act as underlying threads for managed thread objects. This counter's value does not include the threads used by the runtime in its internal operations; it is a subset of the threads in the operating system process.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.Numberofcurrentrecognizedthreads = prometheus.NewDesc( c.numberOfCurrentRecognizedThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recognized_threads_current"), prometheus.BuildFQName(types.Namespace, Name, "recognized_threads_current"),
"Displays the number of threads that are currently recognized by the runtime. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once.", "Displays the number of threads that are currently recognized by the runtime. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.Numberoftotalrecognizedthreads = prometheus.NewDesc( c.numberOfTotalRecognizedThreads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "recognized_threads_total"), prometheus.BuildFQName(types.Namespace, Name, "recognized_threads_total"),
"Displays the total number of threads that have been recognized by the runtime since the application started. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once.", "Displays the total number of threads that have been recognized by the runtime since the application started. These threads are associated with a corresponding managed thread object. The runtime does not create these threads, but they have run inside the runtime at least once.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.QueueLengthPeak = prometheus.NewDesc( c.queueLengthPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "queue_length_total"), prometheus.BuildFQName(types.Namespace, Name, "queue_length_total"),
"Displays the total number of threads that waited to acquire a managed lock since the application started.", "Displays the total number of threads that waited to acquire a managed lock since the application started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalNumberofContentions = prometheus.NewDesc( c.totalNumberOfContentions = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "contentions_total"), prometheus.BuildFQName(types.Namespace, Name, "contentions_total"),
"Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully.", "Displays the total number of times that threads in the runtime have attempted to acquire a managed lock unsuccessfully.",
[]string{"process"}, []string{"process"},
@@ -141,49 +141,49 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentQueueLength, c.currentQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.CurrentQueueLength), float64(process.CurrentQueueLength),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofcurrentlogicalThreads, c.numberOfCurrentLogicalThreads,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberofcurrentlogicalThreads), float64(process.NumberofcurrentlogicalThreads),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofcurrentphysicalThreads, c.numberOfCurrentPhysicalThreads,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberofcurrentphysicalThreads), float64(process.NumberofcurrentphysicalThreads),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Numberofcurrentrecognizedthreads, c.numberOfCurrentRecognizedThreads,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Numberofcurrentrecognizedthreads), float64(process.Numberofcurrentrecognizedthreads),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Numberoftotalrecognizedthreads, c.numberOfTotalRecognizedThreads,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.Numberoftotalrecognizedthreads), float64(process.Numberoftotalrecognizedthreads),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.QueueLengthPeak, c.queueLengthPeak,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.QueueLengthPeak), float64(process.QueueLengthPeak),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalNumberofContentions, c.totalNumberOfContentions,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalNumberofContentions), float64(process.TotalNumberofContentions),
process.Name, process.Name,

View File

@@ -21,21 +21,18 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
AllocatedBytes *prometheus.Desc allocatedBytes *prometheus.Desc
FinalizationSurvivors *prometheus.Desc finalizationSurvivors *prometheus.Desc
HeapSize *prometheus.Desc heapSize *prometheus.Desc
PromotedBytes *prometheus.Desc promotedBytes *prometheus.Desc
NumberGCHandles *prometheus.Desc numberGCHandles *prometheus.Desc
NumberCollections *prometheus.Desc numberCollections *prometheus.Desc
NumberInducedGC *prometheus.Desc numberInducedGC *prometheus.Desc
NumberofPinnedObjects *prometheus.Desc numberOfPinnedObjects *prometheus.Desc
NumberofSinkBlocksinuse *prometheus.Desc numberOfSinkBlocksInUse *prometheus.Desc
NumberTotalCommittedBytes *prometheus.Desc numberTotalCommittedBytes *prometheus.Desc
NumberTotalreservedBytes *prometheus.Desc numberTotalReservedBytes *prometheus.Desc
TimeinGC *prometheus.Desc timeInGC *prometheus.Desc
PromotedFinalizationMemoryfromGen0 *prometheus.Desc
PromotedMemoryfromGen0 *prometheus.Desc
PromotedMemoryfromGen1 *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -66,73 +63,73 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.AllocatedBytes = prometheus.NewDesc( c.allocatedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "allocated_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "allocated_bytes_total"),
"Displays the total number of bytes allocated on the garbage collection heap.", "Displays the total number of bytes allocated on the garbage collection heap.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.FinalizationSurvivors = prometheus.NewDesc( c.finalizationSurvivors = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "finalization_survivors"), prometheus.BuildFQName(types.Namespace, Name, "finalization_survivors"),
"Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized.", "Displays the number of garbage-collected objects that survive a collection because they are waiting to be finalized.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.HeapSize = prometheus.NewDesc( c.heapSize = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "heap_size_bytes"), prometheus.BuildFQName(types.Namespace, Name, "heap_size_bytes"),
"Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated.", "Displays the maximum bytes that can be allocated; it does not indicate the current number of bytes allocated.",
[]string{"process", "area"}, []string{"process", "area"},
nil, nil,
) )
c.PromotedBytes = prometheus.NewDesc( c.promotedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "promoted_bytes"), prometheus.BuildFQName(types.Namespace, Name, "promoted_bytes"),
"Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection.", "Displays the bytes that were promoted from the generation to the next one during the last GC. Memory is promoted when it survives a garbage collection.",
[]string{"process", "area"}, []string{"process", "area"},
nil, nil,
) )
c.NumberGCHandles = prometheus.NewDesc( c.numberGCHandles = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "number_gc_handles"), prometheus.BuildFQName(types.Namespace, Name, "number_gc_handles"),
"Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment.", "Displays the current number of garbage collection handles in use. Garbage collection handles are handles to resources external to the common language runtime and the managed environment.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberCollections = prometheus.NewDesc( c.numberCollections = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "collections_total"), prometheus.BuildFQName(types.Namespace, Name, "collections_total"),
"Displays the number of times the generation objects are garbage collected since the application started.", "Displays the number of times the generation objects are garbage collected since the application started.",
[]string{"process", "area"}, []string{"process", "area"},
nil, nil,
) )
c.NumberInducedGC = prometheus.NewDesc( c.numberInducedGC = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "induced_gc_total"), prometheus.BuildFQName(types.Namespace, Name, "induced_gc_total"),
"Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect.", "Displays the peak number of times garbage collection was performed because of an explicit call to GC.Collect.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberofPinnedObjects = prometheus.NewDesc( c.numberOfPinnedObjects = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "number_pinned_objects"), prometheus.BuildFQName(types.Namespace, Name, "number_pinned_objects"),
"Displays the number of pinned objects encountered in the last garbage collection.", "Displays the number of pinned objects encountered in the last garbage collection.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberofSinkBlocksinuse = prometheus.NewDesc( c.numberOfSinkBlocksInUse = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "number_sink_blocksinuse"), prometheus.BuildFQName(types.Namespace, Name, "number_sink_blocksinuse"),
"Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector.", "Displays the current number of synchronization blocks in use. Synchronization blocks are per-object data structures allocated for storing synchronization information. They hold weak references to managed objects and must be scanned by the garbage collector.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberTotalCommittedBytes = prometheus.NewDesc( c.numberTotalCommittedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "committed_bytes"), prometheus.BuildFQName(types.Namespace, Name, "committed_bytes"),
"Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file.", "Displays the amount of virtual memory, in bytes, currently committed by the garbage collector. Committed memory is the physical memory for which space has been reserved in the disk paging file.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.NumberTotalreservedBytes = prometheus.NewDesc( c.numberTotalReservedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "reserved_bytes"), prometheus.BuildFQName(types.Namespace, Name, "reserved_bytes"),
"Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used.", "Displays the amount of virtual memory, in bytes, currently reserved by the garbage collector. Reserved memory is the virtual memory space reserved for the application when no disk or main memory pages have been used.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TimeinGC = prometheus.NewDesc( c.timeInGC = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gc_time_percent"), prometheus.BuildFQName(types.Namespace, Name, "gc_time_percent"),
"Displays the percentage of time that was spent performing a garbage collection in the last sample.", "Displays the percentage of time that was spent performing a garbage collection in the last sample.",
[]string{"process"}, []string{"process"},
@@ -198,21 +195,21 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AllocatedBytes, c.allocatedBytes,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.AllocatedBytesPersec), float64(process.AllocatedBytesPersec),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FinalizationSurvivors, c.finalizationSurvivors,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.FinalizationSurvivors), float64(process.FinalizationSurvivors),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HeapSize, c.heapSize,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Gen0heapsize), float64(process.Gen0heapsize),
process.Name, process.Name,
@@ -220,7 +217,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PromotedBytes, c.promotedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Gen0PromotedBytesPerSec), float64(process.Gen0PromotedBytesPerSec),
process.Name, process.Name,
@@ -228,7 +225,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HeapSize, c.heapSize,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Gen1heapsize), float64(process.Gen1heapsize),
process.Name, process.Name,
@@ -236,7 +233,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PromotedBytes, c.promotedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Gen1PromotedBytesPerSec), float64(process.Gen1PromotedBytesPerSec),
process.Name, process.Name,
@@ -244,7 +241,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HeapSize, c.heapSize,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Gen2heapsize), float64(process.Gen2heapsize),
process.Name, process.Name,
@@ -252,7 +249,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HeapSize, c.heapSize,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.LargeObjectHeapsize), float64(process.LargeObjectHeapsize),
process.Name, process.Name,
@@ -260,14 +257,14 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberGCHandles, c.numberGCHandles,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberGCHandles), float64(process.NumberGCHandles),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberCollections, c.numberCollections,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberGen0Collections), float64(process.NumberGen0Collections),
process.Name, process.Name,
@@ -275,7 +272,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberCollections, c.numberCollections,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberGen1Collections), float64(process.NumberGen1Collections),
process.Name, process.Name,
@@ -283,7 +280,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberCollections, c.numberCollections,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberGen2Collections), float64(process.NumberGen2Collections),
process.Name, process.Name,
@@ -291,42 +288,42 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberInducedGC, c.numberInducedGC,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberInducedGC), float64(process.NumberInducedGC),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofPinnedObjects, c.numberOfPinnedObjects,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberofPinnedObjects), float64(process.NumberofPinnedObjects),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberofSinkBlocksinuse, c.numberOfSinkBlocksInUse,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberofSinkBlocksinuse), float64(process.NumberofSinkBlocksinuse),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberTotalCommittedBytes, c.numberTotalCommittedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberTotalcommittedBytes), float64(process.NumberTotalcommittedBytes),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberTotalreservedBytes, c.numberTotalReservedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.NumberTotalreservedBytes), float64(process.NumberTotalreservedBytes),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TimeinGC, c.timeInGC,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(100*process.PercentTimeinGC)/float64(process.PercentTimeinGC_base), float64(100*process.PercentTimeinGC)/float64(process.PercentTimeinGC_base),
process.Name, process.Name,

View File

@@ -21,12 +21,12 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
Channels *prometheus.Desc channels *prometheus.Desc
ContextBoundClassesLoaded *prometheus.Desc contextBoundClassesLoaded *prometheus.Desc
ContextBoundObjects *prometheus.Desc contextBoundObjects *prometheus.Desc
ContextProxies *prometheus.Desc contextProxies *prometheus.Desc
Contexts *prometheus.Desc contexts *prometheus.Desc
TotalRemoteCalls *prometheus.Desc totalRemoteCalls *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -57,37 +57,37 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.Channels = prometheus.NewDesc( c.channels = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "channels_total"), prometheus.BuildFQName(types.Namespace, Name, "channels_total"),
"Displays the total number of remoting channels registered across all application domains since application started.", "Displays the total number of remoting channels registered across all application domains since application started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.ContextBoundClassesLoaded = prometheus.NewDesc( c.contextBoundClassesLoaded = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "context_bound_classes_loaded"), prometheus.BuildFQName(types.Namespace, Name, "context_bound_classes_loaded"),
"Displays the current number of context-bound classes that are loaded.", "Displays the current number of context-bound classes that are loaded.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.ContextBoundObjects = prometheus.NewDesc( c.contextBoundObjects = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "context_bound_objects_total"), prometheus.BuildFQName(types.Namespace, Name, "context_bound_objects_total"),
"Displays the total number of context-bound objects allocated.", "Displays the total number of context-bound objects allocated.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.ContextProxies = prometheus.NewDesc( c.contextProxies = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "context_proxies_total"), prometheus.BuildFQName(types.Namespace, Name, "context_proxies_total"),
"Displays the total number of remoting proxy objects in this process since it started.", "Displays the total number of remoting proxy objects in this process since it started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.Contexts = prometheus.NewDesc( c.contexts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "contexts"), prometheus.BuildFQName(types.Namespace, Name, "contexts"),
"Displays the current number of remoting contexts in the application.", "Displays the current number of remoting contexts in the application.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalRemoteCalls = prometheus.NewDesc( c.totalRemoteCalls = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "remote_calls_total"), prometheus.BuildFQName(types.Namespace, Name, "remote_calls_total"),
"Displays the total number of remote procedure calls invoked since the application started.", "Displays the total number of remote procedure calls invoked since the application started.",
[]string{"process"}, []string{"process"},
@@ -131,42 +131,42 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Channels, c.channels,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.Channels), float64(process.Channels),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ContextBoundClassesLoaded, c.contextBoundClassesLoaded,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.ContextBoundClassesLoaded), float64(process.ContextBoundClassesLoaded),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ContextBoundObjects, c.contextBoundObjects,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.ContextBoundObjectsAllocPersec), float64(process.ContextBoundObjectsAllocPersec),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ContextProxies, c.contextProxies,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.ContextProxies), float64(process.ContextProxies),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Contexts, c.contexts,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.Contexts), float64(process.Contexts),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalRemoteCalls, c.totalRemoteCalls,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalRemoteCalls), float64(process.TotalRemoteCalls),
process.Name, process.Name,

View File

@@ -21,10 +21,10 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
NumberLinkTimeChecks *prometheus.Desc numberLinkTimeChecks *prometheus.Desc
TimeinRTchecks *prometheus.Desc timeInRTChecks *prometheus.Desc
StackWalkDepth *prometheus.Desc stackWalkDepth *prometheus.Desc
TotalRuntimeChecks *prometheus.Desc totalRuntimeChecks *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -55,25 +55,25 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.NumberLinkTimeChecks = prometheus.NewDesc( c.numberLinkTimeChecks = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "link_time_checks_total"), prometheus.BuildFQName(types.Namespace, Name, "link_time_checks_total"),
"Displays the total number of link-time code access security checks since the application started.", "Displays the total number of link-time code access security checks since the application started.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TimeinRTchecks = prometheus.NewDesc( c.timeInRTChecks = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rt_checks_time_percent"), prometheus.BuildFQName(types.Namespace, Name, "rt_checks_time_percent"),
"Displays the percentage of time spent performing runtime code access security checks in the last sample.", "Displays the percentage of time spent performing runtime code access security checks in the last sample.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.StackWalkDepth = prometheus.NewDesc( c.stackWalkDepth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "stack_walk_depth"), prometheus.BuildFQName(types.Namespace, Name, "stack_walk_depth"),
"Displays the depth of the stack during that last runtime code access security check.", "Displays the depth of the stack during that last runtime code access security check.",
[]string{"process"}, []string{"process"},
nil, nil,
) )
c.TotalRuntimeChecks = prometheus.NewDesc( c.totalRuntimeChecks = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "runtime_checks_total"), prometheus.BuildFQName(types.Namespace, Name, "runtime_checks_total"),
"Displays the total number of runtime code access security checks performed since the application started.", "Displays the total number of runtime code access security checks performed since the application started.",
[]string{"process"}, []string{"process"},
@@ -116,28 +116,28 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NumberLinkTimeChecks, c.numberLinkTimeChecks,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.NumberLinkTimeChecks), float64(process.NumberLinkTimeChecks),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TimeinRTchecks, c.timeInRTChecks,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.PercentTimeinRTchecks)/float64(process.Frequency_PerfTime), float64(process.PercentTimeinRTchecks)/float64(process.Frequency_PerfTime),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StackWalkDepth, c.stackWalkDepth,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(process.StackWalkDepth), float64(process.StackWalkDepth),
process.Name, process.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalRuntimeChecks, c.totalRuntimeChecks,
prometheus.CounterValue, prometheus.CounterValue,
float64(process.TotalRuntimeChecks), float64(process.TotalRuntimeChecks),
process.Name, process.Name,

View File

@@ -21,32 +21,32 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
AccessAccepts *prometheus.Desc accessAccepts *prometheus.Desc
AccessChallenges *prometheus.Desc accessChallenges *prometheus.Desc
AccessRejects *prometheus.Desc accessRejects *prometheus.Desc
AccessRequests *prometheus.Desc accessRequests *prometheus.Desc
AccessBadAuthenticators *prometheus.Desc accessBadAuthenticators *prometheus.Desc
AccessDroppedPackets *prometheus.Desc accessDroppedPackets *prometheus.Desc
AccessInvalidRequests *prometheus.Desc accessInvalidRequests *prometheus.Desc
AccessMalformedPackets *prometheus.Desc accessMalformedPackets *prometheus.Desc
AccessPacketsReceived *prometheus.Desc accessPacketsReceived *prometheus.Desc
AccessPacketsSent *prometheus.Desc accessPacketsSent *prometheus.Desc
AccessServerResetTime *prometheus.Desc accessServerResetTime *prometheus.Desc
AccessServerUpTime *prometheus.Desc accessServerUpTime *prometheus.Desc
AccessUnknownType *prometheus.Desc accessUnknownType *prometheus.Desc
AccountingRequests *prometheus.Desc accountingRequests *prometheus.Desc
AccountingResponses *prometheus.Desc accountingResponses *prometheus.Desc
AccountingBadAuthenticators *prometheus.Desc accountingBadAuthenticators *prometheus.Desc
AccountingDroppedPackets *prometheus.Desc accountingDroppedPackets *prometheus.Desc
AccountingInvalidRequests *prometheus.Desc accountingInvalidRequests *prometheus.Desc
AccountingMalformedPackets *prometheus.Desc accountingMalformedPackets *prometheus.Desc
AccountingNoRecord *prometheus.Desc accountingNoRecord *prometheus.Desc
AccountingPacketsReceived *prometheus.Desc accountingPacketsReceived *prometheus.Desc
AccountingPacketsSent *prometheus.Desc accountingPacketsSent *prometheus.Desc
AccountingServerResetTime *prometheus.Desc accountingServerResetTime *prometheus.Desc
AccountingServerUpTime *prometheus.Desc accountingServerUpTime *prometheus.Desc
AccountingUnknownType *prometheus.Desc accountingUnknownType *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -77,152 +77,152 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.AccessAccepts = prometheus.NewDesc( c.accessAccepts = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_accepts"), prometheus.BuildFQName(types.Namespace, Name, "access_accepts"),
"(AccessAccepts)", "(AccessAccepts)",
nil, nil,
nil, nil,
) )
c.AccessChallenges = prometheus.NewDesc( c.accessChallenges = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_challenges"), prometheus.BuildFQName(types.Namespace, Name, "access_challenges"),
"(AccessChallenges)", "(AccessChallenges)",
nil, nil,
nil, nil,
) )
c.AccessRejects = prometheus.NewDesc( c.accessRejects = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_rejects"), prometheus.BuildFQName(types.Namespace, Name, "access_rejects"),
"(AccessRejects)", "(AccessRejects)",
nil, nil,
nil, nil,
) )
c.AccessRequests = prometheus.NewDesc( c.accessRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_requests"), prometheus.BuildFQName(types.Namespace, Name, "access_requests"),
"(AccessRequests)", "(AccessRequests)",
nil, nil,
nil, nil,
) )
c.AccessBadAuthenticators = prometheus.NewDesc( c.accessBadAuthenticators = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_bad_authenticators"), prometheus.BuildFQName(types.Namespace, Name, "access_bad_authenticators"),
"(BadAuthenticators)", "(BadAuthenticators)",
nil, nil,
nil, nil,
) )
c.AccessDroppedPackets = prometheus.NewDesc( c.accessDroppedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_dropped_packets"), prometheus.BuildFQName(types.Namespace, Name, "access_dropped_packets"),
"(DroppedPackets)", "(DroppedPackets)",
nil, nil,
nil, nil,
) )
c.AccessInvalidRequests = prometheus.NewDesc( c.accessInvalidRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_invalid_requests"), prometheus.BuildFQName(types.Namespace, Name, "access_invalid_requests"),
"(InvalidRequests)", "(InvalidRequests)",
nil, nil,
nil, nil,
) )
c.AccessMalformedPackets = prometheus.NewDesc( c.accessMalformedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_malformed_packets"), prometheus.BuildFQName(types.Namespace, Name, "access_malformed_packets"),
"(MalformedPackets)", "(MalformedPackets)",
nil, nil,
nil, nil,
) )
c.AccessPacketsReceived = prometheus.NewDesc( c.accessPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_packets_received"), prometheus.BuildFQName(types.Namespace, Name, "access_packets_received"),
"(PacketsReceived)", "(PacketsReceived)",
nil, nil,
nil, nil,
) )
c.AccessPacketsSent = prometheus.NewDesc( c.accessPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_packets_sent"), prometheus.BuildFQName(types.Namespace, Name, "access_packets_sent"),
"(PacketsSent)", "(PacketsSent)",
nil, nil,
nil, nil,
) )
c.AccessServerResetTime = prometheus.NewDesc( c.accessServerResetTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_server_reset_time"), prometheus.BuildFQName(types.Namespace, Name, "access_server_reset_time"),
"(ServerResetTime)", "(ServerResetTime)",
nil, nil,
nil, nil,
) )
c.AccessServerUpTime = prometheus.NewDesc( c.accessServerUpTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_server_up_time"), prometheus.BuildFQName(types.Namespace, Name, "access_server_up_time"),
"(ServerUpTime)", "(ServerUpTime)",
nil, nil,
nil, nil,
) )
c.AccessUnknownType = prometheus.NewDesc( c.accessUnknownType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "access_unknown_type"), prometheus.BuildFQName(types.Namespace, Name, "access_unknown_type"),
"(UnknownType)", "(UnknownType)",
nil, nil,
nil, nil,
) )
c.AccountingRequests = prometheus.NewDesc( c.accountingRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_requests"), prometheus.BuildFQName(types.Namespace, Name, "accounting_requests"),
"(AccountingRequests)", "(AccountingRequests)",
nil, nil,
nil, nil,
) )
c.AccountingResponses = prometheus.NewDesc( c.accountingResponses = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_responses"), prometheus.BuildFQName(types.Namespace, Name, "accounting_responses"),
"(AccountingResponses)", "(AccountingResponses)",
nil, nil,
nil, nil,
) )
c.AccountingBadAuthenticators = prometheus.NewDesc( c.accountingBadAuthenticators = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_bad_authenticators"), prometheus.BuildFQName(types.Namespace, Name, "accounting_bad_authenticators"),
"(BadAuthenticators)", "(BadAuthenticators)",
nil, nil,
nil, nil,
) )
c.AccountingDroppedPackets = prometheus.NewDesc( c.accountingDroppedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_dropped_packets"), prometheus.BuildFQName(types.Namespace, Name, "accounting_dropped_packets"),
"(DroppedPackets)", "(DroppedPackets)",
nil, nil,
nil, nil,
) )
c.AccountingInvalidRequests = prometheus.NewDesc( c.accountingInvalidRequests = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_invalid_requests"), prometheus.BuildFQName(types.Namespace, Name, "accounting_invalid_requests"),
"(InvalidRequests)", "(InvalidRequests)",
nil, nil,
nil, nil,
) )
c.AccountingMalformedPackets = prometheus.NewDesc( c.accountingMalformedPackets = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_malformed_packets"), prometheus.BuildFQName(types.Namespace, Name, "accounting_malformed_packets"),
"(MalformedPackets)", "(MalformedPackets)",
nil, nil,
nil, nil,
) )
c.AccountingNoRecord = prometheus.NewDesc( c.accountingNoRecord = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_no_record"), prometheus.BuildFQName(types.Namespace, Name, "accounting_no_record"),
"(NoRecord)", "(NoRecord)",
nil, nil,
nil, nil,
) )
c.AccountingPacketsReceived = prometheus.NewDesc( c.accountingPacketsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_received"), prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_received"),
"(PacketsReceived)", "(PacketsReceived)",
nil, nil,
nil, nil,
) )
c.AccountingPacketsSent = prometheus.NewDesc( c.accountingPacketsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_sent"), prometheus.BuildFQName(types.Namespace, Name, "accounting_packets_sent"),
"(PacketsSent)", "(PacketsSent)",
nil, nil,
nil, nil,
) )
c.AccountingServerResetTime = prometheus.NewDesc( c.accountingServerResetTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_reset_time"), prometheus.BuildFQName(types.Namespace, Name, "accounting_server_reset_time"),
"(ServerResetTime)", "(ServerResetTime)",
nil, nil,
nil, nil,
) )
c.AccountingServerUpTime = prometheus.NewDesc( c.accountingServerUpTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_server_up_time"), prometheus.BuildFQName(types.Namespace, Name, "accounting_server_up_time"),
"(ServerUpTime)", "(ServerUpTime)",
nil, nil,
nil, nil,
) )
c.AccountingUnknownType = prometheus.NewDesc( c.accountingUnknownType = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "accounting_unknown_type"), prometheus.BuildFQName(types.Namespace, Name, "accounting_unknown_type"),
"(UnknownType)", "(UnknownType)",
nil, nil,
@@ -292,79 +292,79 @@ func (c *Collector) CollectAccept(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessAccepts, c.accessAccepts,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessAccepts), float64(dst[0].AccessAccepts),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessChallenges, c.accessChallenges,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessChallenges), float64(dst[0].AccessChallenges),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessRejects, c.accessRejects,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessRejects), float64(dst[0].AccessRejects),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessRequests, c.accessRequests,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessRequests), float64(dst[0].AccessRequests),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessBadAuthenticators, c.accessBadAuthenticators,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessBadAuthenticators), float64(dst[0].AccessBadAuthenticators),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessDroppedPackets, c.accessDroppedPackets,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessDroppedPackets), float64(dst[0].AccessDroppedPackets),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessInvalidRequests, c.accessInvalidRequests,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessInvalidRequests), float64(dst[0].AccessInvalidRequests),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessMalformedPackets, c.accessMalformedPackets,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessMalformedPackets), float64(dst[0].AccessMalformedPackets),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessPacketsReceived, c.accessPacketsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessPacketsReceived), float64(dst[0].AccessPacketsReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessPacketsSent, c.accessPacketsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessPacketsSent), float64(dst[0].AccessPacketsSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessServerResetTime, c.accessServerResetTime,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessServerResetTime), float64(dst[0].AccessServerResetTime),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessServerUpTime, c.accessServerUpTime,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessServerUpTime), float64(dst[0].AccessServerUpTime),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccessUnknownType, c.accessUnknownType,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccessUnknownType), float64(dst[0].AccessUnknownType),
) )
@@ -380,73 +380,73 @@ func (c *Collector) CollectAccounting(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingRequests, c.accountingRequests,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingRequests), float64(dst[0].AccountingRequests),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingResponses, c.accountingResponses,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingResponses), float64(dst[0].AccountingResponses),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingBadAuthenticators, c.accountingBadAuthenticators,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingBadAuthenticators), float64(dst[0].AccountingBadAuthenticators),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingDroppedPackets, c.accountingDroppedPackets,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingDroppedPackets), float64(dst[0].AccountingDroppedPackets),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingInvalidRequests, c.accountingInvalidRequests,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingInvalidRequests), float64(dst[0].AccountingInvalidRequests),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingMalformedPackets, c.accountingMalformedPackets,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingMalformedPackets), float64(dst[0].AccountingMalformedPackets),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingNoRecord, c.accountingNoRecord,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingNoRecord), float64(dst[0].AccountingNoRecord),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingPacketsReceived, c.accountingPacketsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingPacketsReceived), float64(dst[0].AccountingPacketsReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingPacketsSent, c.accountingPacketsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingPacketsSent), float64(dst[0].AccountingPacketsSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingServerResetTime, c.accountingServerResetTime,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingServerResetTime), float64(dst[0].AccountingServerResetTime),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingServerUpTime, c.accountingServerUpTime,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingServerUpTime), float64(dst[0].AccountingServerUpTime),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AccountingUnknownType, c.accountingUnknownType,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AccountingUnknownType), float64(dst[0].AccountingUnknownType),
) )

View File

@@ -34,19 +34,19 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
OSInformation *prometheus.Desc osInformation *prometheus.Desc
PhysicalMemoryFreeBytes *prometheus.Desc pagingFreeBytes *prometheus.Desc
PagingFreeBytes *prometheus.Desc pagingLimitBytes *prometheus.Desc
VirtualMemoryFreeBytes *prometheus.Desc physicalMemoryFreeBytes *prometheus.Desc
ProcessesLimit *prometheus.Desc processMemoryLimitBytes *prometheus.Desc
ProcessMemoryLimitBytes *prometheus.Desc processes *prometheus.Desc
Processes *prometheus.Desc processesLimit *prometheus.Desc
Users *prometheus.Desc time *prometheus.Desc
PagingLimitBytes *prometheus.Desc timezone *prometheus.Desc
VirtualMemoryBytes *prometheus.Desc users *prometheus.Desc
VisibleMemoryBytes *prometheus.Desc virtualMemoryBytes *prometheus.Desc
Time *prometheus.Desc virtualMemoryFreeBytes *prometheus.Desc
Timezone *prometheus.Desc visibleMemoryBytes *prometheus.Desc
} }
type pagingFileCounter struct { type pagingFileCounter struct {
@@ -83,79 +83,79 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.OSInformation = prometheus.NewDesc( c.osInformation = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "info"), prometheus.BuildFQName(types.Namespace, Name, "info"),
"OperatingSystem.Caption, OperatingSystem.Version", "OperatingSystem.Caption, OperatingSystem.Version",
[]string{"product", "version", "major_version", "minor_version", "build_number", "revision"}, []string{"product", "version", "major_version", "minor_version", "build_number", "revision"},
nil, nil,
) )
c.PagingLimitBytes = prometheus.NewDesc( c.pagingLimitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "paging_limit_bytes"), prometheus.BuildFQName(types.Namespace, Name, "paging_limit_bytes"),
"OperatingSystem.SizeStoredInPagingFiles", "OperatingSystem.SizeStoredInPagingFiles",
nil, nil,
nil, nil,
) )
c.PagingFreeBytes = prometheus.NewDesc( c.pagingFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "paging_free_bytes"), prometheus.BuildFQName(types.Namespace, Name, "paging_free_bytes"),
"OperatingSystem.FreeSpaceInPagingFiles", "OperatingSystem.FreeSpaceInPagingFiles",
nil, nil,
nil, nil,
) )
c.PhysicalMemoryFreeBytes = prometheus.NewDesc( c.physicalMemoryFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "physical_memory_free_bytes"), prometheus.BuildFQName(types.Namespace, Name, "physical_memory_free_bytes"),
"OperatingSystem.FreePhysicalMemory", "OperatingSystem.FreePhysicalMemory",
nil, nil,
nil, nil,
) )
c.Time = prometheus.NewDesc( c.time = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time"), prometheus.BuildFQName(types.Namespace, Name, "time"),
"OperatingSystem.LocalDateTime", "OperatingSystem.LocalDateTime",
nil, nil,
nil, nil,
) )
c.Timezone = prometheus.NewDesc( c.timezone = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "timezone"), prometheus.BuildFQName(types.Namespace, Name, "timezone"),
"OperatingSystem.LocalDateTime", "OperatingSystem.LocalDateTime",
[]string{"timezone"}, []string{"timezone"},
nil, nil,
) )
c.Processes = prometheus.NewDesc( c.processes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processes"), prometheus.BuildFQName(types.Namespace, Name, "processes"),
"OperatingSystem.NumberOfProcesses", "OperatingSystem.NumberOfProcesses",
nil, nil,
nil, nil,
) )
c.ProcessesLimit = prometheus.NewDesc( c.processesLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processes_limit"), prometheus.BuildFQName(types.Namespace, Name, "processes_limit"),
"OperatingSystem.MaxNumberOfProcesses", "OperatingSystem.MaxNumberOfProcesses",
nil, nil,
nil, nil,
) )
c.ProcessMemoryLimitBytes = prometheus.NewDesc( c.processMemoryLimitBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "process_memory_limit_bytes"), prometheus.BuildFQName(types.Namespace, Name, "process_memory_limit_bytes"),
"OperatingSystem.MaxProcessMemorySize", "OperatingSystem.MaxProcessMemorySize",
nil, nil,
nil, nil,
) )
c.Users = prometheus.NewDesc( c.users = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "users"), prometheus.BuildFQName(types.Namespace, Name, "users"),
"OperatingSystem.NumberOfUsers", "OperatingSystem.NumberOfUsers",
nil, nil,
nil, nil,
) )
c.VirtualMemoryBytes = prometheus.NewDesc( c.virtualMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_memory_bytes"), prometheus.BuildFQName(types.Namespace, Name, "virtual_memory_bytes"),
"OperatingSystem.TotalVirtualMemorySize", "OperatingSystem.TotalVirtualMemorySize",
nil, nil,
nil, nil,
) )
c.VisibleMemoryBytes = prometheus.NewDesc( c.visibleMemoryBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "visible_memory_bytes"), prometheus.BuildFQName(types.Namespace, Name, "visible_memory_bytes"),
"OperatingSystem.TotalVisibleMemorySize", "OperatingSystem.TotalVisibleMemorySize",
nil, nil,
nil, nil,
) )
c.VirtualMemoryFreeBytes = prometheus.NewDesc( c.virtualMemoryFreeBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_memory_free_bytes"), prometheus.BuildFQName(types.Namespace, Name, "virtual_memory_free_bytes"),
"OperatingSystem.FreeVirtualMemory", "OperatingSystem.FreeVirtualMemory",
nil, nil,
@@ -282,7 +282,7 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
pfb := fsipf - (pfbRaw * float64(gpi.PageSize)) pfb := fsipf - (pfbRaw * float64(gpi.PageSize))
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OSInformation, c.osInformation,
prometheus.GaugeValue, prometheus.GaugeValue,
1.0, 1.0,
"Microsoft "+pn, // Caption "Microsoft "+pn, // Caption
@@ -294,19 +294,19 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PhysicalMemoryFreeBytes, c.physicalMemoryFreeBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(gmse.AvailPhys), float64(gmse.AvailPhys),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Time, c.time,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(currentTime.Unix()), float64(currentTime.Unix()),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Timezone, c.timezone,
prometheus.GaugeValue, prometheus.GaugeValue,
1.0, 1.0,
timezoneName, timezoneName,
@@ -314,13 +314,13 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
if pagingErr == nil { if pagingErr == nil {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PagingFreeBytes, c.pagingFreeBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
pfb, pfb,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PagingLimitBytes, c.pagingLimitBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
fsipf, fsipf,
) )
@@ -328,7 +328,7 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
_ = level.Debug(c.logger).Log("msg", "Could not find HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management key. windows_os_paging_free_bytes and windows_os_paging_limit_bytes will be omitted.") _ = level.Debug(c.logger).Log("msg", "Could not find HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management key. windows_os_paging_free_bytes and windows_os_paging_limit_bytes will be omitted.")
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.VirtualMemoryFreeBytes, c.virtualMemoryFreeBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(gmse.AvailPageFile), float64(gmse.AvailPageFile),
) )
@@ -337,37 +337,37 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
// https://techcommunity.microsoft.com/t5/windows-blog-archive/pushing-the-limits-of-windows-processes-and-threads/ba-p/723824 // https://techcommunity.microsoft.com/t5/windows-blog-archive/pushing-the-limits-of-windows-processes-and-threads/ba-p/723824
// https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ProcessesLimit, c.processesLimit,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(4294967295), float64(4294967295),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ProcessMemoryLimitBytes, c.processMemoryLimitBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(gmse.TotalVirtual), float64(gmse.TotalVirtual),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Processes, c.processes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(gpi.ProcessCount), float64(gpi.ProcessCount),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Users, c.users,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(nwgi.LoggedOnUsers), float64(nwgi.LoggedOnUsers),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.VirtualMemoryBytes, c.virtualMemoryBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(gmse.TotalPageFile), float64(gmse.TotalPageFile),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.VisibleMemoryBytes, c.visibleMemoryBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(gmse.TotalPhys), float64(gmse.TotalPhys),
) )

View File

@@ -37,21 +37,21 @@ type Collector struct {
diskIncludeSet bool diskIncludeSet bool
diskExcludeSet bool diskExcludeSet bool
RequestsQueued *prometheus.Desc
ReadBytesTotal *prometheus.Desc
ReadsTotal *prometheus.Desc
WriteBytesTotal *prometheus.Desc
WritesTotal *prometheus.Desc
ReadTime *prometheus.Desc
WriteTime *prometheus.Desc
IdleTime *prometheus.Desc
SplitIOs *prometheus.Desc
ReadLatency *prometheus.Desc
WriteLatency *prometheus.Desc
ReadWriteLatency *prometheus.Desc
diskIncludePattern *regexp.Regexp diskIncludePattern *regexp.Regexp
diskExcludePattern *regexp.Regexp diskExcludePattern *regexp.Regexp
idleTime *prometheus.Desc
readBytesTotal *prometheus.Desc
readLatency *prometheus.Desc
readTime *prometheus.Desc
readWriteLatency *prometheus.Desc
readsTotal *prometheus.Desc
requestsQueued *prometheus.Desc
splitIOs *prometheus.Desc
writeBytesTotal *prometheus.Desc
writeLatency *prometheus.Desc
writeTime *prometheus.Desc
writesTotal *prometheus.Desc
} }
func New(logger log.Logger, config *Config) *Collector { func New(logger log.Logger, config *Config) *Collector {
@@ -107,84 +107,84 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.RequestsQueued = prometheus.NewDesc( c.requestsQueued = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "requests_queued"), prometheus.BuildFQName(types.Namespace, Name, "requests_queued"),
"The number of requests queued to the disk (PhysicalDisk.CurrentDiskQueueLength)", "The number of requests queued to the disk (PhysicalDisk.CurrentDiskQueueLength)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.ReadBytesTotal = prometheus.NewDesc( c.readBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "read_bytes_total"),
"The number of bytes transferred from the disk during read operations (PhysicalDisk.DiskReadBytesPerSec)", "The number of bytes transferred from the disk during read operations (PhysicalDisk.DiskReadBytesPerSec)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.ReadsTotal = prometheus.NewDesc( c.readsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "reads_total"), prometheus.BuildFQName(types.Namespace, Name, "reads_total"),
"The number of read operations on the disk (PhysicalDisk.DiskReadsPerSec)", "The number of read operations on the disk (PhysicalDisk.DiskReadsPerSec)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.WriteBytesTotal = prometheus.NewDesc( c.writeBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "write_bytes_total"),
"The number of bytes transferred to the disk during write operations (PhysicalDisk.DiskWriteBytesPerSec)", "The number of bytes transferred to the disk during write operations (PhysicalDisk.DiskWriteBytesPerSec)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.WritesTotal = prometheus.NewDesc( c.writesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "writes_total"), prometheus.BuildFQName(types.Namespace, Name, "writes_total"),
"The number of write operations on the disk (PhysicalDisk.DiskWritesPerSec)", "The number of write operations on the disk (PhysicalDisk.DiskWritesPerSec)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.ReadTime = prometheus.NewDesc( c.readTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "read_seconds_total"),
"Seconds that the disk was busy servicing read requests (PhysicalDisk.PercentDiskReadTime)", "Seconds that the disk was busy servicing read requests (PhysicalDisk.PercentDiskReadTime)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.WriteTime = prometheus.NewDesc( c.writeTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "write_seconds_total"),
"Seconds that the disk was busy servicing write requests (PhysicalDisk.PercentDiskWriteTime)", "Seconds that the disk was busy servicing write requests (PhysicalDisk.PercentDiskWriteTime)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.IdleTime = prometheus.NewDesc( c.idleTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "idle_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "idle_seconds_total"),
"Seconds that the disk was idle (PhysicalDisk.PercentIdleTime)", "Seconds that the disk was idle (PhysicalDisk.PercentIdleTime)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.SplitIOs = prometheus.NewDesc( c.splitIOs = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "split_ios_total"), prometheus.BuildFQName(types.Namespace, Name, "split_ios_total"),
"The number of I/Os to the disk were split into multiple I/Os (PhysicalDisk.SplitIOPerSec)", "The number of I/Os to the disk were split into multiple I/Os (PhysicalDisk.SplitIOPerSec)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.ReadLatency = prometheus.NewDesc( c.readLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "read_latency_seconds_total"),
"Shows the average time, in seconds, of a read operation from the disk (PhysicalDisk.AvgDiskSecPerRead)", "Shows the average time, in seconds, of a read operation from the disk (PhysicalDisk.AvgDiskSecPerRead)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.WriteLatency = prometheus.NewDesc( c.writeLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "write_latency_seconds_total"),
"Shows the average time, in seconds, of a write operation to the disk (PhysicalDisk.AvgDiskSecPerWrite)", "Shows the average time, in seconds, of a write operation to the disk (PhysicalDisk.AvgDiskSecPerWrite)",
[]string{"disk"}, []string{"disk"},
nil, nil,
) )
c.ReadWriteLatency = prometheus.NewDesc( c.readWriteLatency = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "read_write_latency_seconds_total"),
"Shows the time, in seconds, of the average disk transfer (PhysicalDisk.AvgDiskSecPerTransfer)", "Shows the time, in seconds, of the average disk transfer (PhysicalDisk.AvgDiskSecPerTransfer)",
[]string{"disk"}, []string{"disk"},
@@ -252,84 +252,84 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
disk_number, _, _ := strings.Cut(disk.Name, " ") disk_number, _, _ := strings.Cut(disk.Name, " ")
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RequestsQueued, c.requestsQueued,
prometheus.GaugeValue, prometheus.GaugeValue,
disk.CurrentDiskQueueLength, disk.CurrentDiskQueueLength,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadBytesTotal, c.readBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
disk.DiskReadBytesPerSec, disk.DiskReadBytesPerSec,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadsTotal, c.readsTotal,
prometheus.CounterValue, prometheus.CounterValue,
disk.DiskReadsPerSec, disk.DiskReadsPerSec,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteBytesTotal, c.writeBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
disk.DiskWriteBytesPerSec, disk.DiskWriteBytesPerSec,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WritesTotal, c.writesTotal,
prometheus.CounterValue, prometheus.CounterValue,
disk.DiskWritesPerSec, disk.DiskWritesPerSec,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadTime, c.readTime,
prometheus.CounterValue, prometheus.CounterValue,
disk.PercentDiskReadTime, disk.PercentDiskReadTime,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteTime, c.writeTime,
prometheus.CounterValue, prometheus.CounterValue,
disk.PercentDiskWriteTime, disk.PercentDiskWriteTime,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IdleTime, c.idleTime,
prometheus.CounterValue, prometheus.CounterValue,
disk.PercentIdleTime, disk.PercentIdleTime,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SplitIOs, c.splitIOs,
prometheus.CounterValue, prometheus.CounterValue,
disk.SplitIOPerSec, disk.SplitIOPerSec,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadLatency, c.readLatency,
prometheus.CounterValue, prometheus.CounterValue,
disk.AvgDiskSecPerRead*perflib.TicksToSecondScaleFactor, disk.AvgDiskSecPerRead*perflib.TicksToSecondScaleFactor,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteLatency, c.writeLatency,
prometheus.CounterValue, prometheus.CounterValue,
disk.AvgDiskSecPerWrite*perflib.TicksToSecondScaleFactor, disk.AvgDiskSecPerWrite*perflib.TicksToSecondScaleFactor,
disk_number, disk_number,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadWriteLatency, c.readWriteLatency,
prometheus.CounterValue, prometheus.CounterValue,
disk.AvgDiskSecPerTransfer*perflib.TicksToSecondScaleFactor, disk.AvgDiskSecPerTransfer*perflib.TicksToSecondScaleFactor,
disk_number, disk_number,

View File

@@ -0,0 +1,12 @@
package physical_disk_test
import (
"testing"
"github.com/prometheus-community/windows_exporter/pkg/collector/physical_disk"
"github.com/prometheus-community/windows_exporter/pkg/testutils"
)
func BenchmarkCollector(b *testing.B) {
testutils.FuncBenchmarkCollector(b, physical_disk.Name, physical_disk.NewWithFlags)
}

View File

@@ -40,32 +40,32 @@ var ConfigDefaults = Config{
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
processInclude *string
processExclude *string
enableWorkerProcess *bool enableWorkerProcess *bool
enableReportOwner *bool enableReportOwner *bool
StartTime *prometheus.Desc processInclude *string
CPUTimeTotal *prometheus.Desc processExclude *string
HandleCount *prometheus.Desc
IOBytesTotal *prometheus.Desc
IOOperationsTotal *prometheus.Desc
PageFaultsTotal *prometheus.Desc
PageFileBytes *prometheus.Desc
PoolBytes *prometheus.Desc
PriorityBase *prometheus.Desc
PrivateBytes *prometheus.Desc
ThreadCount *prometheus.Desc
VirtualBytes *prometheus.Desc
WorkingSetPrivate *prometheus.Desc
WorkingSetPeak *prometheus.Desc
WorkingSet *prometheus.Desc
processIncludePattern *regexp.Regexp processIncludePattern *regexp.Regexp
processExcludePattern *regexp.Regexp processExcludePattern *regexp.Regexp
lookupCache map[string]string lookupCache map[string]string
cpuTimeTotal *prometheus.Desc
handleCount *prometheus.Desc
ioBytesTotal *prometheus.Desc
ioOperationsTotal *prometheus.Desc
pageFaultsTotal *prometheus.Desc
pageFileBytes *prometheus.Desc
poolBytes *prometheus.Desc
priorityBase *prometheus.Desc
privateBytes *prometheus.Desc
startTime *prometheus.Desc
threadCount *prometheus.Desc
virtualBytes *prometheus.Desc
workingSet *prometheus.Desc
workingSetPeak *prometheus.Desc
workingSetPrivate *prometheus.Desc
} }
func New(logger log.Logger, config *Config) *Collector { func New(logger log.Logger, config *Config) *Collector {
@@ -134,91 +134,91 @@ func (c *Collector) Build() error {
commonLabels = []string{"owner"} commonLabels = []string{"owner"}
} }
c.StartTime = prometheus.NewDesc( c.startTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "start_time"), prometheus.BuildFQName(types.Namespace, Name, "start_time"),
"Time of process start.", "Time of process start.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.CPUTimeTotal = prometheus.NewDesc( c.cpuTimeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_time_total"), prometheus.BuildFQName(types.Namespace, Name, "cpu_time_total"),
"Returns elapsed time that all of the threads of this process used the processor to execute instructions by mode (privileged, user).", "Returns elapsed time that all of the threads of this process used the processor to execute instructions by mode (privileged, user).",
append(commonLabels, "process", "process_id", "creating_process_id", "mode"), append(commonLabels, "process", "process_id", "creating_process_id", "mode"),
nil, nil,
) )
c.HandleCount = prometheus.NewDesc( c.handleCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "handles"), prometheus.BuildFQName(types.Namespace, Name, "handles"),
"Total number of handles the process has open. This number is the sum of the handles currently open by each thread in the process.", "Total number of handles the process has open. This number is the sum of the handles currently open by each thread in the process.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.IOBytesTotal = prometheus.NewDesc( c.ioBytesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "io_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "io_bytes_total"),
"Bytes issued to I/O operations in different modes (read, write, other).", "Bytes issued to I/O operations in different modes (read, write, other).",
append(commonLabels, "process", "process_id", "creating_process_id", "mode"), append(commonLabels, "process", "process_id", "creating_process_id", "mode"),
nil, nil,
) )
c.IOOperationsTotal = prometheus.NewDesc( c.ioOperationsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "io_operations_total"), prometheus.BuildFQName(types.Namespace, Name, "io_operations_total"),
"I/O operations issued in different modes (read, write, other).", "I/O operations issued in different modes (read, write, other).",
append(commonLabels, "process", "process_id", "creating_process_id", "mode"), append(commonLabels, "process", "process_id", "creating_process_id", "mode"),
nil, nil,
) )
c.PageFaultsTotal = prometheus.NewDesc( c.pageFaultsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_faults_total"), prometheus.BuildFQName(types.Namespace, Name, "page_faults_total"),
"Page faults by the threads executing in this process.", "Page faults by the threads executing in this process.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.PageFileBytes = prometheus.NewDesc( c.pageFileBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes"), prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes"),
"Current number of bytes this process has used in the paging file(s).", "Current number of bytes this process has used in the paging file(s).",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.PoolBytes = prometheus.NewDesc( c.poolBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_bytes"), prometheus.BuildFQName(types.Namespace, Name, "pool_bytes"),
"Pool Bytes is the last observed number of bytes in the paged or nonpaged pool.", "Pool Bytes is the last observed number of bytes in the paged or nonpaged pool.",
append(commonLabels, "process", "process_id", "creating_process_id", "pool"), append(commonLabels, "process", "process_id", "creating_process_id", "pool"),
nil, nil,
) )
c.PriorityBase = prometheus.NewDesc( c.priorityBase = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "priority_base"), prometheus.BuildFQName(types.Namespace, Name, "priority_base"),
"Current base priority of this process. Threads within a process can raise and lower their own base priority relative to the process base priority of the process.", "Current base priority of this process. Threads within a process can raise and lower their own base priority relative to the process base priority of the process.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.PrivateBytes = prometheus.NewDesc( c.privateBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "private_bytes"), prometheus.BuildFQName(types.Namespace, Name, "private_bytes"),
"Current number of bytes this process has allocated that cannot be shared with other processes.", "Current number of bytes this process has allocated that cannot be shared with other processes.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.ThreadCount = prometheus.NewDesc( c.threadCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "threads"), prometheus.BuildFQName(types.Namespace, Name, "threads"),
"Number of threads currently active in this process.", "Number of threads currently active in this process.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.VirtualBytes = prometheus.NewDesc( c.virtualBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes"), prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes"),
"Current size, in bytes, of the virtual address space that the process is using.", "Current size, in bytes, of the virtual address space that the process is using.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.WorkingSetPrivate = prometheus.NewDesc( c.workingSetPrivate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_private_bytes"), prometheus.BuildFQName(types.Namespace, Name, "working_set_private_bytes"),
"Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes.", "Size of the working set, in bytes, that is use for this process only and not shared nor shareable by other processes.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.WorkingSetPeak = prometheus.NewDesc( c.workingSetPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_peak_bytes"), prometheus.BuildFQName(types.Namespace, Name, "working_set_peak_bytes"),
"Maximum size, in bytes, of the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process.", "Maximum size, in bytes, of the Working Set of this process at any point in time. The Working Set is the set of memory pages touched recently by the threads in the process.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
nil, nil,
) )
c.WorkingSet = prometheus.NewDesc( c.workingSet = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes"), prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes"),
"Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process.", "Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process.",
append(commonLabels, "process", "process_id", "creating_process_id"), append(commonLabels, "process", "process_id", "creating_process_id"),
@@ -330,147 +330,147 @@ func (c *Collector) Collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
labels = append(labels, processName, pid, cpid) labels = append(labels, processName, pid, cpid)
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.StartTime, c.startTime,
prometheus.GaugeValue, prometheus.GaugeValue,
process.ElapsedTime, process.ElapsedTime,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HandleCount, c.handleCount,
prometheus.GaugeValue, prometheus.GaugeValue,
process.HandleCount, process.HandleCount,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CPUTimeTotal, c.cpuTimeTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.PercentPrivilegedTime, process.PercentPrivilegedTime,
append(labels, "privileged")..., append(labels, "privileged")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CPUTimeTotal, c.cpuTimeTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.PercentUserTime, process.PercentUserTime,
append(labels, "user")..., append(labels, "user")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IOBytesTotal, c.ioBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.IOOtherBytesPerSec, process.IOOtherBytesPerSec,
append(labels, "other")..., append(labels, "other")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IOOperationsTotal, c.ioOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.IOOtherOperationsPerSec, process.IOOtherOperationsPerSec,
append(labels, "other")..., append(labels, "other")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IOBytesTotal, c.ioBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.IOReadBytesPerSec, process.IOReadBytesPerSec,
append(labels, "read")..., append(labels, "read")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IOOperationsTotal, c.ioOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.IOReadOperationsPerSec, process.IOReadOperationsPerSec,
append(labels, "read")..., append(labels, "read")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IOBytesTotal, c.ioBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.IOWriteBytesPerSec, process.IOWriteBytesPerSec,
append(labels, "write")..., append(labels, "write")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.IOOperationsTotal, c.ioOperationsTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.IOWriteOperationsPerSec, process.IOWriteOperationsPerSec,
append(labels, "write")..., append(labels, "write")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PageFaultsTotal, c.pageFaultsTotal,
prometheus.CounterValue, prometheus.CounterValue,
process.PageFaultsPerSec, process.PageFaultsPerSec,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PageFileBytes, c.pageFileBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
process.PageFileBytes, process.PageFileBytes,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolBytes, c.poolBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
process.PoolNonpagedBytes, process.PoolNonpagedBytes,
append(labels, "nonpaged")..., append(labels, "nonpaged")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolBytes, c.poolBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
process.PoolPagedBytes, process.PoolPagedBytes,
append(labels, "paged")..., append(labels, "paged")...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PriorityBase, c.priorityBase,
prometheus.GaugeValue, prometheus.GaugeValue,
process.PriorityBase, process.PriorityBase,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PrivateBytes, c.privateBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
process.PrivateBytes, process.PrivateBytes,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ThreadCount, c.threadCount,
prometheus.GaugeValue, prometheus.GaugeValue,
process.ThreadCount, process.ThreadCount,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.VirtualBytes, c.virtualBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
process.VirtualBytes, process.VirtualBytes,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WorkingSetPrivate, c.workingSetPrivate,
prometheus.GaugeValue, prometheus.GaugeValue,
process.WorkingSetPrivate, process.WorkingSetPrivate,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WorkingSetPeak, c.workingSetPeak,
prometheus.GaugeValue, prometheus.GaugeValue,
process.WorkingSetPeak, process.WorkingSetPeak,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WorkingSet, c.workingSet,
prometheus.GaugeValue, prometheus.GaugeValue,
process.WorkingSet, process.WorkingSet,
labels..., labels...,

View File

@@ -29,28 +29,28 @@ type Collector struct {
logger log.Logger logger log.Logger
// net // net
BaseTCPRTT *prometheus.Desc baseTCPRTT *prometheus.Desc
BaseUDPRTT *prometheus.Desc baseUDPRTT *prometheus.Desc
CurrentTCPBandwidth *prometheus.Desc currentTCPBandwidth *prometheus.Desc
CurrentTCPRTT *prometheus.Desc currentTCPRTT *prometheus.Desc
CurrentUDPBandwidth *prometheus.Desc currentUDPBandwidth *prometheus.Desc
CurrentUDPRTT *prometheus.Desc currentUDPRTT *prometheus.Desc
TotalReceivedBytes *prometheus.Desc fecRate *prometheus.Desc
TotalSentBytes *prometheus.Desc lossRate *prometheus.Desc
UDPPacketsReceivedPersec *prometheus.Desc retransmissionRate *prometheus.Desc
UDPPacketsSentPersec *prometheus.Desc totalReceivedBytes *prometheus.Desc
FECRate *prometheus.Desc totalSentBytes *prometheus.Desc
LossRate *prometheus.Desc udpPacketsReceivedPerSec *prometheus.Desc
RetransmissionRate *prometheus.Desc udpPacketsSentPerSec *prometheus.Desc
// gfx // gfx
AverageEncodingTime *prometheus.Desc averageEncodingTime *prometheus.Desc
FrameQuality *prometheus.Desc frameQuality *prometheus.Desc
FramesSkippedPerSecondInsufficientResources *prometheus.Desc framesSkippedPerSecondInsufficientResources *prometheus.Desc
GraphicsCompressionratio *prometheus.Desc graphicsCompressionRatio *prometheus.Desc
InputFramesPerSecond *prometheus.Desc inputFramesPerSecond *prometheus.Desc
OutputFramesPerSecond *prometheus.Desc outputFramesPerSecond *prometheus.Desc
SourceFramesPerSecond *prometheus.Desc sourceFramesPerSecond *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -82,79 +82,79 @@ func (c *Collector) Close() error {
func (c *Collector) Build() error { func (c *Collector) Build() error {
// net // net
c.BaseTCPRTT = prometheus.NewDesc( c.baseTCPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_base_tcp_rtt_seconds"), prometheus.BuildFQName(types.Namespace, Name, "net_base_tcp_rtt_seconds"),
"Base TCP round-trip time (RTT) detected in seconds", "Base TCP round-trip time (RTT) detected in seconds",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.BaseUDPRTT = prometheus.NewDesc( c.baseUDPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_base_udp_rtt_seconds"), prometheus.BuildFQName(types.Namespace, Name, "net_base_udp_rtt_seconds"),
"Base UDP round-trip time (RTT) detected in seconds.", "Base UDP round-trip time (RTT) detected in seconds.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.CurrentTCPBandwidth = prometheus.NewDesc( c.currentTCPBandwidth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_tcp_bandwidth"), prometheus.BuildFQName(types.Namespace, Name, "net_current_tcp_bandwidth"),
"TCP Bandwidth detected in bytes per second.", "TCP Bandwidth detected in bytes per second.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.CurrentTCPRTT = prometheus.NewDesc( c.currentTCPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_tcp_rtt_seconds"), prometheus.BuildFQName(types.Namespace, Name, "net_current_tcp_rtt_seconds"),
"Average TCP round-trip time (RTT) detected in seconds.", "Average TCP round-trip time (RTT) detected in seconds.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.CurrentUDPBandwidth = prometheus.NewDesc( c.currentUDPBandwidth = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_udp_bandwidth"), prometheus.BuildFQName(types.Namespace, Name, "net_current_udp_bandwidth"),
"UDP Bandwidth detected in bytes per second.", "UDP Bandwidth detected in bytes per second.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.CurrentUDPRTT = prometheus.NewDesc( c.currentUDPRTT = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_current_udp_rtt_seconds"), prometheus.BuildFQName(types.Namespace, Name, "net_current_udp_rtt_seconds"),
"Average UDP round-trip time (RTT) detected in seconds.", "Average UDP round-trip time (RTT) detected in seconds.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.TotalReceivedBytes = prometheus.NewDesc( c.totalReceivedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_received_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "net_received_bytes_total"),
"(TotalReceivedBytes)", "(TotalReceivedBytes)",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.TotalSentBytes = prometheus.NewDesc( c.totalSentBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_sent_bytes_total"), prometheus.BuildFQName(types.Namespace, Name, "net_sent_bytes_total"),
"(TotalSentBytes)", "(TotalSentBytes)",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.UDPPacketsReceivedPersec = prometheus.NewDesc( c.udpPacketsReceivedPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_udp_packets_received_total"), prometheus.BuildFQName(types.Namespace, Name, "net_udp_packets_received_total"),
"Rate in packets per second at which packets are received over UDP.", "Rate in packets per second at which packets are received over UDP.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.UDPPacketsSentPersec = prometheus.NewDesc( c.udpPacketsSentPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_udp_packets_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "net_udp_packets_sent_total"),
"Rate in packets per second at which packets are sent over UDP.", "Rate in packets per second at which packets are sent over UDP.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.FECRate = prometheus.NewDesc( c.fecRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_fec_rate"), prometheus.BuildFQName(types.Namespace, Name, "net_fec_rate"),
"Forward Error Correction (FEC) percentage", "Forward Error Correction (FEC) percentage",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.LossRate = prometheus.NewDesc( c.lossRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_loss_rate"), prometheus.BuildFQName(types.Namespace, Name, "net_loss_rate"),
"Loss percentage", "Loss percentage",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.RetransmissionRate = prometheus.NewDesc( c.retransmissionRate = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "net_retransmission_rate"), prometheus.BuildFQName(types.Namespace, Name, "net_retransmission_rate"),
"Percentage of packets that have been retransmitted", "Percentage of packets that have been retransmitted",
[]string{"session_name"}, []string{"session_name"},
@@ -162,43 +162,43 @@ func (c *Collector) Build() error {
) )
// gfx // gfx
c.AverageEncodingTime = prometheus.NewDesc( c.averageEncodingTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_average_encoding_time_seconds"), prometheus.BuildFQName(types.Namespace, Name, "gfx_average_encoding_time_seconds"),
"Average frame encoding time in seconds", "Average frame encoding time in seconds",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.FrameQuality = prometheus.NewDesc( c.frameQuality = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_frame_quality"), prometheus.BuildFQName(types.Namespace, Name, "gfx_frame_quality"),
"Quality of the output frame expressed as a percentage of the quality of the source frame.", "Quality of the output frame expressed as a percentage of the quality of the source frame.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.FramesSkippedPerSecondInsufficientResources = prometheus.NewDesc( c.framesSkippedPerSecondInsufficientResources = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_frames_skipped_insufficient_resource_total"), prometheus.BuildFQName(types.Namespace, Name, "gfx_frames_skipped_insufficient_resource_total"),
"Number of frames skipped per second due to insufficient client resources.", "Number of frames skipped per second due to insufficient client resources.",
[]string{"session_name", "resource"}, []string{"session_name", "resource"},
nil, nil,
) )
c.GraphicsCompressionratio = prometheus.NewDesc( c.graphicsCompressionRatio = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_graphics_compression_ratio"), prometheus.BuildFQName(types.Namespace, Name, "gfx_graphics_compression_ratio"),
"Ratio of the number of bytes encoded to the number of bytes input.", "Ratio of the number of bytes encoded to the number of bytes input.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.InputFramesPerSecond = prometheus.NewDesc( c.inputFramesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_input_frames_total"), prometheus.BuildFQName(types.Namespace, Name, "gfx_input_frames_total"),
"Number of sources frames provided as input to RemoteFX graphics per second.", "Number of sources frames provided as input to RemoteFX graphics per second.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.OutputFramesPerSecond = prometheus.NewDesc( c.outputFramesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_output_frames_total"), prometheus.BuildFQName(types.Namespace, Name, "gfx_output_frames_total"),
"Number of frames sent to the client per second.", "Number of frames sent to the client per second.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.SourceFramesPerSecond = prometheus.NewDesc( c.sourceFramesPerSecond = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "gfx_source_frames_total"), prometheus.BuildFQName(types.Namespace, Name, "gfx_source_frames_total"),
"Number of frames composed by the source (DWM) per second.", "Number of frames composed by the source (DWM) per second.",
[]string{"session_name"}, []string{"session_name"},
@@ -252,81 +252,81 @@ func (c *Collector) collectRemoteFXNetworkCount(ctx *types.ScrapeContext, ch cha
continue continue
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BaseTCPRTT, c.baseTCPRTT,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(d.BaseTCPRTT), utils.MilliSecToSec(d.BaseTCPRTT),
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BaseUDPRTT, c.baseUDPRTT,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(d.BaseUDPRTT), utils.MilliSecToSec(d.BaseUDPRTT),
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentTCPBandwidth, c.currentTCPBandwidth,
prometheus.GaugeValue, prometheus.GaugeValue,
(d.CurrentTCPBandwidth*1000)/8, (d.CurrentTCPBandwidth*1000)/8,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentTCPRTT, c.currentTCPRTT,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(d.CurrentTCPRTT), utils.MilliSecToSec(d.CurrentTCPRTT),
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentUDPBandwidth, c.currentUDPBandwidth,
prometheus.GaugeValue, prometheus.GaugeValue,
(d.CurrentUDPBandwidth*1000)/8, (d.CurrentUDPBandwidth*1000)/8,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentUDPRTT, c.currentUDPRTT,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(d.CurrentUDPRTT), utils.MilliSecToSec(d.CurrentUDPRTT),
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalReceivedBytes, c.totalReceivedBytes,
prometheus.CounterValue, prometheus.CounterValue,
d.TotalReceivedBytes, d.TotalReceivedBytes,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TotalSentBytes, c.totalSentBytes,
prometheus.CounterValue, prometheus.CounterValue,
d.TotalSentBytes, d.TotalSentBytes,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.UDPPacketsReceivedPersec, c.udpPacketsReceivedPerSec,
prometheus.CounterValue, prometheus.CounterValue,
d.UDPPacketsReceivedPersec, d.UDPPacketsReceivedPersec,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.UDPPacketsSentPersec, c.udpPacketsSentPerSec,
prometheus.CounterValue, prometheus.CounterValue,
d.UDPPacketsSentPersec, d.UDPPacketsSentPersec,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FECRate, c.fecRate,
prometheus.GaugeValue, prometheus.GaugeValue,
d.FECRate, d.FECRate,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LossRate, c.lossRate,
prometheus.GaugeValue, prometheus.GaugeValue,
d.LossRate, d.LossRate,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RetransmissionRate, c.retransmissionRate,
prometheus.GaugeValue, prometheus.GaugeValue,
d.RetransmissionRate, d.RetransmissionRate,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
@@ -362,58 +362,58 @@ func (c *Collector) collectRemoteFXGraphicsCounters(ctx *types.ScrapeContext, ch
continue continue
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AverageEncodingTime, c.averageEncodingTime,
prometheus.GaugeValue, prometheus.GaugeValue,
utils.MilliSecToSec(d.AverageEncodingTime), utils.MilliSecToSec(d.AverageEncodingTime),
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FrameQuality, c.frameQuality,
prometheus.GaugeValue, prometheus.GaugeValue,
d.FrameQuality, d.FrameQuality,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FramesSkippedPerSecondInsufficientResources, c.framesSkippedPerSecondInsufficientResources,
prometheus.CounterValue, prometheus.CounterValue,
d.FramesSkippedPerSecondInsufficientClientResources, d.FramesSkippedPerSecondInsufficientClientResources,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
"client", "client",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FramesSkippedPerSecondInsufficientResources, c.framesSkippedPerSecondInsufficientResources,
prometheus.CounterValue, prometheus.CounterValue,
d.FramesSkippedPerSecondInsufficientNetworkResources, d.FramesSkippedPerSecondInsufficientNetworkResources,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
"network", "network",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.FramesSkippedPerSecondInsufficientResources, c.framesSkippedPerSecondInsufficientResources,
prometheus.CounterValue, prometheus.CounterValue,
d.FramesSkippedPerSecondInsufficientServerResources, d.FramesSkippedPerSecondInsufficientServerResources,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
"server", "server",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.GraphicsCompressionratio, c.graphicsCompressionRatio,
prometheus.GaugeValue, prometheus.GaugeValue,
d.GraphicsCompressionratio, d.GraphicsCompressionratio,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.InputFramesPerSecond, c.inputFramesPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
d.InputFramesPerSecond, d.InputFramesPerSecond,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OutputFramesPerSecond, c.outputFramesPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
d.OutputFramesPerSecond, d.OutputFramesPerSecond,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SourceFramesPerSecond, c.sourceFramesPerSecond,
prometheus.CounterValue, prometheus.CounterValue,
d.SourceFramesPerSecond, d.SourceFramesPerSecond,
normalizeSessionName(d.Name), normalizeSessionName(d.Name),

View File

@@ -41,9 +41,9 @@ type Collector struct {
taskExclude *string taskExclude *string
taskInclude *string taskInclude *string
LastResult *prometheus.Desc lastResult *prometheus.Desc
MissedRuns *prometheus.Desc missedRuns *prometheus.Desc
State *prometheus.Desc state *prometheus.Desc
taskIncludePattern *regexp.Regexp taskIncludePattern *regexp.Regexp
taskExcludePattern *regexp.Regexp taskExcludePattern *regexp.Regexp
@@ -122,21 +122,21 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.LastResult = prometheus.NewDesc( c.lastResult = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "last_result"), prometheus.BuildFQName(types.Namespace, Name, "last_result"),
"The result that was returned the last time the registered task was run", "The result that was returned the last time the registered task was run",
[]string{"task"}, []string{"task"},
nil, nil,
) )
c.MissedRuns = prometheus.NewDesc( c.missedRuns = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "missed_runs"), prometheus.BuildFQName(types.Namespace, Name, "missed_runs"),
"The number of times the registered task missed a scheduled run", "The number of times the registered task missed a scheduled run",
[]string{"task"}, []string{"task"},
nil, nil,
) )
c.State = prometheus.NewDesc( c.state = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "state"), prometheus.BuildFQName(types.Namespace, Name, "state"),
"The current state of a scheduled task", "The current state of a scheduled task",
[]string{"task", "state"}, []string{"task", "state"},
@@ -187,14 +187,14 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LastResult, c.lastResult,
prometheus.GaugeValue, prometheus.GaugeValue,
lastResult, lastResult,
task.Path, task.Path,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MissedRuns, c.missedRuns,
prometheus.GaugeValue, prometheus.GaugeValue,
task.MissedRunsCount, task.MissedRunsCount,
task.Path, task.Path,
@@ -208,7 +208,7 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.State, c.state,
prometheus.GaugeValue, prometheus.GaugeValue,
stateValue, stateValue,
task.Path, task.Path,

View File

@@ -31,34 +31,33 @@ var ConfigDefaults = Config{
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
smbclientListAllCollectors *bool
smbclientCollectorsEnabled *string
ReadRequestQueueSecsTotal *prometheus.Desc
ReadBytesTotal *prometheus.Desc
ReadsTotal *prometheus.Desc
ReadBytesTransmittedViaSMBDirectTotal *prometheus.Desc
ReadRequestsTransmittedViaSMBDirectTotal *prometheus.Desc
TurboIOReadsTotal *prometheus.Desc
ReadSecsTotal *prometheus.Desc
WriteRequestQueueSecsTotal *prometheus.Desc
WriteBytesTotal *prometheus.Desc
WritesTotal *prometheus.Desc
WriteBytesTransmittedViaSMBDirectTotal *prometheus.Desc
WriteRequestsTransmittedViaSMBDirectTotal *prometheus.Desc
TurboIOWritesTotal *prometheus.Desc
WriteSecsTotal *prometheus.Desc
RequestQueueSecsTotal *prometheus.Desc
RequestSecs *prometheus.Desc
CreditStallsTotal *prometheus.Desc
CurrentDataQueued *prometheus.Desc
DataBytesTotal *prometheus.Desc
DataRequestsTotal *prometheus.Desc
MetadataRequestsTotal *prometheus.Desc
enabledCollectors []string enabledCollectors []string
smbClientListAllCollectors *bool
smbClientCollectorsEnabled *string
readBytesTotal *prometheus.Desc
readBytesTransmittedViaSMBDirectTotal *prometheus.Desc
readRequestQueueSecsTotal *prometheus.Desc
readRequestsTransmittedViaSMBDirectTotal *prometheus.Desc
readSecsTotal *prometheus.Desc
readsTotal *prometheus.Desc
turboIOReadsTotal *prometheus.Desc
TurboIOWritesTotal *prometheus.Desc
writeBytesTotal *prometheus.Desc
writeBytesTransmittedViaSMBDirectTotal *prometheus.Desc
writeRequestQueueSecsTotal *prometheus.Desc
writeRequestsTransmittedViaSMBDirectTotal *prometheus.Desc
writeSecsTotal *prometheus.Desc
writesTotal *prometheus.Desc
creditStallsTotal *prometheus.Desc
currentDataQueued *prometheus.Desc
dataBytesTotal *prometheus.Desc
dataRequestsTotal *prometheus.Desc
metadataRequestsTotal *prometheus.Desc
requestQueueSecsTotal *prometheus.Desc
requestSecs *prometheus.Desc
} }
// All available collector functions // All available collector functions
@@ -73,8 +72,8 @@ func New(logger log.Logger, config *Config) *Collector {
smbclientListAllCollectors := false smbclientListAllCollectors := false
c := &Collector{ c := &Collector{
smbclientCollectorsEnabled: &config.CollectorsEnabled, smbClientCollectorsEnabled: &config.CollectorsEnabled,
smbclientListAllCollectors: &smbclientListAllCollectors, smbClientListAllCollectors: &smbclientListAllCollectors,
} }
c.SetLogger(logger) c.SetLogger(logger)
@@ -83,12 +82,12 @@ func New(logger log.Logger, config *Config) *Collector {
func NewWithFlags(app *kingpin.Application) *Collector { func NewWithFlags(app *kingpin.Application) *Collector {
return &Collector{ return &Collector{
smbclientListAllCollectors: app.Flag( smbClientListAllCollectors: app.Flag(
"collectors.smbclient.list", "collectors.smbclient.list",
"List the collectors along with their perflib object name/ids", "List the collectors along with their perflib object name/ids",
).Bool(), ).Bool(),
smbclientCollectorsEnabled: app.Flag( smbClientCollectorsEnabled: app.Flag(
"collectors.smbclient.enabled", "collectors.smbclient.enabled",
"Comma-separated list of collectors to use. Defaults to all, if not specified.", "Comma-separated list of collectors to use. Defaults to all, if not specified.",
).Default(ConfigDefaults.CollectorsEnabled).String(), ).Default(ConfigDefaults.CollectorsEnabled).String(),
@@ -124,59 +123,59 @@ func (c *Collector) Build() error {
) )
} }
c.RequestQueueSecsTotal = desc("data_queue_seconds_total", c.requestQueueSecsTotal = desc("data_queue_seconds_total",
"Seconds requests waited on queue on this share", "Seconds requests waited on queue on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.ReadRequestQueueSecsTotal = desc("read_queue_seconds_total", c.readRequestQueueSecsTotal = desc("read_queue_seconds_total",
"Seconds read requests waited on queue on this share", "Seconds read requests waited on queue on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.WriteRequestQueueSecsTotal = desc("write_queue_seconds_total", c.writeRequestQueueSecsTotal = desc("write_queue_seconds_total",
"Seconds write requests waited on queue on this share", "Seconds write requests waited on queue on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.RequestSecs = desc("request_seconds_total", c.requestSecs = desc("request_seconds_total",
"Seconds waiting for requests on this share", "Seconds waiting for requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.CreditStallsTotal = desc("stalls_total", c.creditStallsTotal = desc("stalls_total",
"The number of requests delayed based on insufficient credits on this share", "The number of requests delayed based on insufficient credits on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.CurrentDataQueued = desc("requests_queued", c.currentDataQueued = desc("requests_queued",
"The point in time number of requests outstanding on this share", "The point in time number of requests outstanding on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.DataBytesTotal = desc("data_bytes_total", c.dataBytesTotal = desc("data_bytes_total",
"The bytes read or written on this share", "The bytes read or written on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.DataRequestsTotal = desc("requests_total", c.dataRequestsTotal = desc("requests_total",
"The requests on this share", "The requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.MetadataRequestsTotal = desc("metadata_requests_total", c.metadataRequestsTotal = desc("metadata_requests_total",
"The metadata requests on this share", "The metadata requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.ReadBytesTransmittedViaSMBDirectTotal = desc("read_bytes_via_smbdirect_total", c.readBytesTransmittedViaSMBDirectTotal = desc("read_bytes_via_smbdirect_total",
"The bytes read from this share via RDMA direct placement", "The bytes read from this share via RDMA direct placement",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.ReadBytesTotal = desc("read_bytes_total", c.readBytesTotal = desc("read_bytes_total",
"The bytes read on this share", "The bytes read on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.ReadRequestsTransmittedViaSMBDirectTotal = desc("read_requests_via_smbdirect_total", c.readRequestsTransmittedViaSMBDirectTotal = desc("read_requests_via_smbdirect_total",
"The read requests on this share via RDMA direct placement", "The read requests on this share via RDMA direct placement",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.ReadsTotal = desc("read_requests_total", c.readsTotal = desc("read_requests_total",
"The read requests on this share", "The read requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.TurboIOReadsTotal = desc("turbo_io_reads_total", c.turboIOReadsTotal = desc("turbo_io_reads_total",
"The read requests that go through Turbo I/O", "The read requests that go through Turbo I/O",
[]string{"server", "share"}, []string{"server", "share"},
) )
@@ -184,27 +183,27 @@ func (c *Collector) Build() error {
"The write requests that go through Turbo I/O", "The write requests that go through Turbo I/O",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.WriteBytesTransmittedViaSMBDirectTotal = desc("write_bytes_via_smbdirect_total", c.writeBytesTransmittedViaSMBDirectTotal = desc("write_bytes_via_smbdirect_total",
"The written bytes to this share via RDMA direct placement", "The written bytes to this share via RDMA direct placement",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.WriteBytesTotal = desc("write_bytes_total", c.writeBytesTotal = desc("write_bytes_total",
"The bytes written on this share", "The bytes written on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.WriteRequestsTransmittedViaSMBDirectTotal = desc("write_requests_via_smbdirect_total", c.writeRequestsTransmittedViaSMBDirectTotal = desc("write_requests_via_smbdirect_total",
"The write requests to this share via RDMA direct placement", "The write requests to this share via RDMA direct placement",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.WritesTotal = desc("write_requests_total", c.writesTotal = desc("write_requests_total",
"The write requests on this share", "The write requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.ReadSecsTotal = desc("read_seconds_total", c.readSecsTotal = desc("read_seconds_total",
"Seconds waiting for read requests on this share", "Seconds waiting for read requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
c.WriteSecsTotal = desc("write_seconds_total", c.writeSecsTotal = desc("write_seconds_total",
"Seconds waiting for write requests on this share", "Seconds waiting for write requests on this share",
[]string{"server", "share"}, []string{"server", "share"},
) )
@@ -215,7 +214,7 @@ func (c *Collector) Build() error {
"ClientShares": "SMB Client Shares", "ClientShares": "SMB Client Shares",
} }
if *c.smbclientListAllCollectors { if *c.smbClientListAllCollectors {
fmt.Printf("%-32s %-32s\n", "Collector Name", "Perflib Object") //nolint:forbidigo fmt.Printf("%-32s %-32s\n", "Collector Name", "Perflib Object") //nolint:forbidigo
for _, cname := range smbclientAllCollectorNames { for _, cname := range smbclientAllCollectorNames {
fmt.Printf("%-32s %-32s\n", cname, collectorDesc[cname]) //nolint:forbidigo fmt.Printf("%-32s %-32s\n", cname, collectorDesc[cname]) //nolint:forbidigo
@@ -224,12 +223,12 @@ func (c *Collector) Build() error {
os.Exit(0) os.Exit(0)
} }
if *c.smbclientCollectorsEnabled == "" { if *c.smbClientCollectorsEnabled == "" {
for _, collectorName := range smbclientAllCollectorNames { for _, collectorName := range smbclientAllCollectorNames {
c.enabledCollectors = append(c.enabledCollectors, collectorName) c.enabledCollectors = append(c.enabledCollectors, collectorName)
} }
} else { } else {
for _, collectorName := range strings.Split(*c.smbclientCollectorsEnabled, ",") { for _, collectorName := range strings.Split(*c.smbClientCollectorsEnabled, ",") {
if slices.Contains(smbclientAllCollectorNames, collectorName) { if slices.Contains(smbclientAllCollectorNames, collectorName) {
c.enabledCollectors = append(c.enabledCollectors, collectorName) c.enabledCollectors = append(c.enabledCollectors, collectorName)
} else { } else {
@@ -298,7 +297,7 @@ func (c *Collector) collectClientShares(ctx *types.ScrapeContext, ch chan<- prom
shareValue := parsed[1] shareValue := parsed[1]
// Request time spent on queue. Convert from ticks to seconds. // Request time spent on queue. Convert from ticks to seconds.
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RequestQueueSecsTotal, c.requestQueueSecsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.AvgDataQueueLength*perflib.TicksToSecondScaleFactor, instance.AvgDataQueueLength*perflib.TicksToSecondScaleFactor,
serverValue, shareValue, serverValue, shareValue,
@@ -306,28 +305,28 @@ func (c *Collector) collectClientShares(ctx *types.ScrapeContext, ch chan<- prom
// Read time spent on queue. Convert from ticks to seconds. // Read time spent on queue. Convert from ticks to seconds.
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadRequestQueueSecsTotal, c.readRequestQueueSecsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.AvgReadQueueLength*perflib.TicksToSecondScaleFactor, instance.AvgReadQueueLength*perflib.TicksToSecondScaleFactor,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadSecsTotal, c.readSecsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.AvgSecPerRead*perflib.TicksToSecondScaleFactor, instance.AvgSecPerRead*perflib.TicksToSecondScaleFactor,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteSecsTotal, c.writeSecsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.AvgSecPerWrite*perflib.TicksToSecondScaleFactor, instance.AvgSecPerWrite*perflib.TicksToSecondScaleFactor,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RequestSecs, c.requestSecs,
prometheus.CounterValue, prometheus.CounterValue,
instance.AvgSecPerDataRequest*perflib.TicksToSecondScaleFactor, instance.AvgSecPerDataRequest*perflib.TicksToSecondScaleFactor,
serverValue, shareValue, serverValue, shareValue,
@@ -335,77 +334,77 @@ func (c *Collector) collectClientShares(ctx *types.ScrapeContext, ch chan<- prom
// Write time spent on queue. Convert from ticks to seconds. // Write time spent on queue. Convert from ticks to seconds.
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteRequestQueueSecsTotal, c.writeRequestQueueSecsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.AvgWriteQueueLength*perflib.TicksToSecondScaleFactor, instance.AvgWriteQueueLength*perflib.TicksToSecondScaleFactor,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CreditStallsTotal, c.creditStallsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.CreditStallsPerSec, instance.CreditStallsPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentDataQueued, c.currentDataQueued,
prometheus.GaugeValue, prometheus.GaugeValue,
instance.CurrentDataQueueLength, instance.CurrentDataQueueLength,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DataBytesTotal, c.dataBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.DataBytesPerSec, instance.DataBytesPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DataRequestsTotal, c.dataRequestsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.DataRequestsPerSec, instance.DataRequestsPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MetadataRequestsTotal, c.metadataRequestsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.MetadataRequestsPerSec, instance.MetadataRequestsPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadBytesTransmittedViaSMBDirectTotal, c.readBytesTransmittedViaSMBDirectTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.ReadBytesTransmittedViaSMBDirectPerSec, instance.ReadBytesTransmittedViaSMBDirectPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadBytesTotal, c.readBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.ReadBytesPerSec, instance.ReadBytesPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadRequestsTransmittedViaSMBDirectTotal, c.readRequestsTransmittedViaSMBDirectTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.ReadRequestsTransmittedViaSMBDirectPerSec, instance.ReadRequestsTransmittedViaSMBDirectPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ReadsTotal, c.readsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.ReadRequestsPerSec, instance.ReadRequestsPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TurboIOReadsTotal, c.turboIOReadsTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.TurboIOReadsPerSec, instance.TurboIOReadsPerSec,
serverValue, shareValue, serverValue, shareValue,
@@ -419,28 +418,28 @@ func (c *Collector) collectClientShares(ctx *types.ScrapeContext, ch chan<- prom
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteBytesTransmittedViaSMBDirectTotal, c.writeBytesTransmittedViaSMBDirectTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.WriteBytesTransmittedViaSMBDirectPerSec, instance.WriteBytesTransmittedViaSMBDirectPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteBytesTotal, c.writeBytesTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.WriteBytesPerSec, instance.WriteBytesPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WriteRequestsTransmittedViaSMBDirectTotal, c.writeRequestsTransmittedViaSMBDirectTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.WriteRequestsTransmittedViaSMBDirectPerSec, instance.WriteRequestsTransmittedViaSMBDirectPerSec,
serverValue, shareValue, serverValue, shareValue,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WritesTotal, c.writesTotal,
prometheus.CounterValue, prometheus.CounterValue,
instance.WriteRequestsPerSec, instance.WriteRequestsPerSec,
serverValue, shareValue, serverValue, shareValue,

View File

@@ -29,54 +29,53 @@ var ConfigDefaults = Config{
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
serverInclude *string serverInclude *string
serverExclude *string serverExclude *string
BadmailedMessagesBadPickupFileTotal *prometheus.Desc
BadmailedMessagesGeneralFailureTotal *prometheus.Desc
BadmailedMessagesHopCountExceededTotal *prometheus.Desc
BadmailedMessagesNDROfDSNTotal *prometheus.Desc
BadmailedMessagesNoRecipientsTotal *prometheus.Desc
BadmailedMessagesTriggeredViaEventTotal *prometheus.Desc
BytesSentTotal *prometheus.Desc
BytesReceivedTotal *prometheus.Desc
CategorizerQueueLength *prometheus.Desc
ConnectionErrorsTotal *prometheus.Desc
CurrentMessagesInLocalDelivery *prometheus.Desc
DirectoryDropsTotal *prometheus.Desc
DNSQueriesTotal *prometheus.Desc
DSNFailuresTotal *prometheus.Desc
ETRNMessagesTotal *prometheus.Desc
InboundConnectionsCurrent *prometheus.Desc
InboundConnectionsTotal *prometheus.Desc
LocalQueueLength *prometheus.Desc
LocalRetryQueueLength *prometheus.Desc
MailFilesOpen *prometheus.Desc
MessageBytesReceivedTotal *prometheus.Desc
MessageBytesSentTotal *prometheus.Desc
MessageDeliveryRetriesTotal *prometheus.Desc
MessageSendRetriesTotal *prometheus.Desc
MessagesCurrentlyUndeliverable *prometheus.Desc
MessagesDeliveredTotal *prometheus.Desc
MessagesPendingRouting *prometheus.Desc
MessagesReceivedTotal *prometheus.Desc
MessagesRefusedForAddressObjectsTotal *prometheus.Desc
MessagesRefusedForMailObjectsTotal *prometheus.Desc
MessagesRefusedForSizeTotal *prometheus.Desc
MessagesSentTotal *prometheus.Desc
MessagesSubmittedTotal *prometheus.Desc
NDRsGeneratedTotal *prometheus.Desc
OutboundConnectionsCurrent *prometheus.Desc
OutboundConnectionsRefusedTotal *prometheus.Desc
OutboundConnectionsTotal *prometheus.Desc
QueueFilesOpen *prometheus.Desc
PickupDirectoryMessagesRetrievedTotal *prometheus.Desc
RemoteQueueLength *prometheus.Desc
RemoteRetryQueueLength *prometheus.Desc
RoutingTableLookupsTotal *prometheus.Desc
serverIncludePattern *regexp.Regexp serverIncludePattern *regexp.Regexp
serverExcludePattern *regexp.Regexp serverExcludePattern *regexp.Regexp
badMailedMessagesBadPickupFileTotal *prometheus.Desc
badMailedMessagesGeneralFailureTotal *prometheus.Desc
badMailedMessagesHopCountExceededTotal *prometheus.Desc
badMailedMessagesNDROfDSNTotal *prometheus.Desc
badMailedMessagesNoRecipientsTotal *prometheus.Desc
badMailedMessagesTriggeredViaEventTotal *prometheus.Desc
bytesReceivedTotal *prometheus.Desc
bytesSentTotal *prometheus.Desc
categorizerQueueLength *prometheus.Desc
connectionErrorsTotal *prometheus.Desc
currentMessagesInLocalDelivery *prometheus.Desc
dnsQueriesTotal *prometheus.Desc
dsnFailuresTotal *prometheus.Desc
directoryDropsTotal *prometheus.Desc
etrnMessagesTotal *prometheus.Desc
inboundConnectionsCurrent *prometheus.Desc
inboundConnectionsTotal *prometheus.Desc
localQueueLength *prometheus.Desc
localRetryQueueLength *prometheus.Desc
mailFilesOpen *prometheus.Desc
messageBytesReceivedTotal *prometheus.Desc
messageBytesSentTotal *prometheus.Desc
messageDeliveryRetriesTotal *prometheus.Desc
messageSendRetriesTotal *prometheus.Desc
messagesCurrentlyUndeliverable *prometheus.Desc
messagesDeliveredTotal *prometheus.Desc
messagesPendingRouting *prometheus.Desc
messagesReceivedTotal *prometheus.Desc
messagesRefusedForAddressObjectsTotal *prometheus.Desc
messagesRefusedForMailObjectsTotal *prometheus.Desc
messagesRefusedForSizeTotal *prometheus.Desc
messagesSentTotal *prometheus.Desc
messagesSubmittedTotal *prometheus.Desc
ndrsGeneratedTotal *prometheus.Desc
outboundConnectionsCurrent *prometheus.Desc
outboundConnectionsRefusedTotal *prometheus.Desc
outboundConnectionsTotal *prometheus.Desc
pickupDirectoryMessagesRetrievedTotal *prometheus.Desc
queueFilesOpen *prometheus.Desc
remoteQueueLength *prometheus.Desc
remoteRetryQueueLength *prometheus.Desc
routingTableLookupsTotal *prometheus.Desc
} }
func New(logger log.Logger, config *Config) *Collector { func New(logger log.Logger, config *Config) *Collector {
@@ -128,253 +127,253 @@ func (c *Collector) Close() error {
func (c *Collector) Build() error { func (c *Collector) Build() error {
_ = level.Info(c.logger).Log("msg", "smtp collector is in an experimental state! Metrics for this collector have not been tested.") _ = level.Info(c.logger).Log("msg", "smtp collector is in an experimental state! Metrics for this collector have not been tested.")
c.BadmailedMessagesBadPickupFileTotal = prometheus.NewDesc( c.badMailedMessagesBadPickupFileTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_bad_pickup_file_total"), prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_bad_pickup_file_total"),
"Total number of malformed pickup messages sent to badmail", "Total number of malformed pickup messages sent to badmail",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BadmailedMessagesGeneralFailureTotal = prometheus.NewDesc( c.badMailedMessagesGeneralFailureTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_general_failure_total"), prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_general_failure_total"),
"Total number of messages sent to badmail for reasons not associated with a specific counter", "Total number of messages sent to badmail for reasons not associated with a specific counter",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BadmailedMessagesHopCountExceededTotal = prometheus.NewDesc( c.badMailedMessagesHopCountExceededTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_hop_count_exceeded_total"), prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_hop_count_exceeded_total"),
"Total number of messages sent to badmail because they had exceeded the maximum hop count", "Total number of messages sent to badmail because they had exceeded the maximum hop count",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BadmailedMessagesNDROfDSNTotal = prometheus.NewDesc( c.badMailedMessagesNDROfDSNTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_ndr_of_dns_total"), prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_ndr_of_dns_total"),
"Total number of Delivery Status Notifications sent to badmail because they could not be delivered", "Total number of Delivery Status Notifications sent to badmail because they could not be delivered",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BadmailedMessagesNoRecipientsTotal = prometheus.NewDesc( c.badMailedMessagesNoRecipientsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_no_recipients_total"), prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_no_recipients_total"),
"Total number of messages sent to badmail because they had no recipients", "Total number of messages sent to badmail because they had no recipients",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BadmailedMessagesTriggeredViaEventTotal = prometheus.NewDesc( c.badMailedMessagesTriggeredViaEventTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_triggered_via_event_total"), prometheus.BuildFQName(types.Namespace, Name, "badmailed_messages_triggered_via_event_total"),
"Total number of messages sent to badmail at the request of a server event sink", "Total number of messages sent to badmail at the request of a server event sink",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BytesSentTotal = prometheus.NewDesc( c.bytesSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"),
"Total number of bytes sent", "Total number of bytes sent",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.BytesReceivedTotal = prometheus.NewDesc( c.bytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"),
"Total number of bytes received", "Total number of bytes received",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.CategorizerQueueLength = prometheus.NewDesc( c.categorizerQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "categorizer_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "categorizer_queue_length"),
"Number of messages in the categorizer queue", "Number of messages in the categorizer queue",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.ConnectionErrorsTotal = prometheus.NewDesc( c.connectionErrorsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_errors_total"), prometheus.BuildFQName(types.Namespace, Name, "connection_errors_total"),
"Total number of connection errors", "Total number of connection errors",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.CurrentMessagesInLocalDelivery = prometheus.NewDesc( c.currentMessagesInLocalDelivery = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "current_messages_in_local_delivery"), prometheus.BuildFQName(types.Namespace, Name, "current_messages_in_local_delivery"),
"Number of messages that are currently being processed by a server event sink for local delivery", "Number of messages that are currently being processed by a server event sink for local delivery",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.DirectoryDropsTotal = prometheus.NewDesc( c.directoryDropsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "directory_drops_total"), prometheus.BuildFQName(types.Namespace, Name, "directory_drops_total"),
"Total number of messages placed in a drop directory", "Total number of messages placed in a drop directory",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.DSNFailuresTotal = prometheus.NewDesc( c.dsnFailuresTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dsn_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "dsn_failures_total"),
"Total number of failed DSN generation attempts", "Total number of failed DSN generation attempts",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.DNSQueriesTotal = prometheus.NewDesc( c.dnsQueriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "dns_queries_total"), prometheus.BuildFQName(types.Namespace, Name, "dns_queries_total"),
"Total number of DNS lookups", "Total number of DNS lookups",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.ETRNMessagesTotal = prometheus.NewDesc( c.etrnMessagesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "etrn_messages_total"), prometheus.BuildFQName(types.Namespace, Name, "etrn_messages_total"),
"Total number of ETRN messages received by the server", "Total number of ETRN messages received by the server",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.InboundConnectionsCurrent = prometheus.NewDesc( c.inboundConnectionsCurrent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "inbound_connections_current"), prometheus.BuildFQName(types.Namespace, Name, "inbound_connections_current"),
"Total number of connections currently inbound", "Total number of connections currently inbound",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.InboundConnectionsTotal = prometheus.NewDesc( c.inboundConnectionsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "inbound_connections_total"), prometheus.BuildFQName(types.Namespace, Name, "inbound_connections_total"),
"Total number of inbound connections received", "Total number of inbound connections received",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.LocalQueueLength = prometheus.NewDesc( c.localQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "local_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "local_queue_length"),
"Number of messages in the local queue", "Number of messages in the local queue",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.LocalRetryQueueLength = prometheus.NewDesc( c.localRetryQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "local_retry_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "local_retry_queue_length"),
"Number of messages in the local retry queue", "Number of messages in the local retry queue",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MailFilesOpen = prometheus.NewDesc( c.mailFilesOpen = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mail_files_open"), prometheus.BuildFQName(types.Namespace, Name, "mail_files_open"),
"Number of handles to open mail files", "Number of handles to open mail files",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessageBytesReceivedTotal = prometheus.NewDesc( c.messageBytesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "message_bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "message_bytes_received_total"),
"Total number of bytes received in messages", "Total number of bytes received in messages",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessageBytesSentTotal = prometheus.NewDesc( c.messageBytesSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "message_bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "message_bytes_sent_total"),
"Total number of bytes sent in messages", "Total number of bytes sent in messages",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessageDeliveryRetriesTotal = prometheus.NewDesc( c.messageDeliveryRetriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "message_delivery_retries_total"), prometheus.BuildFQName(types.Namespace, Name, "message_delivery_retries_total"),
"Total number of local deliveries that were retried", "Total number of local deliveries that were retried",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessageSendRetriesTotal = prometheus.NewDesc( c.messageSendRetriesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "message_send_retries_total"), prometheus.BuildFQName(types.Namespace, Name, "message_send_retries_total"),
"Total number of outbound message sends that were retried", "Total number of outbound message sends that were retried",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesCurrentlyUndeliverable = prometheus.NewDesc( c.messagesCurrentlyUndeliverable = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_currently_undeliverable"), prometheus.BuildFQName(types.Namespace, Name, "messages_currently_undeliverable"),
"Number of messages that have been reported as currently undeliverable by routing", "Number of messages that have been reported as currently undeliverable by routing",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesDeliveredTotal = prometheus.NewDesc( c.messagesDeliveredTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_delivered_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_delivered_total"),
"Total number of messages delivered to local mailboxes", "Total number of messages delivered to local mailboxes",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesPendingRouting = prometheus.NewDesc( c.messagesPendingRouting = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_pending_routing"), prometheus.BuildFQName(types.Namespace, Name, "messages_pending_routing"),
"Number of messages that have been categorized but not routed", "Number of messages that have been categorized but not routed",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesReceivedTotal = prometheus.NewDesc( c.messagesReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_received_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_received_total"),
"Total number of inbound messages accepted", "Total number of inbound messages accepted",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesRefusedForAddressObjectsTotal = prometheus.NewDesc( c.messagesRefusedForAddressObjectsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_refused_for_address_objects_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_refused_for_address_objects_total"),
"Total number of messages refused due to no address objects", "Total number of messages refused due to no address objects",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesRefusedForMailObjectsTotal = prometheus.NewDesc( c.messagesRefusedForMailObjectsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_refused_for_mail_objects_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_refused_for_mail_objects_total"),
"Total number of messages refused due to no mail objects", "Total number of messages refused due to no mail objects",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesRefusedForSizeTotal = prometheus.NewDesc( c.messagesRefusedForSizeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_refused_for_size_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_refused_for_size_total"),
"Total number of messages rejected because they were too big", "Total number of messages rejected because they were too big",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesSentTotal = prometheus.NewDesc( c.messagesSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_sent_total"),
"Total number of outbound messages sent", "Total number of outbound messages sent",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.MessagesSubmittedTotal = prometheus.NewDesc( c.messagesSubmittedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "messages_submitted_total"), prometheus.BuildFQName(types.Namespace, Name, "messages_submitted_total"),
"Total number of messages submitted to queuing for delivery", "Total number of messages submitted to queuing for delivery",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.NDRsGeneratedTotal = prometheus.NewDesc( c.ndrsGeneratedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ndrs_generated_total"), prometheus.BuildFQName(types.Namespace, Name, "ndrs_generated_total"),
"Total number of non-delivery reports that have been generated", "Total number of non-delivery reports that have been generated",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.OutboundConnectionsCurrent = prometheus.NewDesc( c.outboundConnectionsCurrent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "outbound_connections_current"), prometheus.BuildFQName(types.Namespace, Name, "outbound_connections_current"),
"Number of connections currently outbound", "Number of connections currently outbound",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.OutboundConnectionsRefusedTotal = prometheus.NewDesc( c.outboundConnectionsRefusedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "outbound_connections_refused_total"), prometheus.BuildFQName(types.Namespace, Name, "outbound_connections_refused_total"),
"Total number of connection attempts refused by remote sites", "Total number of connection attempts refused by remote sites",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.OutboundConnectionsTotal = prometheus.NewDesc( c.outboundConnectionsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "outbound_connections_total"), prometheus.BuildFQName(types.Namespace, Name, "outbound_connections_total"),
"Total number of outbound connections attempted", "Total number of outbound connections attempted",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.PickupDirectoryMessagesRetrievedTotal = prometheus.NewDesc( c.pickupDirectoryMessagesRetrievedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pickup_directory_messages_retrieved_total"), prometheus.BuildFQName(types.Namespace, Name, "pickup_directory_messages_retrieved_total"),
"Total number of messages retrieved from the mail pick-up directory", "Total number of messages retrieved from the mail pick-up directory",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.QueueFilesOpen = prometheus.NewDesc( c.queueFilesOpen = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "queue_files_open"), prometheus.BuildFQName(types.Namespace, Name, "queue_files_open"),
"Number of handles to open queue files", "Number of handles to open queue files",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.RemoteQueueLength = prometheus.NewDesc( c.remoteQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "remote_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "remote_queue_length"),
"Number of messages in the remote queue", "Number of messages in the remote queue",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.RemoteRetryQueueLength = prometheus.NewDesc( c.remoteRetryQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "remote_retry_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "remote_retry_queue_length"),
"Number of messages in the retry queue for remote delivery", "Number of messages in the retry queue for remote delivery",
[]string{"site"}, []string{"site"},
nil, nil,
) )
c.RoutingTableLookupsTotal = prometheus.NewDesc( c.routingTableLookupsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "routing_table_lookups_total"), prometheus.BuildFQName(types.Namespace, Name, "routing_table_lookups_total"),
"Total number of routing table lookups", "Total number of routing table lookups",
[]string{"site"}, []string{"site"},
@@ -468,287 +467,287 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BadmailedMessagesBadPickupFileTotal, c.badMailedMessagesBadPickupFileTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BadmailedMessagesBadPickupFileTotal, server.BadmailedMessagesBadPickupFileTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BadmailedMessagesHopCountExceededTotal, c.badMailedMessagesHopCountExceededTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BadmailedMessagesHopCountExceededTotal, server.BadmailedMessagesHopCountExceededTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BadmailedMessagesNDROfDSNTotal, c.badMailedMessagesNDROfDSNTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BadmailedMessagesNDROfDSNTotal, server.BadmailedMessagesNDROfDSNTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BadmailedMessagesNoRecipientsTotal, c.badMailedMessagesNoRecipientsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BadmailedMessagesNoRecipientsTotal, server.BadmailedMessagesNoRecipientsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BadmailedMessagesTriggeredViaEventTotal, c.badMailedMessagesTriggeredViaEventTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BadmailedMessagesTriggeredViaEventTotal, server.BadmailedMessagesTriggeredViaEventTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesSentTotal, c.bytesSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BytesSentTotal, server.BytesSentTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesReceivedTotal, c.bytesReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.BytesReceivedTotal, server.BytesReceivedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CategorizerQueueLength, c.categorizerQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
server.CategorizerQueueLength, server.CategorizerQueueLength,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionErrorsTotal, c.connectionErrorsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.ConnectionErrorsTotal, server.ConnectionErrorsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CurrentMessagesInLocalDelivery, c.currentMessagesInLocalDelivery,
prometheus.GaugeValue, prometheus.GaugeValue,
server.CurrentMessagesInLocalDelivery, server.CurrentMessagesInLocalDelivery,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DirectoryDropsTotal, c.directoryDropsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.DirectoryDropsTotal, server.DirectoryDropsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DSNFailuresTotal, c.dsnFailuresTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.DSNFailuresTotal, server.DSNFailuresTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.DNSQueriesTotal, c.dnsQueriesTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.DNSQueriesTotal, server.DNSQueriesTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ETRNMessagesTotal, c.etrnMessagesTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.ETRNMessagesTotal, server.ETRNMessagesTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.InboundConnectionsTotal, c.inboundConnectionsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.InboundConnectionsTotal, server.InboundConnectionsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.InboundConnectionsCurrent, c.inboundConnectionsCurrent,
prometheus.GaugeValue, prometheus.GaugeValue,
server.InboundConnectionsCurrent, server.InboundConnectionsCurrent,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LocalQueueLength, c.localQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
server.LocalQueueLength, server.LocalQueueLength,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.LocalRetryQueueLength, c.localRetryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
server.LocalRetryQueueLength, server.LocalRetryQueueLength,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MailFilesOpen, c.mailFilesOpen,
prometheus.GaugeValue, prometheus.GaugeValue,
server.MailFilesOpen, server.MailFilesOpen,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessageBytesReceivedTotal, c.messageBytesReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessageBytesReceivedTotal, server.MessageBytesReceivedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessageBytesSentTotal, c.messageBytesSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessageBytesSentTotal, server.MessageBytesSentTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessageDeliveryRetriesTotal, c.messageDeliveryRetriesTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessageDeliveryRetriesTotal, server.MessageDeliveryRetriesTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessageSendRetriesTotal, c.messageSendRetriesTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessageSendRetriesTotal, server.MessageSendRetriesTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesCurrentlyUndeliverable, c.messagesCurrentlyUndeliverable,
prometheus.GaugeValue, prometheus.GaugeValue,
server.MessagesCurrentlyUndeliverable, server.MessagesCurrentlyUndeliverable,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesDeliveredTotal, c.messagesDeliveredTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesDeliveredTotal, server.MessagesDeliveredTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesPendingRouting, c.messagesPendingRouting,
prometheus.GaugeValue, prometheus.GaugeValue,
server.MessagesPendingRouting, server.MessagesPendingRouting,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesReceivedTotal, c.messagesReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesReceivedTotal, server.MessagesReceivedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesRefusedForAddressObjectsTotal, c.messagesRefusedForAddressObjectsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesRefusedForAddressObjectsTotal, server.MessagesRefusedForAddressObjectsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesRefusedForMailObjectsTotal, c.messagesRefusedForMailObjectsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesRefusedForMailObjectsTotal, server.MessagesRefusedForMailObjectsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesRefusedForSizeTotal, c.messagesRefusedForSizeTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesRefusedForSizeTotal, server.MessagesRefusedForSizeTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesSentTotal, c.messagesSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesSentTotal, server.MessagesSentTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MessagesSubmittedTotal, c.messagesSubmittedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.MessagesSubmittedTotal, server.MessagesSubmittedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NDRsGeneratedTotal, c.ndrsGeneratedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.NDRsGeneratedTotal, server.NDRsGeneratedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OutboundConnectionsCurrent, c.outboundConnectionsCurrent,
prometheus.GaugeValue, prometheus.GaugeValue,
server.OutboundConnectionsCurrent, server.OutboundConnectionsCurrent,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OutboundConnectionsRefusedTotal, c.outboundConnectionsRefusedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.OutboundConnectionsRefusedTotal, server.OutboundConnectionsRefusedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.OutboundConnectionsTotal, c.outboundConnectionsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.OutboundConnectionsTotal, server.OutboundConnectionsTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.QueueFilesOpen, c.queueFilesOpen,
prometheus.GaugeValue, prometheus.GaugeValue,
server.QueueFilesOpen, server.QueueFilesOpen,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PickupDirectoryMessagesRetrievedTotal, c.pickupDirectoryMessagesRetrievedTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.PickupDirectoryMessagesRetrievedTotal, server.PickupDirectoryMessagesRetrievedTotal,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RemoteQueueLength, c.remoteQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
server.RemoteQueueLength, server.RemoteQueueLength,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RemoteRetryQueueLength, c.remoteRetryQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
server.RemoteRetryQueueLength, server.RemoteRetryQueueLength,
server.Name, server.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RoutingTableLookupsTotal, c.routingTableLookupsTotal,
prometheus.CounterValue, prometheus.CounterValue,
server.RoutingTableLookupsTotal, server.RoutingTableLookupsTotal,
server.Name, server.Name,

View File

@@ -21,12 +21,12 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
ContextSwitchesTotal *prometheus.Desc contextSwitchesTotal *prometheus.Desc
ExceptionDispatchesTotal *prometheus.Desc exceptionDispatchesTotal *prometheus.Desc
ProcessorQueueLength *prometheus.Desc processorQueueLength *prometheus.Desc
SystemCallsTotal *prometheus.Desc systemCallsTotal *prometheus.Desc
SystemUpTime *prometheus.Desc systemUpTime *prometheus.Desc
Threads *prometheus.Desc threads *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -57,37 +57,37 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.ContextSwitchesTotal = prometheus.NewDesc( c.contextSwitchesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "context_switches_total"), prometheus.BuildFQName(types.Namespace, Name, "context_switches_total"),
"Total number of context switches (WMI source: PerfOS_System.ContextSwitchesPersec)", "Total number of context switches (WMI source: PerfOS_System.ContextSwitchesPersec)",
nil, nil,
nil, nil,
) )
c.ExceptionDispatchesTotal = prometheus.NewDesc( c.exceptionDispatchesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "exception_dispatches_total"), prometheus.BuildFQName(types.Namespace, Name, "exception_dispatches_total"),
"Total number of exceptions dispatched (WMI source: PerfOS_System.ExceptionDispatchesPersec)", "Total number of exceptions dispatched (WMI source: PerfOS_System.ExceptionDispatchesPersec)",
nil, nil,
nil, nil,
) )
c.ProcessorQueueLength = prometheus.NewDesc( c.processorQueueLength = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "processor_queue_length"), prometheus.BuildFQName(types.Namespace, Name, "processor_queue_length"),
"Length of processor queue (WMI source: PerfOS_System.ProcessorQueueLength)", "Length of processor queue (WMI source: PerfOS_System.ProcessorQueueLength)",
nil, nil,
nil, nil,
) )
c.SystemCallsTotal = prometheus.NewDesc( c.systemCallsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_calls_total"), prometheus.BuildFQName(types.Namespace, Name, "system_calls_total"),
"Total number of system calls (WMI source: PerfOS_System.SystemCallsPersec)", "Total number of system calls (WMI source: PerfOS_System.SystemCallsPersec)",
nil, nil,
nil, nil,
) )
c.SystemUpTime = prometheus.NewDesc( c.systemUpTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "system_up_time"), prometheus.BuildFQName(types.Namespace, Name, "system_up_time"),
"System boot time (WMI source: PerfOS_System.SystemUpTime)", "System boot time (WMI source: PerfOS_System.SystemUpTime)",
nil, nil,
nil, nil,
) )
c.Threads = prometheus.NewDesc( c.threads = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "threads"), prometheus.BuildFQName(types.Namespace, Name, "threads"),
"Current number of threads (WMI source: PerfOS_System.Threads)", "Current number of threads (WMI source: PerfOS_System.Threads)",
nil, nil,
@@ -124,32 +124,32 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ContextSwitchesTotal, c.contextSwitchesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].ContextSwitchesPersec, dst[0].ContextSwitchesPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ExceptionDispatchesTotal, c.exceptionDispatchesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].ExceptionDispatchesPersec, dst[0].ExceptionDispatchesPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ProcessorQueueLength, c.processorQueueLength,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].ProcessorQueueLength, dst[0].ProcessorQueueLength,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemCallsTotal, c.systemCallsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].SystemCallsPersec, dst[0].SystemCallsPersec,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemUpTime, c.systemUpTime,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].SystemUpTime, dst[0].SystemUpTime,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Threads, c.threads,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].Threads, dst[0].Threads,
) )

View File

@@ -21,15 +21,15 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
ConnectionFailures *prometheus.Desc connectionFailures *prometheus.Desc
ConnectionsActive *prometheus.Desc connectionsActive *prometheus.Desc
ConnectionsEstablished *prometheus.Desc connectionsEstablished *prometheus.Desc
ConnectionsPassive *prometheus.Desc connectionsPassive *prometheus.Desc
ConnectionsReset *prometheus.Desc connectionsReset *prometheus.Desc
SegmentsTotal *prometheus.Desc segmentsTotal *prometheus.Desc
SegmentsReceivedTotal *prometheus.Desc segmentsReceivedTotal *prometheus.Desc
SegmentsRetransmittedTotal *prometheus.Desc segmentsRetransmittedTotal *prometheus.Desc
SegmentsSentTotal *prometheus.Desc segmentsSentTotal *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -60,55 +60,55 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.ConnectionFailures = prometheus.NewDesc( c.connectionFailures = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_failures_total"), prometheus.BuildFQName(types.Namespace, Name, "connection_failures_total"),
"(TCP.ConnectionFailures)", "(TCP.ConnectionFailures)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.ConnectionsActive = prometheus.NewDesc( c.connectionsActive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connections_active_total"), prometheus.BuildFQName(types.Namespace, Name, "connections_active_total"),
"(TCP.ConnectionsActive)", "(TCP.ConnectionsActive)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.ConnectionsEstablished = prometheus.NewDesc( c.connectionsEstablished = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connections_established"), prometheus.BuildFQName(types.Namespace, Name, "connections_established"),
"(TCP.ConnectionsEstablished)", "(TCP.ConnectionsEstablished)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.ConnectionsPassive = prometheus.NewDesc( c.connectionsPassive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connections_passive_total"), prometheus.BuildFQName(types.Namespace, Name, "connections_passive_total"),
"(TCP.ConnectionsPassive)", "(TCP.ConnectionsPassive)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.ConnectionsReset = prometheus.NewDesc( c.connectionsReset = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connections_reset_total"), prometheus.BuildFQName(types.Namespace, Name, "connections_reset_total"),
"(TCP.ConnectionsReset)", "(TCP.ConnectionsReset)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.SegmentsTotal = prometheus.NewDesc( c.segmentsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "segments_total"), prometheus.BuildFQName(types.Namespace, Name, "segments_total"),
"(TCP.SegmentsTotal)", "(TCP.SegmentsTotal)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.SegmentsReceivedTotal = prometheus.NewDesc( c.segmentsReceivedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "segments_received_total"), prometheus.BuildFQName(types.Namespace, Name, "segments_received_total"),
"(TCP.SegmentsReceivedTotal)", "(TCP.SegmentsReceivedTotal)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.SegmentsRetransmittedTotal = prometheus.NewDesc( c.segmentsRetransmittedTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "segments_retransmitted_total"), prometheus.BuildFQName(types.Namespace, Name, "segments_retransmitted_total"),
"(TCP.SegmentsRetransmittedTotal)", "(TCP.SegmentsRetransmittedTotal)",
[]string{"af"}, []string{"af"},
nil, nil,
) )
c.SegmentsSentTotal = prometheus.NewDesc( c.segmentsSentTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "segments_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "segments_sent_total"),
"(TCP.SegmentsSentTotal)", "(TCP.SegmentsSentTotal)",
[]string{"af"}, []string{"af"},
@@ -144,55 +144,55 @@ type tcp struct {
func writeTCPCounters(metrics tcp, labels []string, c *Collector, ch chan<- prometheus.Metric) { func writeTCPCounters(metrics tcp, labels []string, c *Collector, ch chan<- prometheus.Metric) {
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionFailures, c.connectionFailures,
prometheus.CounterValue, prometheus.CounterValue,
metrics.ConnectionFailures, metrics.ConnectionFailures,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionsActive, c.connectionsActive,
prometheus.CounterValue, prometheus.CounterValue,
metrics.ConnectionsActive, metrics.ConnectionsActive,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionsEstablished, c.connectionsEstablished,
prometheus.GaugeValue, prometheus.GaugeValue,
metrics.ConnectionsEstablished, metrics.ConnectionsEstablished,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionsPassive, c.connectionsPassive,
prometheus.CounterValue, prometheus.CounterValue,
metrics.ConnectionsPassive, metrics.ConnectionsPassive,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionsReset, c.connectionsReset,
prometheus.CounterValue, prometheus.CounterValue,
metrics.ConnectionsReset, metrics.ConnectionsReset,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SegmentsTotal, c.segmentsTotal,
prometheus.CounterValue, prometheus.CounterValue,
metrics.SegmentsPersec, metrics.SegmentsPersec,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SegmentsReceivedTotal, c.segmentsReceivedTotal,
prometheus.CounterValue, prometheus.CounterValue,
metrics.SegmentsReceivedPersec, metrics.SegmentsReceivedPersec,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SegmentsRetransmittedTotal, c.segmentsRetransmittedTotal,
prometheus.CounterValue, prometheus.CounterValue,
metrics.SegmentsRetransmittedPersec, metrics.SegmentsRetransmittedPersec,
labels..., labels...,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SegmentsSentTotal, c.segmentsSentTotal,
prometheus.CounterValue, prometheus.CounterValue,
metrics.SegmentsSentPersec, metrics.SegmentsSentPersec,
labels..., labels...,

View File

@@ -28,47 +28,47 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
AudioBytesReceived *prometheus.Desc audioBytesReceived *prometheus.Desc
AudioBytesSent *prometheus.Desc audioBytesSent *prometheus.Desc
AudioRXBWkbitPersec *prometheus.Desc audioRXBWKBitPerSec *prometheus.Desc
AudioTXBWkbitPersec *prometheus.Desc audioTXBWKBitPerSec *prometheus.Desc
AudioTXBWLimitkbitPersec *prometheus.Desc audioTXBWLimitKBitPerSec *prometheus.Desc
BytesReceived *prometheus.Desc bytesReceived *prometheus.Desc
BytesSent *prometheus.Desc bytesSent *prometheus.Desc
PacketsReceived *prometheus.Desc packetsReceived *prometheus.Desc
PacketsSent *prometheus.Desc packetsSent *prometheus.Desc
RXPacketsLost *prometheus.Desc rxPacketsLost *prometheus.Desc
SessionDurationSeconds *prometheus.Desc sessionDurationSeconds *prometheus.Desc
TXPacketsLost *prometheus.Desc txPacketsLost *prometheus.Desc
ImagingActiveMinimumQuality *prometheus.Desc imagingActiveMinimumQuality *prometheus.Desc
ImagingApex2800Offload *prometheus.Desc imagingApex2800Offload *prometheus.Desc
ImagingBytesReceived *prometheus.Desc imagingBytesReceived *prometheus.Desc
ImagingBytesSent *prometheus.Desc imagingBytesSent *prometheus.Desc
ImagingDecoderCapabilitykbitPersec *prometheus.Desc imagingDecoderCapabilityKBitPerSec *prometheus.Desc
ImagingEncodedFramesPersec *prometheus.Desc imagingEncodedFramesPerSec *prometheus.Desc
ImagingMegapixelPersec *prometheus.Desc imagingMegapixelPerSec *prometheus.Desc
ImagingNegativeAcknowledgements *prometheus.Desc imagingNegativeAcknowledgements *prometheus.Desc
ImagingRXBWkbitPersec *prometheus.Desc imagingRXBWKBitPerSec *prometheus.Desc
ImagingSVGAdevTapframesPersec *prometheus.Desc imagingSVGAdevTapframesPerSec *prometheus.Desc
ImagingTXBWkbitPersec *prometheus.Desc imagingTXBWKBitPerSec *prometheus.Desc
RoundTripLatencyms *prometheus.Desc RoundTripLatencyms *prometheus.Desc
RXBWkbitPersec *prometheus.Desc rxBWKBitPerSec *prometheus.Desc
RXBWPeakkbitPersec *prometheus.Desc rxBWPeakKBitPerSec *prometheus.Desc
RXPacketLossPercent *prometheus.Desc rxPacketLossPercent *prometheus.Desc
RXPacketLossPercent_Base *prometheus.Desc rxPacketLossPercentBase *prometheus.Desc
TXBWActiveLimitkbitPersec *prometheus.Desc txBWActiveLimitKBitPerSec *prometheus.Desc
TXBWkbitPersec *prometheus.Desc txBWKBitPerSec *prometheus.Desc
TXBWLimitkbitPersec *prometheus.Desc txBWLimitKBitPerSec *prometheus.Desc
TXPacketLossPercent *prometheus.Desc txPacketLossPercent *prometheus.Desc
TXPacketLossPercent_Base *prometheus.Desc txPacketLossPercentBase *prometheus.Desc
USBBytesReceived *prometheus.Desc usbBytesReceived *prometheus.Desc
USBBytesSent *prometheus.Desc usbBytesSent *prometheus.Desc
USBRXBWkbitPersec *prometheus.Desc usbRXBWKBitPerSec *prometheus.Desc
USBTXBWkbitPersec *prometheus.Desc usbTXBWKBitPerSec *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -99,143 +99,145 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.AudioBytesReceived = prometheus.NewDesc( // _ = level.Warn(c.logger).Log("msg", "teradici_pcoip collector is deprecated and will be removed in the future.")
c.audioBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "audio_bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "audio_bytes_received_total"),
"(AudioBytesReceived)", "(AudioBytesReceived)",
nil, nil,
nil, nil,
) )
c.AudioBytesSent = prometheus.NewDesc( c.audioBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "audio_bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "audio_bytes_sent_total"),
"(AudioBytesSent)", "(AudioBytesSent)",
nil, nil,
nil, nil,
) )
c.AudioRXBWkbitPersec = prometheus.NewDesc( c.audioRXBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "audio_rx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "audio_rx_bw_KBit_persec"),
"(AudioRXBWkbitPersec)", "(AudioRXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
c.AudioTXBWkbitPersec = prometheus.NewDesc( c.audioTXBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "audio_tx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "audio_tx_bw_KBit_persec"),
"(AudioTXBWkbitPersec)", "(AudioTXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
c.AudioTXBWLimitkbitPersec = prometheus.NewDesc( c.audioTXBWLimitKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "audio_tx_bw_limit_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "audio_tx_bw_limit_KBit_persec"),
"(AudioTXBWLimitkbitPersec)", "(AudioTXBWLimitKBitPerSec)",
nil, nil,
nil, nil,
) )
c.BytesReceived = prometheus.NewDesc( c.bytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"),
"(BytesReceived)", "(BytesReceived)",
nil, nil,
nil, nil,
) )
c.BytesSent = prometheus.NewDesc( c.bytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"),
"(BytesSent)", "(BytesSent)",
nil, nil,
nil, nil,
) )
c.PacketsReceived = prometheus.NewDesc( c.packetsReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"),
"(PacketsReceived)", "(PacketsReceived)",
nil, nil,
nil, nil,
) )
c.PacketsSent = prometheus.NewDesc( c.packetsSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "packets_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "packets_sent_total"),
"(PacketsSent)", "(PacketsSent)",
nil, nil,
nil, nil,
) )
c.RXPacketsLost = prometheus.NewDesc( c.rxPacketsLost = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rx_packets_lost_total"), prometheus.BuildFQName(types.Namespace, Name, "rx_packets_lost_total"),
"(RXPacketsLost)", "(RXPacketsLost)",
nil, nil,
nil, nil,
) )
c.SessionDurationSeconds = prometheus.NewDesc( c.sessionDurationSeconds = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "session_duration_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "session_duration_seconds_total"),
"(SessionDurationSeconds)", "(SessionDurationSeconds)",
nil, nil,
nil, nil,
) )
c.TXPacketsLost = prometheus.NewDesc( c.txPacketsLost = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tx_packets_lost_total"), prometheus.BuildFQName(types.Namespace, Name, "tx_packets_lost_total"),
"(TXPacketsLost)", "(TXPacketsLost)",
nil, nil,
nil, nil,
) )
c.ImagingActiveMinimumQuality = prometheus.NewDesc( c.imagingActiveMinimumQuality = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_active_min_quality"), prometheus.BuildFQName(types.Namespace, Name, "imaging_active_min_quality"),
"(ImagingActiveMinimumQuality)", "(ImagingActiveMinimumQuality)",
nil, nil,
nil, nil,
) )
c.ImagingApex2800Offload = prometheus.NewDesc( c.imagingApex2800Offload = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_apex2800_offload"), prometheus.BuildFQName(types.Namespace, Name, "imaging_apex2800_offload"),
"(ImagingApex2800Offload)", "(ImagingApex2800Offload)",
nil, nil,
nil, nil,
) )
c.ImagingBytesReceived = prometheus.NewDesc( c.imagingBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "imaging_bytes_received_total"),
"(ImagingBytesReceived)", "(ImagingBytesReceived)",
nil, nil,
nil, nil,
) )
c.ImagingBytesSent = prometheus.NewDesc( c.imagingBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "imaging_bytes_sent_total"),
"(ImagingBytesSent)", "(ImagingBytesSent)",
nil, nil,
nil, nil,
) )
c.ImagingDecoderCapabilitykbitPersec = prometheus.NewDesc( c.imagingDecoderCapabilityKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_decoder_capability_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "imaging_decoder_capability_KBit_persec"),
"(ImagingDecoderCapabilitykbitPersec)", "(ImagingDecoderCapabilityKBitPerSec)",
nil, nil,
nil, nil,
) )
c.ImagingEncodedFramesPersec = prometheus.NewDesc( c.imagingEncodedFramesPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_encoded_frames_persec"), prometheus.BuildFQName(types.Namespace, Name, "imaging_encoded_frames_persec"),
"(ImagingEncodedFramesPersec)", "(ImagingEncodedFramesPerSec)",
nil, nil,
nil, nil,
) )
c.ImagingMegapixelPersec = prometheus.NewDesc( c.imagingMegapixelPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_megapixel_persec"), prometheus.BuildFQName(types.Namespace, Name, "imaging_megapixel_persec"),
"(ImagingMegapixelPersec)", "(ImagingMegapixelPerSec)",
nil, nil,
nil, nil,
) )
c.ImagingNegativeAcknowledgements = prometheus.NewDesc( c.imagingNegativeAcknowledgements = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_negative_acks_total"), prometheus.BuildFQName(types.Namespace, Name, "imaging_negative_acks_total"),
"(ImagingNegativeAcknowledgements)", "(ImagingNegativeAcknowledgements)",
nil, nil,
nil, nil,
) )
c.ImagingRXBWkbitPersec = prometheus.NewDesc( c.imagingRXBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_rx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "imaging_rx_bw_KBit_persec"),
"(ImagingRXBWkbitPersec)", "(ImagingRXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
c.ImagingSVGAdevTapframesPersec = prometheus.NewDesc( c.imagingSVGAdevTapframesPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_svga_devtap_frames_persec"), prometheus.BuildFQName(types.Namespace, Name, "imaging_svga_devtap_frames_persec"),
"(ImagingSVGAdevTapframesPersec)", "(ImagingSVGAdevTapframesPerSec)",
nil, nil,
nil, nil,
) )
c.ImagingTXBWkbitPersec = prometheus.NewDesc( c.imagingTXBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "imaging_tx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "imaging_tx_bw_KBit_persec"),
"(ImagingTXBWkbitPersec)", "(ImagingTXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
@@ -246,82 +248,82 @@ func (c *Collector) Build() error {
nil, nil,
nil, nil,
) )
c.RXBWkbitPersec = prometheus.NewDesc( c.rxBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "rx_bw_KBit_persec"),
"(RXBWkbitPersec)", "(RXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
c.RXBWPeakkbitPersec = prometheus.NewDesc( c.rxBWPeakKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rx_bw_peak_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "rx_bw_peak_KBit_persec"),
"(RXBWPeakkbitPersec)", "(RXBWPeakKBitPerSec)",
nil, nil,
nil, nil,
) )
c.RXPacketLossPercent = prometheus.NewDesc( c.rxPacketLossPercent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rx_packet_loss_percent"), prometheus.BuildFQName(types.Namespace, Name, "rx_packet_loss_percent"),
"(RXPacketLossPercent)", "(RXPacketLossPercent)",
nil, nil,
nil, nil,
) )
c.RXPacketLossPercent_Base = prometheus.NewDesc( c.rxPacketLossPercentBase = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "rx_packet_loss_percent_base"), prometheus.BuildFQName(types.Namespace, Name, "rx_packet_loss_percent_base"),
"(RXPacketLossPercent_Base)", "(RXPacketLossPercent_Base)",
nil, nil,
nil, nil,
) )
c.TXBWActiveLimitkbitPersec = prometheus.NewDesc( c.txBWActiveLimitKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tx_bw_active_limit_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "tx_bw_active_limit_KBit_persec"),
"(TXBWActiveLimitkbitPersec)", "(TXBWActiveLimitKBitPerSec)",
nil, nil,
nil, nil,
) )
c.TXBWkbitPersec = prometheus.NewDesc( c.txBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "tx_bw_KBit_persec"),
"(TXBWkbitPersec)", "(TXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
c.TXBWLimitkbitPersec = prometheus.NewDesc( c.txBWLimitKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tx_bw_limit_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "tx_bw_limit_KBit_persec"),
"(TXBWLimitkbitPersec)", "(TXBWLimitKBitPerSec)",
nil, nil,
nil, nil,
) )
c.TXPacketLossPercent = prometheus.NewDesc( c.txPacketLossPercent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tx_packet_loss_percent"), prometheus.BuildFQName(types.Namespace, Name, "tx_packet_loss_percent"),
"(TXPacketLossPercent)", "(TXPacketLossPercent)",
nil, nil,
nil, nil,
) )
c.TXPacketLossPercent_Base = prometheus.NewDesc( c.txPacketLossPercentBase = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "tx_packet_loss_percent_base"), prometheus.BuildFQName(types.Namespace, Name, "tx_packet_loss_percent_base"),
"(TXPacketLossPercent_Base)", "(TXPacketLossPercent_Base)",
nil, nil,
nil, nil,
) )
c.USBBytesReceived = prometheus.NewDesc( c.usbBytesReceived = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "usb_bytes_received_total"), prometheus.BuildFQName(types.Namespace, Name, "usb_bytes_received_total"),
"(USBBytesReceived)", "(USBBytesReceived)",
nil, nil,
nil, nil,
) )
c.USBBytesSent = prometheus.NewDesc( c.usbBytesSent = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "usb_bytes_sent_total"), prometheus.BuildFQName(types.Namespace, Name, "usb_bytes_sent_total"),
"(USBBytesSent)", "(USBBytesSent)",
nil, nil,
nil, nil,
) )
c.USBRXBWkbitPersec = prometheus.NewDesc( c.usbRXBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "usb_rx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "usb_rx_bw_KBit_persec"),
"(USBRXBWkbitPersec)", "(USBRXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
c.USBTXBWkbitPersec = prometheus.NewDesc( c.usbTXBWKBitPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "usb_tx_bw_kbit_persec"), prometheus.BuildFQName(types.Namespace, Name, "usb_tx_bw_KBit_persec"),
"(USBTXBWkbitPersec)", "(USBTXBWKBitPerSec)",
nil, nil,
nil, nil,
) )
@@ -357,9 +359,9 @@ func (c *Collector) Collect(_ *types.ScrapeContext, ch chan<- prometheus.Metric)
type win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics struct { type win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics struct {
AudioBytesReceived uint64 AudioBytesReceived uint64
AudioBytesSent uint64 AudioBytesSent uint64
AudioRXBWkbitPersec uint64 AudioRXBWKBitPerSec uint64
AudioTXBWkbitPersec uint64 AudioTXBWKBitPerSec uint64
AudioTXBWLimitkbitPersec uint64 AudioTXBWLimitKBitPerSec uint64
} }
type win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics struct { type win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics struct {
@@ -377,33 +379,33 @@ type win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics struct {
ImagingApex2800Offload uint32 ImagingApex2800Offload uint32
ImagingBytesReceived uint64 ImagingBytesReceived uint64
ImagingBytesSent uint64 ImagingBytesSent uint64
ImagingDecoderCapabilitykbitPersec uint32 ImagingDecoderCapabilityKBitPerSec uint32
ImagingEncodedFramesPersec uint32 ImagingEncodedFramesPerSec uint32
ImagingMegapixelPersec uint32 ImagingMegapixelPerSec uint32
ImagingNegativeAcknowledgements uint32 ImagingNegativeAcknowledgements uint32
ImagingRXBWkbitPersec uint64 ImagingRXBWKBitPerSec uint64
ImagingSVGAdevTapframesPersec uint32 ImagingSVGAdevTapframesPerSec uint32
ImagingTXBWkbitPersec uint64 ImagingTXBWKBitPerSec uint64
} }
type win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics struct { type win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics struct {
RoundTripLatencyms uint32 RoundTripLatencyms uint32
RXBWkbitPersec uint64 RXBWKBitPerSec uint64
RXBWPeakkbitPersec uint32 RXBWPeakKBitPerSec uint32
RXPacketLossPercent uint32 RXPacketLossPercent uint32
RXPacketLossPercent_Base uint32 RXPacketLossPercentBase uint32
TXBWActiveLimitkbitPersec uint32 TXBWActiveLimitKBitPerSec uint32
TXBWkbitPersec uint64 TXBWKBitPerSec uint64
TXBWLimitkbitPersec uint32 TXBWLimitKBitPerSec uint32
TXPacketLossPercent uint32 TXPacketLossPercent uint32
TXPacketLossPercent_Base uint32 TXPacketLossPercentBase uint32
} }
type win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics struct { type win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics struct {
USBBytesReceived uint64 USBBytesReceived uint64
USBBytesSent uint64 USBBytesSent uint64
USBRXBWkbitPersec uint64 USBRXBWKBitPerSec uint64
USBTXBWkbitPersec uint64 USBTXBWKBitPerSec uint64
} }
func (c *Collector) collectAudio(ch chan<- prometheus.Metric) error { func (c *Collector) collectAudio(ch chan<- prometheus.Metric) error {
@@ -417,33 +419,33 @@ func (c *Collector) collectAudio(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AudioBytesReceived, c.audioBytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AudioBytesReceived), float64(dst[0].AudioBytesReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AudioBytesSent, c.audioBytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].AudioBytesSent), float64(dst[0].AudioBytesSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AudioRXBWkbitPersec, c.audioRXBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].AudioRXBWkbitPersec), float64(dst[0].AudioRXBWKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AudioTXBWkbitPersec, c.audioTXBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].AudioTXBWkbitPersec), float64(dst[0].AudioTXBWKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.AudioTXBWLimitkbitPersec, c.audioTXBWLimitKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].AudioTXBWLimitkbitPersec), float64(dst[0].AudioTXBWLimitKBitPerSec),
) )
return nil return nil
@@ -460,43 +462,43 @@ func (c *Collector) collectGeneral(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesReceived, c.bytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].BytesReceived), float64(dst[0].BytesReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.BytesSent, c.bytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].BytesSent), float64(dst[0].BytesSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsReceived, c.packetsReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].PacketsReceived), float64(dst[0].PacketsReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PacketsSent, c.packetsSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].PacketsSent), float64(dst[0].PacketsSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RXPacketsLost, c.rxPacketsLost,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].RXPacketsLost), float64(dst[0].RXPacketsLost),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SessionDurationSeconds, c.sessionDurationSeconds,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].SessionDurationSeconds), float64(dst[0].SessionDurationSeconds),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TXPacketsLost, c.txPacketsLost,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].TXPacketsLost), float64(dst[0].TXPacketsLost),
) )
@@ -515,69 +517,69 @@ func (c *Collector) collectImaging(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingActiveMinimumQuality, c.imagingActiveMinimumQuality,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingActiveMinimumQuality), float64(dst[0].ImagingActiveMinimumQuality),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingApex2800Offload, c.imagingApex2800Offload,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingApex2800Offload), float64(dst[0].ImagingApex2800Offload),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingBytesReceived, c.imagingBytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].ImagingBytesReceived), float64(dst[0].ImagingBytesReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingBytesSent, c.imagingBytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].ImagingBytesSent), float64(dst[0].ImagingBytesSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingDecoderCapabilitykbitPersec, c.imagingDecoderCapabilityKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingDecoderCapabilitykbitPersec), float64(dst[0].ImagingDecoderCapabilityKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingEncodedFramesPersec, c.imagingEncodedFramesPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingEncodedFramesPersec), float64(dst[0].ImagingEncodedFramesPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingMegapixelPersec, c.imagingMegapixelPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingMegapixelPersec), float64(dst[0].ImagingMegapixelPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingNegativeAcknowledgements, c.imagingNegativeAcknowledgements,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].ImagingNegativeAcknowledgements), float64(dst[0].ImagingNegativeAcknowledgements),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingRXBWkbitPersec, c.imagingRXBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingRXBWkbitPersec), float64(dst[0].ImagingRXBWKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingSVGAdevTapframesPersec, c.imagingSVGAdevTapframesPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingSVGAdevTapframesPersec), float64(dst[0].ImagingSVGAdevTapframesPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ImagingTXBWkbitPersec, c.imagingTXBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].ImagingTXBWkbitPersec), float64(dst[0].ImagingTXBWKBitPerSec),
) )
return nil return nil
@@ -600,57 +602,57 @@ func (c *Collector) collectNetwork(ch chan<- prometheus.Metric) error {
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RXBWkbitPersec, c.rxBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].RXBWkbitPersec), float64(dst[0].RXBWKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RXBWPeakkbitPersec, c.rxBWPeakKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].RXBWPeakkbitPersec), float64(dst[0].RXBWPeakKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RXPacketLossPercent, c.rxPacketLossPercent,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].RXPacketLossPercent), float64(dst[0].RXPacketLossPercent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.RXPacketLossPercent_Base, c.rxPacketLossPercentBase,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].RXPacketLossPercent_Base), float64(dst[0].RXPacketLossPercentBase),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TXBWActiveLimitkbitPersec, c.txBWActiveLimitKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].TXBWActiveLimitkbitPersec), float64(dst[0].TXBWActiveLimitKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TXBWkbitPersec, c.txBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].TXBWkbitPersec), float64(dst[0].TXBWKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TXBWLimitkbitPersec, c.txBWLimitKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].TXBWLimitkbitPersec), float64(dst[0].TXBWLimitKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TXPacketLossPercent, c.txPacketLossPercent,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].TXPacketLossPercent), float64(dst[0].TXPacketLossPercent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.TXPacketLossPercent_Base, c.txPacketLossPercentBase,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].TXPacketLossPercent_Base), float64(dst[0].TXPacketLossPercentBase),
) )
return nil return nil
@@ -667,27 +669,27 @@ func (c *Collector) collectUsb(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.USBBytesReceived, c.usbBytesReceived,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].USBBytesReceived), float64(dst[0].USBBytesReceived),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.USBBytesSent, c.usbBytesSent,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].USBBytesSent), float64(dst[0].USBBytesSent),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.USBRXBWkbitPersec, c.usbRXBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].USBRXBWkbitPersec), float64(dst[0].USBRXBWKBitPerSec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.USBTXBWkbitPersec, c.usbTXBWKBitPerSec,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].USBTXBWkbitPersec), float64(dst[0].USBTXBWKBitPerSec),
) )
return nil return nil

View File

@@ -57,22 +57,21 @@ type Collector struct {
hServer syscall.Handle hServer syscall.Handle
SessionInfo *prometheus.Desc sessionInfo *prometheus.Desc
LocalSessionCount *prometheus.Desc connectionBrokerPerformance *prometheus.Desc
ConnectionBrokerPerformance *prometheus.Desc handleCount *prometheus.Desc
HandleCount *prometheus.Desc pageFaultsPerSec *prometheus.Desc
PageFaultsPersec *prometheus.Desc pageFileBytes *prometheus.Desc
PageFileBytes *prometheus.Desc pageFileBytesPeak *prometheus.Desc
PageFileBytesPeak *prometheus.Desc percentCPUTime *prometheus.Desc
PercentCPUTime *prometheus.Desc poolNonPagedBytes *prometheus.Desc
PoolNonpagedBytes *prometheus.Desc poolPagedBytes *prometheus.Desc
PoolPagedBytes *prometheus.Desc privateBytes *prometheus.Desc
PrivateBytes *prometheus.Desc threadCount *prometheus.Desc
ThreadCount *prometheus.Desc virtualBytes *prometheus.Desc
VirtualBytes *prometheus.Desc virtualBytesPeak *prometheus.Desc
VirtualBytesPeak *prometheus.Desc workingSet *prometheus.Desc
WorkingSet *prometheus.Desc workingSetPeak *prometheus.Desc
WorkingSetPeak *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -114,91 +113,91 @@ func (c *Collector) Close() error {
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.connectionBrokerEnabled = isConnectionBrokerServer(c.logger) c.connectionBrokerEnabled = isConnectionBrokerServer(c.logger)
c.SessionInfo = prometheus.NewDesc( c.sessionInfo = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "session_info"), prometheus.BuildFQName(types.Namespace, Name, "session_info"),
"Terminal Services sessions info", "Terminal Services sessions info",
[]string{"session_name", "user", "host", "state"}, []string{"session_name", "user", "host", "state"},
nil, nil,
) )
c.ConnectionBrokerPerformance = prometheus.NewDesc( c.connectionBrokerPerformance = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "connection_broker_performance_total"), prometheus.BuildFQName(types.Namespace, Name, "connection_broker_performance_total"),
"The total number of connections handled by the Connection Brokers since the service started.", "The total number of connections handled by the Connection Brokers since the service started.",
[]string{"connection"}, []string{"connection"},
nil, nil,
) )
c.HandleCount = prometheus.NewDesc( c.handleCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "handles"), prometheus.BuildFQName(types.Namespace, Name, "handles"),
"Total number of handles currently opened by this process. This number is the sum of the handles currently opened by each thread in this process.", "Total number of handles currently opened by this process. This number is the sum of the handles currently opened by each thread in this process.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.PageFaultsPersec = prometheus.NewDesc( c.pageFaultsPerSec = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_fault_total"), prometheus.BuildFQName(types.Namespace, Name, "page_fault_total"),
"Rate at which page faults occur in the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. The page may not be retrieved from disk if it is on the standby list and therefore already in main memory. The page also may not be retrieved if it is in use by another process which shares the page.", "Rate at which page faults occur in the threads executing in this process. A page fault occurs when a thread refers to a virtual memory page that is not in its working set in main memory. The page may not be retrieved from disk if it is on the standby list and therefore already in main memory. The page also may not be retrieved if it is in use by another process which shares the page.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.PageFileBytes = prometheus.NewDesc( c.pageFileBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes"), prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes"),
"Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.", "Current number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.PageFileBytesPeak = prometheus.NewDesc( c.pageFileBytesPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes_peak"), prometheus.BuildFQName(types.Namespace, Name, "page_file_bytes_peak"),
"Maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.", "Maximum number of bytes this process has used in the paging file(s). Paging files are used to store pages of memory used by the process that are not contained in other files. Paging files are shared by all processes, and lack of space in paging files can prevent other processes from allocating memory.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.PercentCPUTime = prometheus.NewDesc( c.percentCPUTime = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_time_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "cpu_time_seconds_total"),
"Total elapsed time that this process's threads have spent executing code.", "Total elapsed time that this process's threads have spent executing code.",
[]string{"mode", "session_name"}, []string{"mode", "session_name"},
nil, nil,
) )
c.PoolNonpagedBytes = prometheus.NewDesc( c.poolNonPagedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_non_paged_bytes"), prometheus.BuildFQName(types.Namespace, Name, "pool_non_paged_bytes"),
"Number of bytes in the non-paged pool, an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. This property displays the last observed value only; it is not an average.", "Number of bytes in the non-paged pool, an area of system memory (physical memory used by the operating system) for objects that cannot be written to disk, but must remain in physical memory as long as they are allocated. This property displays the last observed value only; it is not an average.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.PoolPagedBytes = prometheus.NewDesc( c.poolPagedBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "pool_paged_bytes"), prometheus.BuildFQName(types.Namespace, Name, "pool_paged_bytes"),
"Number of bytes in the paged pool, an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. This property displays the last observed value only; it is not an average.", "Number of bytes in the paged pool, an area of system memory (physical memory used by the operating system) for objects that can be written to disk when they are not being used. This property displays the last observed value only; it is not an average.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.PrivateBytes = prometheus.NewDesc( c.privateBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "private_bytes"), prometheus.BuildFQName(types.Namespace, Name, "private_bytes"),
"Current number of bytes this process has allocated that cannot be shared with other processes.", "Current number of bytes this process has allocated that cannot be shared with other processes.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.ThreadCount = prometheus.NewDesc( c.threadCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "threads"), prometheus.BuildFQName(types.Namespace, Name, "threads"),
"Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread.", "Number of threads currently active in this process. An instruction is the basic unit of execution in a processor, and a thread is the object that executes instructions. Every running process has at least one thread.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.VirtualBytes = prometheus.NewDesc( c.virtualBytes = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes"), prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes"),
"Current size, in bytes, of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries.", "Current size, in bytes, of the virtual address space the process is using. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process can limit its ability to load libraries.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.VirtualBytesPeak = prometheus.NewDesc( c.virtualBytesPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes_peak"), prometheus.BuildFQName(types.Namespace, Name, "virtual_bytes_peak"),
"Maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process might limit its ability to load libraries.", "Maximum number of bytes of virtual address space the process has used at any one time. Use of virtual address space does not necessarily imply corresponding use of either disk or main memory pages. Virtual space is finite and, by using too much, the process might limit its ability to load libraries.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.WorkingSet = prometheus.NewDesc( c.workingSet = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes"), prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes"),
"Current number of bytes in the working set of this process. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory.", "Current number of bytes in the working set of this process. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory.",
[]string{"session_name"}, []string{"session_name"},
nil, nil,
) )
c.WorkingSetPeak = prometheus.NewDesc( c.workingSetPeak = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes_peak"), prometheus.BuildFQName(types.Namespace, Name, "working_set_bytes_peak"),
"Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory.", "Maximum number of bytes in the working set of this process at any point in time. The working set is the set of memory pages touched recently by the threads in the process. If free memory in the computer is above a threshold, pages are left in the working set of a process even if they are not in use. When free memory falls below a threshold, pages are trimmed from working sets. If they are needed, they are then soft-faulted back into the working set before they leave main memory.",
[]string{"session_name"}, []string{"session_name"},
@@ -277,94 +276,94 @@ func (c *Collector) collectTSSessionCounters(ctx *types.ScrapeContext, ch chan<-
names[n] = true names[n] = true
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HandleCount, c.handleCount,
prometheus.GaugeValue, prometheus.GaugeValue,
d.HandleCount, d.HandleCount,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PageFaultsPersec, c.pageFaultsPerSec,
prometheus.CounterValue, prometheus.CounterValue,
d.PageFaultsPersec, d.PageFaultsPersec,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PageFileBytes, c.pageFileBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
d.PageFileBytes, d.PageFileBytes,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PageFileBytesPeak, c.pageFileBytesPeak,
prometheus.GaugeValue, prometheus.GaugeValue,
d.PageFileBytesPeak, d.PageFileBytesPeak,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PercentCPUTime, c.percentCPUTime,
prometheus.CounterValue, prometheus.CounterValue,
d.PercentPrivilegedTime, d.PercentPrivilegedTime,
d.Name, d.Name,
"privileged", "privileged",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PercentCPUTime, c.percentCPUTime,
prometheus.CounterValue, prometheus.CounterValue,
d.PercentProcessorTime, d.PercentProcessorTime,
d.Name, d.Name,
"processor", "processor",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PercentCPUTime, c.percentCPUTime,
prometheus.CounterValue, prometheus.CounterValue,
d.PercentUserTime, d.PercentUserTime,
d.Name, d.Name,
"user", "user",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolNonpagedBytes, c.poolNonPagedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
d.PoolNonpagedBytes, d.PoolNonpagedBytes,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PoolPagedBytes, c.poolPagedBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
d.PoolPagedBytes, d.PoolPagedBytes,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PrivateBytes, c.privateBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
d.PrivateBytes, d.PrivateBytes,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ThreadCount, c.threadCount,
prometheus.GaugeValue, prometheus.GaugeValue,
d.ThreadCount, d.ThreadCount,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.VirtualBytes, c.virtualBytes,
prometheus.GaugeValue, prometheus.GaugeValue,
d.VirtualBytes, d.VirtualBytes,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.VirtualBytesPeak, c.virtualBytesPeak,
prometheus.GaugeValue, prometheus.GaugeValue,
d.VirtualBytesPeak, d.VirtualBytesPeak,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WorkingSet, c.workingSet,
prometheus.GaugeValue, prometheus.GaugeValue,
d.WorkingSet, d.WorkingSet,
d.Name, d.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.WorkingSetPeak, c.workingSetPeak,
prometheus.GaugeValue, prometheus.GaugeValue,
d.WorkingSetPeak, d.WorkingSetPeak,
d.Name, d.Name,
@@ -390,21 +389,21 @@ func (c *Collector) collectCollectionBrokerPerformanceCounter(ctx *types.ScrapeC
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionBrokerPerformance, c.connectionBrokerPerformance,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].SuccessfulConnections, dst[0].SuccessfulConnections,
"Successful", "Successful",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionBrokerPerformance, c.connectionBrokerPerformance,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].PendingConnections, dst[0].PendingConnections,
"Pending", "Pending",
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ConnectionBrokerPerformance, c.connectionBrokerPerformance,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].FailedConnections, dst[0].FailedConnections,
"Failed", "Failed",
@@ -432,7 +431,7 @@ func (c *Collector) collectWTSSessions(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SessionInfo, c.sessionInfo,
prometheus.GaugeValue, prometheus.GaugeValue,
isState, isState,
strings.Replace(session.SessionName, "#", " ", -1), strings.Replace(session.SessionName, "#", " ", -1),

View File

@@ -54,9 +54,9 @@ type Collector struct {
directories string directories string
// Only set for testing to get predictable output. // Only set for testing to get predictable output.
mtime *float64 mTime *float64
mtimeDesc *prometheus.Desc mTimeDesc *prometheus.Desc
} }
func New(logger log.Logger, config *Config) *Collector { func New(logger log.Logger, config *Config) *Collector {
@@ -105,7 +105,7 @@ func (c *Collector) Build() error {
_ = level.Info(c.logger).Log("msg", "textfile Collector directories: "+c.directories) _ = level.Info(c.logger).Log("msg", "textfile Collector directories: "+c.directories)
c.mtimeDesc = prometheus.NewDesc( c.mTimeDesc = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, "textfile", "mtime_seconds"), prometheus.BuildFQName(types.Namespace, "textfile", "mtime_seconds"),
"Unixtime mtime of textfiles successfully read.", "Unixtime mtime of textfiles successfully read.",
[]string{"file"}, []string{"file"},
@@ -254,10 +254,10 @@ func (c *Collector) exportMTimes(mtimes map[string]time.Time, ch chan<- promethe
for _, filename := range filenames { for _, filename := range filenames {
mtime := float64(mtimes[filename].UnixNano() / 1e9) mtime := float64(mtimes[filename].UnixNano() / 1e9)
if c.mtime != nil { if c.mTime != nil {
mtime = *c.mtime mtime = *c.mTime
} }
ch <- prometheus.MustNewConstMetric(c.mtimeDesc, prometheus.GaugeValue, mtime, filename) ch <- prometheus.MustNewConstMetric(c.mTimeDesc, prometheus.GaugeValue, mtime, filename)
} }
} }
} }

View File

@@ -23,9 +23,9 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
PercentPassiveLimit *prometheus.Desc percentPassiveLimit *prometheus.Desc
Temperature *prometheus.Desc temperature *prometheus.Desc
ThrottleReasons *prometheus.Desc throttleReasons *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -56,7 +56,7 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.Temperature = prometheus.NewDesc( c.temperature = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "temperature_celsius"), prometheus.BuildFQName(types.Namespace, Name, "temperature_celsius"),
"(Temperature)", "(Temperature)",
[]string{ []string{
@@ -64,7 +64,7 @@ func (c *Collector) Build() error {
}, },
nil, nil,
) )
c.PercentPassiveLimit = prometheus.NewDesc( c.percentPassiveLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "percent_passive_limit"), prometheus.BuildFQName(types.Namespace, Name, "percent_passive_limit"),
"(PercentPassiveLimit)", "(PercentPassiveLimit)",
[]string{ []string{
@@ -72,7 +72,7 @@ func (c *Collector) Build() error {
}, },
nil, nil,
) )
c.ThrottleReasons = prometheus.NewDesc( c.throttleReasons = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "throttle_reasons"), prometheus.BuildFQName(types.Namespace, Name, "throttle_reasons"),
"(ThrottleReasons)", "(ThrottleReasons)",
[]string{ []string{
@@ -118,21 +118,21 @@ func (c *Collector) collect(ch chan<- prometheus.Metric) error {
for _, info := range dst { for _, info := range dst {
// Divide by 10 and subtract 273.15 to convert decikelvin to celsius // Divide by 10 and subtract 273.15 to convert decikelvin to celsius
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Temperature, c.temperature,
prometheus.GaugeValue, prometheus.GaugeValue,
(float64(info.HighPrecisionTemperature)/10.0)-273.15, (float64(info.HighPrecisionTemperature)/10.0)-273.15,
info.Name, info.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.PercentPassiveLimit, c.percentPassiveLimit,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(info.PercentPassiveLimit), float64(info.PercentPassiveLimit),
info.Name, info.Name,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ThrottleReasons, c.throttleReasons,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(info.ThrottleReasons), float64(info.ThrottleReasons),
info.Name, info.Name,

View File

@@ -24,12 +24,12 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
ClockFrequencyAdjustmentPPBTotal *prometheus.Desc clockFrequencyAdjustmentPPBTotal *prometheus.Desc
ComputedTimeOffset *prometheus.Desc computedTimeOffset *prometheus.Desc
NTPClientTimeSourceCount *prometheus.Desc ntpClientTimeSourceCount *prometheus.Desc
NTPRoundtripDelay *prometheus.Desc ntpRoundTripDelay *prometheus.Desc
NTPServerIncomingRequestsTotal *prometheus.Desc ntpServerIncomingRequestsTotal *prometheus.Desc
NTPServerOutgoingResponsesTotal *prometheus.Desc ntpServerOutgoingResponsesTotal *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -64,37 +64,37 @@ func (c *Collector) Build() error {
return errors.New("Windows version older than Server 2016 detected. The time collector will not run and should be disabled via CLI flags or configuration file") return errors.New("Windows version older than Server 2016 detected. The time collector will not run and should be disabled via CLI flags or configuration file")
} }
c.ClockFrequencyAdjustmentPPBTotal = prometheus.NewDesc( c.clockFrequencyAdjustmentPPBTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "clock_frequency_adjustment_ppb_total"), prometheus.BuildFQName(types.Namespace, Name, "clock_frequency_adjustment_ppb_total"),
"Total adjustment made to the local system clock frequency by W32Time in Parts Per Billion (PPB) units.", "Total adjustment made to the local system clock frequency by W32Time in Parts Per Billion (PPB) units.",
nil, nil,
nil, nil,
) )
c.ComputedTimeOffset = prometheus.NewDesc( c.computedTimeOffset = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "computed_time_offset_seconds"), prometheus.BuildFQName(types.Namespace, Name, "computed_time_offset_seconds"),
"Absolute time offset between the system clock and the chosen time source, in seconds", "Absolute time offset between the system clock and the chosen time source, in seconds",
nil, nil,
nil, nil,
) )
c.NTPClientTimeSourceCount = prometheus.NewDesc( c.ntpClientTimeSourceCount = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ntp_client_time_sources"), prometheus.BuildFQName(types.Namespace, Name, "ntp_client_time_sources"),
"Active number of NTP Time sources being used by the client", "Active number of NTP Time sources being used by the client",
nil, nil,
nil, nil,
) )
c.NTPRoundtripDelay = prometheus.NewDesc( c.ntpRoundTripDelay = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ntp_round_trip_delay_seconds"), prometheus.BuildFQName(types.Namespace, Name, "ntp_round_trip_delay_seconds"),
"Roundtrip delay experienced by the NTP client in receiving a response from the server for the most recent request, in seconds", "Roundtrip delay experienced by the NTP client in receiving a response from the server for the most recent request, in seconds",
nil, nil,
nil, nil,
) )
c.NTPServerOutgoingResponsesTotal = prometheus.NewDesc( c.ntpServerOutgoingResponsesTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ntp_server_outgoing_responses_total"), prometheus.BuildFQName(types.Namespace, Name, "ntp_server_outgoing_responses_total"),
"Total number of requests responded to by NTP server", "Total number of requests responded to by NTP server",
nil, nil,
nil, nil,
) )
c.NTPServerIncomingRequestsTotal = prometheus.NewDesc( c.ntpServerIncomingRequestsTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "ntp_server_incoming_requests_total"), prometheus.BuildFQName(types.Namespace, Name, "ntp_server_incoming_requests_total"),
"Total number of requests received by NTP server", "Total number of requests received by NTP server",
nil, nil,
@@ -130,32 +130,32 @@ func (c *Collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ClockFrequencyAdjustmentPPBTotal, c.clockFrequencyAdjustmentPPBTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].ClockFrequencyAdjustmentPPBTotal, dst[0].ClockFrequencyAdjustmentPPBTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ComputedTimeOffset, c.computedTimeOffset,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].ComputedTimeOffset/1000000, // microseconds -> seconds dst[0].ComputedTimeOffset/1000000, // microseconds -> seconds
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NTPClientTimeSourceCount, c.ntpClientTimeSourceCount,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].NTPClientTimeSourceCount, dst[0].NTPClientTimeSourceCount,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NTPRoundtripDelay, c.ntpRoundTripDelay,
prometheus.GaugeValue, prometheus.GaugeValue,
dst[0].NTPRoundtripDelay/1000000, // microseconds -> seconds dst[0].NTPRoundtripDelay/1000000, // microseconds -> seconds
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NTPServerIncomingRequestsTotal, c.ntpServerIncomingRequestsTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].NTPServerIncomingRequestsTotal, dst[0].NTPServerIncomingRequestsTotal,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.NTPServerOutgoingResponsesTotal, c.ntpServerOutgoingResponsesTotal,
prometheus.CounterValue, prometheus.CounterValue,
dst[0].NTPServerOutgoingResponsesTotal, dst[0].NTPServerOutgoingResponsesTotal,
) )

View File

@@ -24,26 +24,26 @@ var ConfigDefaults = Config{}
type Collector struct { type Collector struct {
logger log.Logger logger log.Logger
MemActive *prometheus.Desc memActive *prometheus.Desc
MemBallooned *prometheus.Desc memBallooned *prometheus.Desc
MemLimit *prometheus.Desc memLimit *prometheus.Desc
MemMapped *prometheus.Desc memMapped *prometheus.Desc
MemOverhead *prometheus.Desc memOverhead *prometheus.Desc
MemReservation *prometheus.Desc memReservation *prometheus.Desc
MemShared *prometheus.Desc memShared *prometheus.Desc
MemSharedSaved *prometheus.Desc memSharedSaved *prometheus.Desc
MemShares *prometheus.Desc memShares *prometheus.Desc
MemSwapped *prometheus.Desc memSwapped *prometheus.Desc
MemTargetSize *prometheus.Desc memTargetSize *prometheus.Desc
MemUsed *prometheus.Desc memUsed *prometheus.Desc
CpuLimitMHz *prometheus.Desc cpuLimitMHz *prometheus.Desc
CpuReservationMHz *prometheus.Desc cpuReservationMHz *prometheus.Desc
CpuShares *prometheus.Desc cpuShares *prometheus.Desc
CpuStolenTotal *prometheus.Desc cpuStolenTotal *prometheus.Desc
CpuTimeTotal *prometheus.Desc cpuTimeTotal *prometheus.Desc
EffectiveVMSpeedMHz *prometheus.Desc effectiveVMSpeedMHz *prometheus.Desc
HostProcessorSpeedMHz *prometheus.Desc hostProcessorSpeedMHz *prometheus.Desc
} }
func New(logger log.Logger, _ *Config) *Collector { func New(logger log.Logger, _ *Config) *Collector {
@@ -74,116 +74,116 @@ func (c *Collector) Close() error {
} }
func (c *Collector) Build() error { func (c *Collector) Build() error {
c.MemActive = prometheus.NewDesc( c.memActive = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_active_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_active_bytes"),
"(MemActiveMB)", "(MemActiveMB)",
nil, nil,
nil, nil,
) )
c.MemBallooned = prometheus.NewDesc( c.memBallooned = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_ballooned_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_ballooned_bytes"),
"(MemBalloonedMB)", "(MemBalloonedMB)",
nil, nil,
nil, nil,
) )
c.MemLimit = prometheus.NewDesc( c.memLimit = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_limit_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_limit_bytes"),
"(MemLimitMB)", "(MemLimitMB)",
nil, nil,
nil, nil,
) )
c.MemMapped = prometheus.NewDesc( c.memMapped = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_mapped_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_mapped_bytes"),
"(MemMappedMB)", "(MemMappedMB)",
nil, nil,
nil, nil,
) )
c.MemOverhead = prometheus.NewDesc( c.memOverhead = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_overhead_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_overhead_bytes"),
"(MemOverheadMB)", "(MemOverheadMB)",
nil, nil,
nil, nil,
) )
c.MemReservation = prometheus.NewDesc( c.memReservation = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_reservation_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_reservation_bytes"),
"(MemReservationMB)", "(MemReservationMB)",
nil, nil,
nil, nil,
) )
c.MemShared = prometheus.NewDesc( c.memShared = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_shared_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_shared_bytes"),
"(MemSharedMB)", "(MemSharedMB)",
nil, nil,
nil, nil,
) )
c.MemSharedSaved = prometheus.NewDesc( c.memSharedSaved = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_shared_saved_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_shared_saved_bytes"),
"(MemSharedSavedMB)", "(MemSharedSavedMB)",
nil, nil,
nil, nil,
) )
c.MemShares = prometheus.NewDesc( c.memShares = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_shares"), prometheus.BuildFQName(types.Namespace, Name, "mem_shares"),
"(MemShares)", "(MemShares)",
nil, nil,
nil, nil,
) )
c.MemSwapped = prometheus.NewDesc( c.memSwapped = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_swapped_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_swapped_bytes"),
"(MemSwappedMB)", "(MemSwappedMB)",
nil, nil,
nil, nil,
) )
c.MemTargetSize = prometheus.NewDesc( c.memTargetSize = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_target_size_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_target_size_bytes"),
"(MemTargetSizeMB)", "(MemTargetSizeMB)",
nil, nil,
nil, nil,
) )
c.MemUsed = prometheus.NewDesc( c.memUsed = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "mem_used_bytes"), prometheus.BuildFQName(types.Namespace, Name, "mem_used_bytes"),
"(MemUsedMB)", "(MemUsedMB)",
nil, nil,
nil, nil,
) )
c.CpuLimitMHz = prometheus.NewDesc( c.cpuLimitMHz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_limit_mhz"), prometheus.BuildFQName(types.Namespace, Name, "cpu_limit_mhz"),
"(CpuLimitMHz)", "(CpuLimitMHz)",
nil, nil,
nil, nil,
) )
c.CpuReservationMHz = prometheus.NewDesc( c.cpuReservationMHz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_reservation_mhz"), prometheus.BuildFQName(types.Namespace, Name, "cpu_reservation_mhz"),
"(CpuReservationMHz)", "(CpuReservationMHz)",
nil, nil,
nil, nil,
) )
c.CpuShares = prometheus.NewDesc( c.cpuShares = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_shares"), prometheus.BuildFQName(types.Namespace, Name, "cpu_shares"),
"(CpuShares)", "(CpuShares)",
nil, nil,
nil, nil,
) )
c.CpuStolenTotal = prometheus.NewDesc( c.cpuStolenTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_stolen_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "cpu_stolen_seconds_total"),
"(CpuStolenMs)", "(CpuStolenMs)",
nil, nil,
nil, nil,
) )
c.CpuTimeTotal = prometheus.NewDesc( c.cpuTimeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "cpu_time_seconds_total"), prometheus.BuildFQName(types.Namespace, Name, "cpu_time_seconds_total"),
"(CpuTimePercents)", "(CpuTimePercents)",
nil, nil,
nil, nil,
) )
c.EffectiveVMSpeedMHz = prometheus.NewDesc( c.effectiveVMSpeedMHz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "effective_vm_speed_mhz"), prometheus.BuildFQName(types.Namespace, Name, "effective_vm_speed_mhz"),
"(EffectiveVMSpeedMHz)", "(EffectiveVMSpeedMHz)",
nil, nil,
nil, nil,
) )
c.HostProcessorSpeedMHz = prometheus.NewDesc( c.hostProcessorSpeedMHz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "host_processor_speed_mhz"), prometheus.BuildFQName(types.Namespace, Name, "host_processor_speed_mhz"),
"(HostProcessorSpeedMHz)", "(HostProcessorSpeedMHz)",
nil, nil,
@@ -242,73 +242,73 @@ func (c *Collector) collectMem(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemActive, c.memActive,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemActiveMB), mbToBytes(dst[0].MemActiveMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemBallooned, c.memBallooned,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemBalloonedMB), mbToBytes(dst[0].MemBalloonedMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemLimit, c.memLimit,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemLimitMB), mbToBytes(dst[0].MemLimitMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemMapped, c.memMapped,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemMappedMB), mbToBytes(dst[0].MemMappedMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemOverhead, c.memOverhead,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemOverheadMB), mbToBytes(dst[0].MemOverheadMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemReservation, c.memReservation,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemReservationMB), mbToBytes(dst[0].MemReservationMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemShared, c.memShared,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemSharedMB), mbToBytes(dst[0].MemSharedMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemSharedSaved, c.memSharedSaved,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemSharedSavedMB), mbToBytes(dst[0].MemSharedSavedMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemShares, c.memShares,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].MemShares), float64(dst[0].MemShares),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemSwapped, c.memSwapped,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemSwappedMB), mbToBytes(dst[0].MemSwappedMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemTargetSize, c.memTargetSize,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemTargetSizeMB), mbToBytes(dst[0].MemTargetSizeMB),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.MemUsed, c.memUsed,
prometheus.GaugeValue, prometheus.GaugeValue,
mbToBytes(dst[0].MemUsedMB), mbToBytes(dst[0].MemUsedMB),
) )
@@ -331,43 +331,43 @@ func (c *Collector) collectCpu(ch chan<- prometheus.Metric) error {
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CpuLimitMHz, c.cpuLimitMHz,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].CpuLimitMHz), float64(dst[0].CpuLimitMHz),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CpuReservationMHz, c.cpuReservationMHz,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].CpuReservationMHz), float64(dst[0].CpuReservationMHz),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CpuShares, c.cpuShares,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].CpuShares), float64(dst[0].CpuShares),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CpuStolenTotal, c.cpuStolenTotal,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].CpuStolenMs)*perflib.TicksToSecondScaleFactor, float64(dst[0].CpuStolenMs)*perflib.TicksToSecondScaleFactor,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.CpuTimeTotal, c.cpuTimeTotal,
prometheus.CounterValue, prometheus.CounterValue,
float64(dst[0].CpuTimePercents)*perflib.TicksToSecondScaleFactor, float64(dst[0].CpuTimePercents)*perflib.TicksToSecondScaleFactor,
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.EffectiveVMSpeedMHz, c.effectiveVMSpeedMHz,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].EffectiveVMSpeedMHz), float64(dst[0].EffectiveVMSpeedMHz),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.HostProcessorSpeedMHz, c.hostProcessorSpeedMHz,
prometheus.GaugeValue, prometheus.GaugeValue,
float64(dst[0].HostProcessorSpeedMHz), float64(dst[0].HostProcessorSpeedMHz),
) )

File diff suppressed because it is too large Load Diff