Skip to content

DazWilkin/goatcounter-exporter

Repository files navigation

A Prometheus Exporter for GoatCounter

GitHub Actions Go Reference Go Report Card

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:0b0e678f6153228083a6f79517e8be30bcee2947 \
--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:0b0e678f6153228083a6f79517e8be30bcee2947

NOTE cosign.pub may be downloaded here

To install cosign, e.g.:

go install github.com/sigstore/cosign/cmd/cosign@latest

Similar Exporters



Buy Me A Coffee

About

A Prometheus Exporter for GoatCounter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published