Skip to content

Commit

Permalink
Add Aerospike 5.2 metrics and add version info to exporter binary (#37)
Browse files Browse the repository at this point in the history
- Add aerospike 5.2 metrics and configs
    - `device_data_bytes`
    - `xdr-bin-tombstone-ttl`
    - `ignore-migrate-fill-delay`
- Add `--version` command line option
  • Loading branch information
spkesan authored Oct 16, 2020
1 parent 8f1efc3 commit 0b5fb80
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM golang:alpine AS builder

ARG VERSION=v1.1.4

ADD . $GOPATH/src/github.com/aerospike/aerospike-prometheus-exporter
WORKDIR $GOPATH/src/github.com/aerospike/aerospike-prometheus-exporter
RUN go build -o aerospike-prometheus-exporter . \
RUN go build -ldflags="-X 'main.version=$VERSION'" -o aerospike-prometheus-exporter . \
&& cp aerospike-prometheus-exporter /aerospike-prometheus-exporter

FROM alpine:latest
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Variables required for this Makefile
ROOT_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

VERSION = $(shell git describe --tags --always)

# Builds exporter binary
.PHONY: exporter
exporter:
go build -o aerospike-prometheus-exporter .
go build -ldflags="-X 'main.version=$(VERSION)'" -o aerospike-prometheus-exporter .

# Builds RPM, DEB and TAR packages
# Requires FPM package manager
Expand All @@ -31,4 +31,4 @@ clean:
# Requires docker
.PHONY: docker
docker:
docker build . -t aerospike/aerospike-prometheus-exporter:latest
docker build --build-arg VERSION=$(VERSION) . -t aerospike/aerospike-prometheus-exporter:latest
15 changes: 12 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"crypto/tls"
"flag"
"fmt"
"net"
"net/http"
"os"
Expand All @@ -17,11 +18,14 @@ import (
)

var (
configFile = flag.String("config", "/etc/aerospike-prometheus-exporter/ape.toml", "Config File")
showUsage = flag.Bool("u", false, "Show usage information")
configFile = flag.String("config", "/etc/aerospike-prometheus-exporter/ape.toml", "Config File")
showUsage = flag.Bool("u", false, "Show usage information")
showVersion = flag.Bool("version", false, "Print version")

fullHost string
config *Config

version = "v1.1.4"
)

func main() {
Expand All @@ -31,7 +35,12 @@ func main() {
os.Exit(0)
}

log.Infoln("Welcome to Aerospike Prometheus Exporter!")
if *showVersion {
fmt.Println(version)
os.Exit(0)
}

log.Infof("Welcome to Aerospike Prometheus Exporter %s", version)

config = new(Config)
initConfig(*configFile, config)
Expand Down
2 changes: 2 additions & 0 deletions watcher_namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ var namespaceRawMetrics = map[string]metricType{
"truncate-threads": mtGauge,
"xdr-tomb-raider-period": mtGauge,
"xdr-tomb-raider-threads": mtGauge,
"xdr-bin-tombstone-ttl": mtGauge,
"ignore-migrate-fill-delay": mtGauge,

"clock_skew_stop_writes": mtGauge,
"dead_partitions": mtGauge,
Expand Down
1 change: 1 addition & 0 deletions watcher_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var setRawMetrics = map[string]metricType{
"objects": mtGauge,
"tombstones": mtGauge,
"memory_data_bytes": mtGauge,
"device_data_bytes": mtGauge,
"truncate_lut": mtGauge,
"stop-writes-count": mtCounter,
"disable-eviction": mtGauge,
Expand Down

0 comments on commit 0b5fb80

Please sign in to comment.