A Prometheus Exporter for GoatCounter
Run
The exporter requires your GoatCounter code and an API token provided by the environment. The exports accepts a flag for endpoint
of the exporter, and metrics path
:
export CODE="..."
export TOKEN="..."
HOST_PORT="8080"
CONT_PORT="8080"
podman run \
--interactive --tty --rm \
--name=goatcounter-exporter \
--env=CODE=${CODE} \
--env=TOKEN=${TOKEN} \
--publish=${HOST_PORT}:${CONT_PORT}/tcp \
ghcr.io/dazwilkin/goatcounter-exporter:b72220e2ae378939e4154700dc82ba2ac10dce07 \
--endpoint=:${CONT_PORT} \
--path=/metrics
Prometheus
VERS="v2.46.0"
# Binds to host network to scrape GoatCounter Exporter
podman run \
--interactive --tty --rm \
--net=host \
--volume=${PWD}/prometheus.yml:/etc/prometheus/prometheus.yml \
--volume=${PWD}/rules.yml:/etc/alertmanager/rules.yml \
quay.io/prometheus/prometheus:${VERS} \
--config.file=/etc/prometheus/prometheus.yml \
--web.enable-lifecycle
Metrics
All metrics are prefixed goatcounter_exporter_
Name |
Type |
Description |
goatcounter_exporter_build_info |
Counter |
|
goatcounter_exporter_paths_total |
Gauge |
|
goatcounter_exporter_start_time |
Gauge |
|
goatcounter_exporter_stats_hits |
Gauge |
|
goatcounter_exporter_stats_total |
Gauge |
|
# HELP goatcounter_exporter_build_info A metric with a constant '1' value labeled by OS version, Go version, and the Git commit of the exporter
# TYPE goatcounter_exporter_build_info counter
goatcounter_exporter_build_info{git_commit="",go_version="",os_version=""}
# HELP goatcounter_exporter_paths_total List total of paths
# TYPE goatcounter_exporter_paths_total gauge
goatcounter_exporter_paths_total
# HELP goatcounter_exporter_start_time Exporter start time in Unix epoch seconds
# TYPE goatcounter_exporter_start_time gauge
goatcounter_exporter_start_time
# HELP goatcounter_exporter_stats_hits pageview and visitor stats
# TYPE goatcounter_exporter_stats_hits gauge
goatcounter_exporter_stats_hits{day="",path=""}
# HELP goatcounter_exporter_stats_total List total pageview counts
# TYPE goatcounter_exporter_stats_total gauge
goatcounter_exporter_stats_total
goatcounter-exporter
container images are being signed by Sigstore and may be verified:
cosign verify \
--key=./cosign.pub \
ghcr.io/dazwilkin/goatcounter-exporter:b72220e2ae378939e4154700dc82ba2ac10dce07
NOTE cosign.pub
may be downloaded here
To install cosign
, e.g.:
go install github.com/sigstore/cosign/cmd/cosign@latest
Similar Exporters