Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit cc86e0a

Browse files
committed
Merge branch 'master' into auth
2 parents 9fea8fc + a00349f commit cc86e0a

File tree

8 files changed

+116
-11
lines changed

8 files changed

+116
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
asprom
2+
dist/

.goreleaser.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
builds:
2+
- binary: asprom
3+
goos:
4+
- linux
5+
- darwin
6+
goarch:
7+
- amd64
8+
archive:
9+
files:
10+
- LICENSE
11+
wrap_in_directory: true
12+
release:
13+
github:
14+
owner: alicebob
15+
name: asprom

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# builder
2+
FROM golang:1.9.3-alpine3.7 AS builder
3+
4+
WORKDIR /go/src/github.com/alicebob
5+
6+
ARG ASPROM_VERSION=1.0.1
7+
8+
RUN apk add --no-cache git \
9+
&& git clone https://github.com/alicebob/asprom.git \
10+
&& cd asprom \
11+
&& git fetch --all --tags --prune \
12+
&& git checkout tags/$ASPROM_VERSION
13+
14+
WORKDIR /go/src/github.com/alicebob/asprom
15+
16+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o asprom .
17+
18+
19+
20+
# final
21+
FROM alpine:3.7
22+
23+
RUN apk --no-cache add ca-certificates
24+
25+
WORKDIR /root/
26+
27+
COPY --from=builder /go/src/github.com/alicebob/asprom .
28+
29+
EXPOSE 9145
30+
31+
CMD ["./asprom"]

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build test
1+
.PHONY: all build test release
22

33
all: build test
44

@@ -7,3 +7,6 @@ build:
77

