Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit b9216cb

Browse files
author
Audrius Karabanovas
authored
Merge pull request #26 from trustpilot/metrics-rename
Metrics rename
2 parents 6cb9b4e + 72e5025 commit b9216cb

File tree

4 files changed

+21
-35
lines changed

4 files changed

+21
-35
lines changed

collector/beat.go

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,29 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
5252
metrics: exportedMetrics{
5353
{
5454
desc: prometheus.NewDesc(
55-
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "milliseconds"),
55+
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "seconds_total"),
5656
"beat.cpu.time",
5757
nil, prometheus.Labels{"mode": "system"},
5858
),
59-
eval: func(stats *Stats) float64 { return stats.Beat.CPU.System.Time.MS },
59+
eval: func(stats *Stats) float64 {
60+
return (time.Duration(stats.Beat.CPU.System.Time.MS) * time.Millisecond).Seconds()
61+
},
6062
valType: prometheus.CounterValue,
6163
},
6264
{
6365
desc: prometheus.NewDesc(
64-
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "milliseconds"),
66+
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "seconds_total"),
6567
"beat.cpu.time",
6668
nil, prometheus.Labels{"mode": "user"},
6769
),
68-
eval: func(stats *Stats) float64 { return stats.Beat.CPU.User.Time.MS },
69-
valType: prometheus.CounterValue,
70-
},
71-
{
72-
desc: prometheus.NewDesc(
73-
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "milliseconds"),
74-
"beat.cpu.time",
75-
nil, prometheus.Labels{"mode": "total"},
76-
),
77-
eval: func(stats *Stats) float64 { return stats.Beat.CPU.Total.Time.MS },
70+
eval: func(stats *Stats) float64 {
71+
return (time.Duration(stats.Beat.CPU.User.Time.MS) * time.Millisecond).Seconds()
72+
},
7873
valType: prometheus.CounterValue,
7974
},
8075
{
8176
desc: prometheus.NewDesc(
82-
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks"),
77+
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks_total"),
8378
"beat.cpu.ticks",
8479
nil, prometheus.Labels{"mode": "system"},
8580
),
@@ -88,7 +83,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
8883
},
8984
{
9085
desc: prometheus.NewDesc(
91-
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks"),
86+
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks_total"),
9287
"beat.cpu.ticks",
9388
nil, prometheus.Labels{"mode": "user"},
9489
),
@@ -97,16 +92,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
9792
},
9893
{
9994
desc: prometheus.NewDesc(
100-
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks"),
101-
"beat.cpu.ticks",
102-
nil, prometheus.Labels{"mode": "total"},
103-
),
104-
eval: func(stats *Stats) float64 { return stats.Beat.CPU.Total.Ticks },
105-
valType: prometheus.CounterValue,
106-
},
107-
{
108-
desc: prometheus.NewDesc(
109-
prometheus.BuildFQName(beatInfo.Beat, "uptime", "seconds"),
95+
prometheus.BuildFQName(beatInfo.Beat, "uptime", "seconds_total"),
11096
"beat.info.uptime.ms",
11197
nil, nil,
11298
),
@@ -117,7 +103,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
117103
},
118104
{
119105
desc: prometheus.NewDesc(
120-
prometheus.BuildFQName(beatInfo.Beat, "memstats", "gc_next"),
106+
prometheus.BuildFQName(beatInfo.Beat, "memstats", "gc_next_total"),
121107
"beat.memstats.gc_next",
122108
nil, nil,
123109
),
@@ -139,7 +125,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
139125
},
140126
{
141127
desc: prometheus.NewDesc(
142-
prometheus.BuildFQName(beatInfo.Beat, "memstats", "memory_total"),
128+
prometheus.BuildFQName(beatInfo.Beat, "memstats", "memory"),
143129
"beat.memstats.memory_total",
144130
nil, nil,
145131
),

collector/libbeat.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
7070
metrics: exportedMetrics{
7171
{
7272
desc: prometheus.NewDesc(
73-
prometheus.BuildFQName(beatInfo.Beat, "libbeat_config", "reloads"),
73+
prometheus.BuildFQName(beatInfo.Beat, "libbeat_config", "reloads_total"),
7474
"libbeat.config.reloads",
7575
nil, nil,
7676
),
@@ -114,7 +114,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
114114
},
115115
{
116116
desc: prometheus.NewDesc(
117-
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_bytes"),
117+
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_bytes_total"),
118118
"libbeat.output.read.bytes",
119119
nil, nil,
120120
),
@@ -125,7 +125,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
125125
},
126126
{
127127
desc: prometheus.NewDesc(
128-
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_errors"),
128+
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_errors_total"),
129129
"libbeat.output.read.errors",
130130
nil, nil,
131131
),
@@ -136,7 +136,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
136136
},
137137
{
138138
desc: prometheus.NewDesc(
139-
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_bytes"),
139+
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_bytes_total"),
140140
"libbeat.output.write.bytes",
141141
nil, nil,
142142
),
@@ -147,7 +147,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
147147
},
148148
{
149149
desc: prometheus.NewDesc(
150-
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_errors"),
150+
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_errors_total"),
151151
"libbeat.output.write.errors",
152152
nil, nil,
153153
),
@@ -322,7 +322,7 @@ func (c *libbeatCollector) Describe(ch chan<- *prometheus.Desc) {
322322
}
323323

324324
libbeatOutputType = prometheus.NewDesc(
325-
prometheus.BuildFQName(c.beatInfo.Beat, "libbeat", "output"),
325+
prometheus.BuildFQName(c.beatInfo.Beat, "libbeat", "output_total"),
326326
"libbeat.output.type",
327327
[]string{"type"}, nil,
328328
)

collector/system.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
3535
metrics: exportedMetrics{
3636
{
3737
desc: prometheus.NewDesc(
38-
prometheus.BuildFQName(beatInfo.Beat, "system_cpu", "cores"),
38+
prometheus.BuildFQName(beatInfo.Beat, "system_cpu", "cores_total"),
3939
"cpu cores",
4040
nil, nil,
4141
),

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# beat-exporter for Prometheus [![Build Status](https://travis-ci.org/trustpilot/beat-exporter.svg?branch=master)](https://travis-ci.org/trustpilot/beat-exporter)
1+
# beat-exporter for Prometheus ![](https://github.com/trustpilot/beat-exporter/workflows/test-and-build/badge.svg)
22

33
[![Docker Pulls](https://img.shields.io/docker/pulls/trustpilot/beat-exporter.svg?maxAge=604800)](https://hub.docker.com/r/trustpilot/beat-exporter/)
44

0 commit comments

Comments
 (0)