From 1f8973a476ce2a550ef2db2b36c5dd7df1243854 Mon Sep 17 00:00:00 2001 From: Piotr Sarna Date: Tue, 31 Oct 2023 13:09:23 +0100 Subject: [PATCH] scripts: add a dockerized prometheus helper It makes metrics development easier, with the prometheus image already seeded with configuration that scrapes events from localhost:8081. Runs properly with `cargo run -- --admin-listen-addr 0.0.0.0:8081` --- libsql-server/scripts/prometheus_docker.yml | 14 ++++++++++++++ libsql-server/scripts/run_prometheus_docker.sh | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 libsql-server/scripts/prometheus_docker.yml create mode 100755 libsql-server/scripts/run_prometheus_docker.sh diff --git a/libsql-server/scripts/prometheus_docker.yml b/libsql-server/scripts/prometheus_docker.yml new file mode 100644 index 0000000000..1497aebc99 --- /dev/null +++ b/libsql-server/scripts/prometheus_docker.yml @@ -0,0 +1,14 @@ +# my global config +global: + scrape_interval: 5s + evaluation_interval: 5s + scrape_timeout: 4s + +scrape_configs: + - job_name: "prometheus" + static_configs: + - targets: ["127.0.0.1:9090"] + - job_name: "sqld" + metrics_path: "/metrics" + static_configs: + - targets: ["host.docker.internal:8081"] diff --git a/libsql-server/scripts/run_prometheus_docker.sh b/libsql-server/scripts/run_prometheus_docker.sh new file mode 100755 index 0000000000..83e1f6e954 --- /dev/null +++ b/libsql-server/scripts/run_prometheus_docker.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +docker run --net=host --rm --name libsql-server-prometheus -v $(dirname $0)/prometheus_docker.yml:/etc/prometheus/prometheus.yml prom/prometheus