commit
44e5f5f53b
6 changed files with 145 additions and 68 deletions
|
|
@ -8,8 +8,10 @@ go:
|
|||
|
||||
install:
|
||||
- go get -d
|
||||
- go get golang.org/x/tools/cmd/vet
|
||||
|
||||
script:
|
||||
- go vet
|
||||
- go test -v ./...
|
||||
- go build
|
||||
- ./end-to-end-test.sh -v
|
||||
- ./end-to-end-test.sh
|
||||
|
|
|
|||
|
|
@ -9,7 +9,76 @@ go_gc_duration_seconds_sum 0
|
|||
go_gc_duration_seconds_count 0
|
||||
# HELP go_goroutines Number of goroutines that currently exist.
|
||||
# TYPE go_goroutines gauge
|
||||
go_goroutines 25
|
||||
go_goroutines 15
|
||||
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
|
||||
# TYPE go_memstats_alloc_bytes gauge
|
||||
go_memstats_alloc_bytes 1.03544e+06
|
||||
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
|
||||
# TYPE go_memstats_alloc_bytes_total counter
|
||||
go_memstats_alloc_bytes_total 1.03544e+06
|
||||
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
|
||||
# TYPE go_memstats_buck_hash_sys_bytes gauge
|
||||
go_memstats_buck_hash_sys_bytes 1.443595e+06
|
||||
# HELP go_memstats_frees_total Total number of frees.
|
||||
# TYPE go_memstats_frees_total counter
|
||||
go_memstats_frees_total 0
|
||||
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
|
||||
# TYPE go_memstats_gc_sys_bytes gauge
|
||||
go_memstats_gc_sys_bytes 98304
|
||||
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
|
||||
# TYPE go_memstats_heap_alloc_bytes gauge
|
||||
go_memstats_heap_alloc_bytes 1.03544e+06
|
||||
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
|
||||
# TYPE go_memstats_heap_idle_bytes gauge
|
||||
go_memstats_heap_idle_bytes 761856
|
||||
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
|
||||
# TYPE go_memstats_heap_inuse_bytes gauge
|
||||
go_memstats_heap_inuse_bytes 1.892352e+06
|
||||
# HELP go_memstats_heap_objects Number of allocated objects.
|
||||
# TYPE go_memstats_heap_objects gauge
|
||||
go_memstats_heap_objects 4073
|
||||
# HELP go_memstats_heap_released_bytes_total Total number of heap bytes released to OS.
|
||||
# TYPE go_memstats_heap_released_bytes_total counter
|
||||
go_memstats_heap_released_bytes_total 0
|
||||
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
|
||||
# TYPE go_memstats_heap_sys_bytes gauge
|
||||
go_memstats_heap_sys_bytes 2.654208e+06
|
||||
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
|
||||
# TYPE go_memstats_last_gc_time_seconds gauge
|
||||
go_memstats_last_gc_time_seconds 9
|
||||
# HELP go_memstats_lookups_total Total number of pointer lookups.
|
||||
# TYPE go_memstats_lookups_total counter
|
||||
go_memstats_lookups_total 10
|
||||
# HELP go_memstats_mallocs_total Total number of mallocs.
|
||||
# TYPE go_memstats_mallocs_total counter
|
||||
go_memstats_mallocs_total 4073
|
||||
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
|
||||
# TYPE go_memstats_mcache_inuse_bytes gauge
|
||||
go_memstats_mcache_inuse_bytes 9664
|
||||
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
|
||||
# TYPE go_memstats_mcache_sys_bytes gauge
|
||||
go_memstats_mcache_sys_bytes 16384
|
||||
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
|
||||
# TYPE go_memstats_mspan_inuse_bytes gauge
|
||||
go_memstats_mspan_inuse_bytes 18144
|
||||
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
|
||||
# TYPE go_memstats_mspan_sys_bytes gauge
|
||||
go_memstats_mspan_sys_bytes 32768
|
||||
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
|
||||
# TYPE go_memstats_next_gc_bytes gauge
|
||||
go_memstats_next_gc_bytes 4.194304e+06
|
||||
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
|
||||
# TYPE go_memstats_other_sys_bytes gauge
|
||||
go_memstats_other_sys_bytes 1.065453e+06
|
||||
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
|
||||
# TYPE go_memstats_stack_inuse_bytes gauge
|
||||
go_memstats_stack_inuse_bytes 491520
|
||||
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
|
||||
# TYPE go_memstats_stack_sys_bytes gauge
|
||||
go_memstats_stack_sys_bytes 491520
|
||||
# HELP go_memstats_sys_bytes Number of bytes obtained by system. Sum of all system allocations.
|
||||
# TYPE go_memstats_sys_bytes gauge
|
||||
go_memstats_sys_bytes 5.802232e+06
|
||||
# HELP http_request_duration_microseconds The HTTP request latencies in microseconds.
|
||||
# TYPE http_request_duration_microseconds summary
|
||||
http_request_duration_microseconds{handler="prometheus",quantile="0.5"} NaN
|
||||
|
|
@ -267,65 +336,65 @@ node_disk_writes_merged{device="sr0"} 0
|
|||
node_disk_writes_merged{device="vda"} 2.0711856e+07
|
||||
# HELP node_exporter_scrape_duration_seconds node_exporter: Duration of a scrape job.
|
||||
# TYPE node_exporter_scrape_duration_seconds summary
|
||||
node_exporter_scrape_duration_seconds{collector="bonding",result="success",quantile="0.5"} 0.0005968610000000001
|
||||
node_exporter_scrape_duration_seconds{collector="bonding",result="success",quantile="0.9"} 0.0005968610000000001
|
||||
node_exporter_scrape_duration_seconds{collector="bonding",result="success",quantile="0.99"} 0.0005968610000000001
|
||||
node_exporter_scrape_duration_seconds_sum{collector="bonding",result="success"} 0.0005968610000000001
|
||||
node_exporter_scrape_duration_seconds{collector="bonding",result="success",quantile="0.5"} 0.003508526
|
||||
node_exporter_scrape_duration_seconds{collector="bonding",result="success",quantile="0.9"} 0.003508526
|
||||
node_exporter_scrape_duration_seconds{collector="bonding",result="success",quantile="0.99"} 0.003508526
|
||||
node_exporter_scrape_duration_seconds_sum{collector="bonding",result="success"} 0.003508526
|
||||
node_exporter_scrape_duration_seconds_count{collector="bonding",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="diskstats",result="success",quantile="0.5"} 0.003440377
|
||||
node_exporter_scrape_duration_seconds{collector="diskstats",result="success",quantile="0.9"} 0.003440377
|
||||
node_exporter_scrape_duration_seconds{collector="diskstats",result="success",quantile="0.99"} 0.003440377
|
||||
node_exporter_scrape_duration_seconds_sum{collector="diskstats",result="success"} 0.003440377
|
||||
node_exporter_scrape_duration_seconds{collector="diskstats",result="success",quantile="0.5"} 0.00553251
|
||||
node_exporter_scrape_duration_seconds{collector="diskstats",result="success",quantile="0.9"} 0.00553251
|
||||
node_exporter_scrape_duration_seconds{collector="diskstats",result="success",quantile="0.99"} 0.00553251
|
||||
node_exporter_scrape_duration_seconds_sum{collector="diskstats",result="success"} 0.00553251
|
||||
node_exporter_scrape_duration_seconds_count{collector="diskstats",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="filefd",result="success",quantile="0.5"} 0.000100198
|
||||
node_exporter_scrape_duration_seconds{collector="filefd",result="success",quantile="0.9"} 0.000100198
|
||||
node_exporter_scrape_duration_seconds{collector="filefd",result="success",quantile="0.99"} 0.000100198
|
||||
node_exporter_scrape_duration_seconds_sum{collector="filefd",result="success"} 0.000100198
|
||||
node_exporter_scrape_duration_seconds{collector="filefd",result="success",quantile="0.5"} 0.00027980400000000003
|
||||
node_exporter_scrape_duration_seconds{collector="filefd",result="success",quantile="0.9"} 0.00027980400000000003
|
||||
node_exporter_scrape_duration_seconds{collector="filefd",result="success",quantile="0.99"} 0.00027980400000000003
|
||||
node_exporter_scrape_duration_seconds_sum{collector="filefd",result="success"} 0.00027980400000000003
|
||||
node_exporter_scrape_duration_seconds_count{collector="filefd",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="loadavg",result="success",quantile="0.5"} 0.0006679730000000001
|
||||
node_exporter_scrape_duration_seconds{collector="loadavg",result="success",quantile="0.9"} 0.0006679730000000001
|
||||
node_exporter_scrape_duration_seconds{collector="loadavg",result="success",quantile="0.99"} 0.0006679730000000001
|
||||
node_exporter_scrape_duration_seconds_sum{collector="loadavg",result="success"} 0.0006679730000000001
|
||||
node_exporter_scrape_duration_seconds{collector="loadavg",result="success",quantile="0.5"} 0.000181632
|
||||
node_exporter_scrape_duration_seconds{collector="loadavg",result="success",quantile="0.9"} 0.000181632
|
||||
node_exporter_scrape_duration_seconds{collector="loadavg",result="success",quantile="0.99"} 0.000181632
|
||||
node_exporter_scrape_duration_seconds_sum{collector="loadavg",result="success"} 0.000181632
|
||||
node_exporter_scrape_duration_seconds_count{collector="loadavg",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="mdadm",result="success",quantile="0.5"} 0.0033833780000000003
|
||||
node_exporter_scrape_duration_seconds{collector="mdadm",result="success",quantile="0.9"} 0.0033833780000000003
|
||||
node_exporter_scrape_duration_seconds{collector="mdadm",result="success",quantile="0.99"} 0.0033833780000000003
|
||||
node_exporter_scrape_duration_seconds_sum{collector="mdadm",result="success"} 0.0033833780000000003
|
||||
node_exporter_scrape_duration_seconds{collector="mdadm",result="success",quantile="0.5"} 0.004071681000000001
|
||||
node_exporter_scrape_duration_seconds{collector="mdadm",result="success",quantile="0.9"} 0.004071681000000001
|
||||
node_exporter_scrape_duration_seconds{collector="mdadm",result="success",quantile="0.99"} 0.004071681000000001
|
||||
node_exporter_scrape_duration_seconds_sum{collector="mdadm",result="success"} 0.004071681000000001
|
||||
node_exporter_scrape_duration_seconds_count{collector="mdadm",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="megacli",result="success",quantile="0.5"} 0.011852677
|
||||
node_exporter_scrape_duration_seconds{collector="megacli",result="success",quantile="0.9"} 0.011852677
|
||||
node_exporter_scrape_duration_seconds{collector="megacli",result="success",quantile="0.99"} 0.011852677
|
||||
node_exporter_scrape_duration_seconds_sum{collector="megacli",result="success"} 0.011852677
|
||||
node_exporter_scrape_duration_seconds{collector="megacli",result="success",quantile="0.5"} 0.016829594
|
||||
node_exporter_scrape_duration_seconds{collector="megacli",result="success",quantile="0.9"} 0.016829594
|
||||
node_exporter_scrape_duration_seconds{collector="megacli",result="success",quantile="0.99"} 0.016829594
|
||||
node_exporter_scrape_duration_seconds_sum{collector="megacli",result="success"} 0.016829594
|
||||
node_exporter_scrape_duration_seconds_count{collector="megacli",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="meminfo",result="success",quantile="0.5"} 0.0020243550000000003
|
||||
node_exporter_scrape_duration_seconds{collector="meminfo",result="success",quantile="0.9"} 0.0020243550000000003
|
||||
node_exporter_scrape_duration_seconds{collector="meminfo",result="success",quantile="0.99"} 0.0020243550000000003
|
||||
node_exporter_scrape_duration_seconds_sum{collector="meminfo",result="success"} 0.0020243550000000003
|
||||
node_exporter_scrape_duration_seconds{collector="meminfo",result="success",quantile="0.5"} 0.004264479
|
||||
node_exporter_scrape_duration_seconds{collector="meminfo",result="success",quantile="0.9"} 0.004264479
|
||||
node_exporter_scrape_duration_seconds{collector="meminfo",result="success",quantile="0.99"} 0.004264479
|
||||
node_exporter_scrape_duration_seconds_sum{collector="meminfo",result="success"} 0.004264479
|
||||
node_exporter_scrape_duration_seconds_count{collector="meminfo",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="netdev",result="success",quantile="0.5"} 0.001282011
|
||||
node_exporter_scrape_duration_seconds{collector="netdev",result="success",quantile="0.9"} 0.001282011
|
||||
node_exporter_scrape_duration_seconds{collector="netdev",result="success",quantile="0.99"} 0.001282011
|
||||
node_exporter_scrape_duration_seconds_sum{collector="netdev",result="success"} 0.001282011
|
||||
node_exporter_scrape_duration_seconds{collector="netdev",result="success",quantile="0.5"} 0.0031302350000000003
|
||||
node_exporter_scrape_duration_seconds{collector="netdev",result="success",quantile="0.9"} 0.0031302350000000003
|
||||
node_exporter_scrape_duration_seconds{collector="netdev",result="success",quantile="0.99"} 0.0031302350000000003
|
||||
node_exporter_scrape_duration_seconds_sum{collector="netdev",result="success"} 0.0031302350000000003
|
||||
node_exporter_scrape_duration_seconds_count{collector="netdev",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="netstat",result="success",quantile="0.5"} 0.0030494930000000003
|
||||
node_exporter_scrape_duration_seconds{collector="netstat",result="success",quantile="0.9"} 0.0030494930000000003
|
||||
node_exporter_scrape_duration_seconds{collector="netstat",result="success",quantile="0.99"} 0.0030494930000000003
|
||||
node_exporter_scrape_duration_seconds_sum{collector="netstat",result="success"} 0.0030494930000000003
|
||||
node_exporter_scrape_duration_seconds{collector="netstat",result="success",quantile="0.5"} 0.006607648000000001
|
||||
node_exporter_scrape_duration_seconds{collector="netstat",result="success",quantile="0.9"} 0.006607648000000001
|
||||
node_exporter_scrape_duration_seconds{collector="netstat",result="success",quantile="0.99"} 0.006607648000000001
|
||||
node_exporter_scrape_duration_seconds_sum{collector="netstat",result="success"} 0.006607648000000001
|
||||
node_exporter_scrape_duration_seconds_count{collector="netstat",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="sockstat",result="success",quantile="0.5"} 0.00034532300000000003
|
||||
node_exporter_scrape_duration_seconds{collector="sockstat",result="success",quantile="0.9"} 0.00034532300000000003
|
||||
node_exporter_scrape_duration_seconds{collector="sockstat",result="success",quantile="0.99"} 0.00034532300000000003
|
||||
node_exporter_scrape_duration_seconds_sum{collector="sockstat",result="success"} 0.00034532300000000003
|
||||
node_exporter_scrape_duration_seconds{collector="sockstat",result="success",quantile="0.5"} 0.000237652
|
||||
node_exporter_scrape_duration_seconds{collector="sockstat",result="success",quantile="0.9"} 0.000237652
|
||||
node_exporter_scrape_duration_seconds{collector="sockstat",result="success",quantile="0.99"} 0.000237652
|
||||
node_exporter_scrape_duration_seconds_sum{collector="sockstat",result="success"} 0.000237652
|
||||
node_exporter_scrape_duration_seconds_count{collector="sockstat",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="stat",result="success",quantile="0.5"} 0.001924806
|
||||
node_exporter_scrape_duration_seconds{collector="stat",result="success",quantile="0.9"} 0.001924806
|
||||
node_exporter_scrape_duration_seconds{collector="stat",result="success",quantile="0.99"} 0.001924806
|
||||
node_exporter_scrape_duration_seconds_sum{collector="stat",result="success"} 0.001924806
|
||||
node_exporter_scrape_duration_seconds{collector="stat",result="success",quantile="0.5"} 0.001057388
|
||||
node_exporter_scrape_duration_seconds{collector="stat",result="success",quantile="0.9"} 0.001057388
|
||||
node_exporter_scrape_duration_seconds{collector="stat",result="success",quantile="0.99"} 0.001057388
|
||||
node_exporter_scrape_duration_seconds_sum{collector="stat",result="success"} 0.001057388
|
||||
node_exporter_scrape_duration_seconds_count{collector="stat",result="success"} 1
|
||||
node_exporter_scrape_duration_seconds{collector="textfile",result="success",quantile="0.5"} 6.960000000000001e-07
|
||||
node_exporter_scrape_duration_seconds{collector="textfile",result="success",quantile="0.9"} 6.960000000000001e-07
|
||||
node_exporter_scrape_duration_seconds{collector="textfile",result="success",quantile="0.99"} 6.960000000000001e-07
|
||||
node_exporter_scrape_duration_seconds_sum{collector="textfile",result="success"} 6.960000000000001e-07
|
||||
node_exporter_scrape_duration_seconds{collector="textfile",result="success",quantile="0.5"} 6.25e-07
|
||||
node_exporter_scrape_duration_seconds{collector="textfile",result="success",quantile="0.9"} 6.25e-07
|
||||
node_exporter_scrape_duration_seconds{collector="textfile",result="success",quantile="0.99"} 6.25e-07
|
||||
node_exporter_scrape_duration_seconds_sum{collector="textfile",result="success"} 6.25e-07
|
||||
node_exporter_scrape_duration_seconds_count{collector="textfile",result="success"} 1
|
||||
# HELP node_filefd_allocated File descriptor statistics: allocated.
|
||||
# TYPE node_filefd_allocated gauge
|
||||
|
|
@ -1249,29 +1318,29 @@ node_sockstat_UDP_mem_bytes 0
|
|||
node_sockstat_sockets_used 229
|
||||
# HELP node_textfile_mtime Unixtime mtime of textfiles successfully read.
|
||||
# TYPE node_textfile_mtime gauge
|
||||
node_textfile_mtime{file="metrics1.prom"} 1.4432590509394212e+09
|
||||
node_textfile_mtime{file="metrics2.prom"} 1.4432590509394212e+09
|
||||
node_textfile_mtime{file="metrics1.prom"} 1.443740509423451e+09
|
||||
node_textfile_mtime{file="metrics2.prom"} 1.443740509423451e+09
|
||||
# HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise
|
||||
# TYPE node_textfile_scrape_error gauge
|
||||
node_textfile_scrape_error 0
|
||||
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
|
||||
# TYPE process_cpu_seconds_total counter
|
||||
process_cpu_seconds_total 0.01
|
||||
process_cpu_seconds_total 0
|
||||
# HELP process_max_fds Maximum number of open file descriptors.
|
||||
# TYPE process_max_fds gauge
|
||||
process_max_fds 65536
|
||||
process_max_fds 1024
|
||||
# HELP process_open_fds Number of open file descriptors.
|
||||
# TYPE process_open_fds gauge
|
||||
process_open_fds 12
|
||||
process_open_fds 8
|
||||
# HELP process_resident_memory_bytes Resident memory size in bytes.
|
||||
# TYPE process_resident_memory_bytes gauge
|
||||
process_resident_memory_bytes 9.285632e+06
|
||||
process_resident_memory_bytes 1.0084352e+07
|
||||
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
|
||||
# TYPE process_start_time_seconds gauge
|
||||
process_start_time_seconds 1.44329552189e+09
|
||||
process_start_time_seconds 1.44502463961e+09
|
||||
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
|
||||
# TYPE process_virtual_memory_bytes gauge
|
||||
process_virtual_memory_bytes 5.24058624e+08
|
||||
process_virtual_memory_bytes 2.72871424e+08
|
||||
# HELP testmetric1_1 Metric read from collector/fixtures/textfile/two_metric_files/metrics1.prom
|
||||
# TYPE testmetric1_1 untyped
|
||||
testmetric1_1{foo="bar"} 10
|
||||
|
|
|
|||
|
|
@ -203,7 +203,6 @@ func TestIPVSCollectorResponse(t *testing.T) {
|
|||
wantLines := strings.Split(string(wantMetrics), "\n")
|
||||
gotLines := strings.Split(string(rw.Body.String()), "\n")
|
||||
gotLinesIdx := 0
|
||||
t.Log(gotLines)
|
||||
|
||||
// Until the Prometheus Go client library offers better testability
|
||||
// (https://github.com/prometheus/client_golang/issues/58), we simply compare
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
// +build !nosupervisord
|
||||
|
||||
package collector
|
||||
|
||||
import (
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set +euf +o pipefail
|
||||
set -euf +o pipefail
|
||||
|
||||
cd "$(dirname $0)"
|
||||
|
||||
|
|
@ -33,6 +33,11 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
if [ ! -x ./node_exporter ]
|
||||
then
|
||||
echo './node_exporter not found. Consider running `go build` first.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./node_exporter \
|
||||
-collector.procfs="collector/fixtures/proc" \
|
||||
|
|
@ -62,6 +67,7 @@ finish() {
|
|||
then
|
||||
kill -9 "$(cat ${tmpdir}/node_exporter.pid)"
|
||||
# This silences the "Killed" message
|
||||
set +e
|
||||
wait "$(cat ${tmpdir}/node_exporter.pid)" > /dev/null 2>&1
|
||||
rm -rf "${tmpdir}"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import (
|
|||
const subsystem = "exporter"
|
||||
|
||||
var (
|
||||
// set at build time
|
||||
// Version of node_exporter. Set at build time.
|
||||
Version = "0.0.0.dev"
|
||||
|
||||
memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.")
|
||||
|
|
@ -59,23 +59,23 @@ var (
|
|||
)
|
||||
)
|
||||
|
||||
// Implements Collector.
|
||||
// NodeCollector implements the prometheus.Collector interface.
|
||||
type NodeCollector struct {
|
||||
collectors map[string]collector.Collector
|
||||
}
|
||||
|
||||
// Implements Collector.
|
||||
// Describe implements the prometheus.Collector interface.
|
||||
func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
scrapeDurations.Describe(ch)
|
||||
}
|
||||
|
||||
// Implements Collector.
|
||||
// Collect implements the prometheus.Collector interface.
|
||||
func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(len(n.collectors))
|
||||
for name, c := range n.collectors {
|
||||
go func(name string, c collector.Collector) {
|
||||
Execute(name, c, ch)
|
||||
execute(name, c, ch)
|
||||
wg.Done()
|
||||
}(name, c)
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ func (h *basicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
func Execute(name string, c collector.Collector, ch chan<- prometheus.Metric) {
|
||||
func execute(name string, c collector.Collector, ch chan<- prometheus.Metric) {
|
||||
begin := time.Now()
|
||||
err := c.Update(ch)
|
||||
duration := time.Since(begin)
|
||||
|
|
@ -137,7 +137,7 @@ func main() {
|
|||
|
||||
if *printCollectors {
|
||||
collectorNames := make(sort.StringSlice, 0, len(collector.Factories))
|
||||
for n, _ := range collector.Factories {
|
||||
for n := range collector.Factories {
|
||||
collectorNames = append(collectorNames, n)
|
||||
}
|
||||
collectorNames.Sort()
|
||||
|
|
@ -153,7 +153,7 @@ func main() {
|
|||
}
|
||||
|
||||
log.Infof("Enabled collectors:")
|
||||
for n, _ := range collectors {
|
||||
for n := range collectors {
|
||||
log.Infof(" - %s", n)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue