Skip to content

Commit

Permalink
Merge pull request #26 from trustpilot/metrics-rename
Browse files Browse the repository at this point in the history
Metrics rename
  • Loading branch information
Audrius Karabanovas authored Oct 3, 2019
2 parents 6cb9b4e + 72e5025 commit b9216cb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
40 changes: 13 additions & 27 deletions collector/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,29 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
metrics: exportedMetrics{
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "milliseconds"),
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "seconds_total"),
"beat.cpu.time",
nil, prometheus.Labels{"mode": "system"},
),
eval: func(stats *Stats) float64 { return stats.Beat.CPU.System.Time.MS },
eval: func(stats *Stats) float64 {
return (time.Duration(stats.Beat.CPU.System.Time.MS) * time.Millisecond).Seconds()
},
valType: prometheus.CounterValue,
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "milliseconds"),
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "seconds_total"),
"beat.cpu.time",
nil, prometheus.Labels{"mode": "user"},
),
eval: func(stats *Stats) float64 { return stats.Beat.CPU.User.Time.MS },
valType: prometheus.CounterValue,
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "cpu_time", "milliseconds"),
"beat.cpu.time",
nil, prometheus.Labels{"mode": "total"},
),
eval: func(stats *Stats) float64 { return stats.Beat.CPU.Total.Time.MS },
eval: func(stats *Stats) float64 {
return (time.Duration(stats.Beat.CPU.User.Time.MS) * time.Millisecond).Seconds()
},
valType: prometheus.CounterValue,
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks"),
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks_total"),
"beat.cpu.ticks",
nil, prometheus.Labels{"mode": "system"},
),
Expand All @@ -88,7 +83,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks"),
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks_total"),
"beat.cpu.ticks",
nil, prometheus.Labels{"mode": "user"},
),
Expand All @@ -97,16 +92,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "cpu", "ticks"),
"beat.cpu.ticks",
nil, prometheus.Labels{"mode": "total"},
),
eval: func(stats *Stats) float64 { return stats.Beat.CPU.Total.Ticks },
valType: prometheus.CounterValue,
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "uptime", "seconds"),
prometheus.BuildFQName(beatInfo.Beat, "uptime", "seconds_total"),
"beat.info.uptime.ms",
nil, nil,
),
Expand All @@ -117,7 +103,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "memstats", "gc_next"),
prometheus.BuildFQName(beatInfo.Beat, "memstats", "gc_next_total"),
"beat.memstats.gc_next",
nil, nil,
),
Expand All @@ -139,7 +125,7 @@ func NewBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "memstats", "memory_total"),
prometheus.BuildFQName(beatInfo.Beat, "memstats", "memory"),
"beat.memstats.memory_total",
nil, nil,
),
Expand Down
12 changes: 6 additions & 6 deletions collector/libbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
metrics: exportedMetrics{
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "libbeat_config", "reloads"),
prometheus.BuildFQName(beatInfo.Beat, "libbeat_config", "reloads_total"),
"libbeat.config.reloads",
nil, nil,
),
Expand Down Expand Up @@ -114,7 +114,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_bytes"),
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_bytes_total"),
"libbeat.output.read.bytes",
nil, nil,
),
Expand All @@ -125,7 +125,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_errors"),
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_read_errors_total"),
"libbeat.output.read.errors",
nil, nil,
),
Expand All @@ -136,7 +136,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_bytes"),
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_bytes_total"),
"libbeat.output.write.bytes",
nil, nil,
),
Expand All @@ -147,7 +147,7 @@ func NewLibBeatCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector
},
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_errors"),
prometheus.BuildFQName(beatInfo.Beat, "libbeat", "output_write_errors_total"),
"libbeat.output.write.errors",
nil, nil,
),
Expand Down Expand Up @@ -322,7 +322,7 @@ func (c *libbeatCollector) Describe(ch chan<- *prometheus.Desc) {
}

libbeatOutputType = prometheus.NewDesc(
prometheus.BuildFQName(c.beatInfo.Beat, "libbeat", "output"),
prometheus.BuildFQName(c.beatInfo.Beat, "libbeat", "output_total"),
"libbeat.output.type",
[]string{"type"}, nil,
)
Expand Down
2 changes: 1 addition & 1 deletion collector/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewSystemCollector(beatInfo *BeatInfo, stats *Stats) prometheus.Collector {
metrics: exportedMetrics{
{
desc: prometheus.NewDesc(
prometheus.BuildFQName(beatInfo.Beat, "system_cpu", "cores"),
prometheus.BuildFQName(beatInfo.Beat, "system_cpu", "cores_total"),
"cpu cores",
nil, nil,
),
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# beat-exporter for Prometheus [![Build Status](https://travis-ci.org/trustpilot/beat-exporter.svg?branch=master)](https://travis-ci.org/trustpilot/beat-exporter)
# beat-exporter for Prometheus ![](https://github.com/trustpilot/beat-exporter/workflows/test-and-build/badge.svg)

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

Expand Down

0 comments on commit b9216cb

Please sign in to comment.