88
test:
99
go test
10+
11+
release:
12+
goreleaser --rm-dist

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@ Statistics collected:
99
* aerospike_sets_*: statistics per set: objects, memory usage
1010
* aerospike_latency_*: read/write/etc latency rates(!), per namespace
1111
* aerospike_ops_*: read/write/etc ops per second, per namespace
12+
13+
## Binaries
14+
15+
The [releases](https://github.com/alicebob/asprom/releases) page has binaries.
16+
17+
## Building
18+
19+
- install the [Go compiler](https://golang.org/dl)
20+
- run `make`
21+
- copy the `./asprom` binary to where you need it
22+
23+
It's also easy to crosscompile with Go. You can build asprom for Linux on a Mac with: `GOOS=linux GOARCH=amd64 go build` and then copy the `asprom` binary over to your Linux machines.

latency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (lc latencyCollector) collect(conn *as.Connection, ch chan<- prometheus.Met
7575
}
7676
ns, op, err := readNS(key)
7777
if err != nil {
78-
log.Print("weird latency key %q: %s", key, err)
78+
log.Printf("weird latency key %q: %s", key, err)
7979
continue
8080
}
8181
for threshold, data := range metrics {

main.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ package main
1313

1414
import (
1515
"flag"
16+
"fmt"
1617
"log"
1718
"net/http"
19+
"os"
1820
"time"
1921

2022
as "github.com/aerospike/aerospike-client-go"
@@ -32,10 +34,12 @@ const (
3234
)
3335

3436
var (
35-
addr = flag.String("listen", ":9145", "listen address for prometheus")
36-
nodeAddr = flag.String("node", "127.0.0.1:3000", "aerospike node")
37-
username = flag.String("username", "", "username. Leave empty for no authentication")
38-
password = flag.String("password", "", "password")
37+
version = "master"
38+
showVersion = flag.Bool("version", false, "show version")
39+
addr = flag.String("listen", ":9145", "listen address for prometheus")
40+
nodeAddr = flag.String("node", "127.0.0.1:3000", "aerospike node")
41+
username = flag.String("username", "", "username. Leave empty for no authentication")
42+
password = flag.String("password", "", "password")
3943

4044
landingPage = `<html>
4145
<head><title>Aerospike exporter</title></head>
@@ -59,6 +63,11 @@ func main() {
5963
log.Fatal("usage error")
6064
}
6165

66+
if *showVersion {
67+
fmt.Printf("asprom %s\n", version)
68+
os.Exit(0)
69+
}
70+
6271
col := newAsCollector(*nodeAddr, *username, *password)
6372

6473
req := prometheus.NewRegistry()

stats.go

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,45 @@ var (
1313
// See `asinfo -l -v statistics` for the full list.
1414
StatsMetrics = []metric{
1515
gauge("cluster_size", "cluster size"),
16+
// cluster_key=C0758EC6A81F
17+
// cluster_integrity=true
18+
// cluster_is_member=true
19+
counter("uptime", "uptime"),
1620
gauge("system_free_mem_pct", "system free mem pct"),
21+
// system_swapping=false
22+
gauge("heap_allocated_kbytes", "heap allocated kbytes"),
23+
gauge("heap_active_kbytes", "heap active kbytes"),
24+
gauge("heap_mapped_kbytes", "heap mapped kbytes"),
25+
gauge("heap_efficiency_pct", "heap efficiency pct"),
26+
gauge("heap_site_count", "heap site count"),
1727
gauge("objects", "objects"),
18-
gauge("sub_objects", "sub objects"),
28+
gauge("tombstones", "tombstones"),
29+
gauge("tsvc_queue", "tsvc queue"),
1930
gauge("info_queue", "info queue"),
2031
gauge("delete_queue", "delete queue"),
32+
// rw_in_progress=0
33+
// proxy_in_progress=0
34+
// tree_gc_queue=0
2135
gauge("client_connections", "client connections"),
2236
gauge("heartbeat_connections", "heartbeat connections"),
2337
gauge("fabric_connections", "fabric connections"),
38+
counter("heartbeat_received_self", "heartbeat received self"),
39+
counter("heartbeat_received_foreign", "heartbeat received foreign"),
40+
counter("reaped_fds", "reaped fds"),
41+
counter("info_complete", "info complete"),
42+
counter("demarshal_error", "demarshal error"),
43+
counter("early_tsvc_client_error", "early tsvc client error"),
44+
counter("early_tsvc_batch_sub_error", "early tsvc batch sub error"),
45+
counter("early_tsvc_udf_sub_error", "early tsvc udf sub error"),
2446
gauge("batch_index_initiate", "batch index initiate"),
47+
// batch_index_queue=0:0,0:0,0:0,0:0
2548
gauge("batch_index_complete", "batch index complete"),
2649
gauge("batch_index_error", "batch index error"),
2750
gauge("batch_index_timeout", "batch index timeout"),
51+
gauge("batch_index_unused_buffers", "batch index unused buffers"),
52+
gauge("batch_index_huge_buffers", "batch index huge buffers"),
53+
counter("batch_index_created_buffers", "batch index created buffers"),
54+
counter("batch_index_destroyed_buffers", "batch index destroyed buffers"),
2855
gauge("batch_initiate", "batch initiate"),
2956
gauge("batch_queue", "batch queue"),
3057
gauge("batch_error", "batch error"),
@@ -34,15 +61,22 @@ var (
3461
gauge("query_long_running", "query long running"),
3562
gauge("sindex_ucgarbage_found", "sindex ucgarbage found"),
3663
gauge("sindex_gc_locktimedout", "sindex gc locktimedout"),
37-
gauge("sindex_gc_inactivity_dur", "sindex gc inactivity dur"),
38-
gauge("sindex_gc_activity_dur", "sindex gc activity dur"),
3964
gauge("sindex_gc_list_creation_time", "sindex gc list creation time"),
4065
gauge("sindex_gc_list_deletion_time", "sindex gc list deletion time"),
4166
gauge("sindex_gc_objects_validated", "sindex gc objects validated"),
4267
gauge("sindex_gc_garbage_found", "sindex gc garbage found"),
4368
gauge("sindex_gc_garbage_cleaned", "sindex gc garbage cleaned"),
44-
counter("fabric_msgs_sent", "fabric msgs sent"),
45-
counter("fabric_msgs_rcvd", "fabric msgs rcvd"),
69+
// paxos_principal=BB9508FED001500
70+
// migrate_allowed=true
71+
gauge("migrate_partitions_remaining", "migrate partitions remaining"),
72+
gauge("fabric_bulk_send_rate", "fabric bulk send rate"),
73+
gauge("fabric_bulk_recv_rate", "fabric bulk recv rate"),
74+
gauge("fabric_ctrl_send_rate", "fabric ctrl send rate"),
75+
gauge("fabric_ctrl_recv_rate", "fabric ctrl recv rate"),
76+
gauge("fabric_meta_send_rate", "fabric meta send rate"),
77+
gauge("fabric_meta_recv_rate", "fabric meta recv rate"),
78+
gauge("fabric_rw_send_rate", "fabric rw send rate"),
79+
gauge("fabric_rw_recv_rate", "fabric rw recv rate"),
4680
counter("xdr_ship_success", "xdr ship success"),
4781
counter("xdr_ship_delete_success", "xdr ship delete success"),
4882
counter("xdr_ship_source_error", "xdr ship source error"),

0 commit comments

Comments
 (0)