Skip to content

Commit

Permalink
metrics: added statsd-exporter and simple prometheus rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nosahama committed Aug 23, 2024
1 parent 44b578f commit 7f5a4b7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
26 changes: 25 additions & 1 deletion container/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ services:
KARAPACE_TOPIC_NAME: _schemas
KARAPACE_LOG_LEVEL: WARNING
KARAPACE_COMPATIBILITY: FULL
KARAPACE_STATSD_HOST: statsd-exporter
KARAPACE_STATSD_PORT: 8125

karapace-rest:
image: ghcr.io/aiven-open/karapace:develop
Expand All @@ -102,10 +104,32 @@ services:
KARAPACE_REGISTRY_PORT: 8081
KARAPACE_ADMIN_METADATA_MAX_AGE: 0
KARAPACE_LOG_LEVEL: WARNING
KARAPACE_STATSD_HOST: statsd-exporter
KARAPACE_STATSD_PORT: 8125

prometheus:
image: prom/prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/rules.yml:/etc/prometheus/rules.yml
ports:
- 9090:9090

grafana:
image: grafana/grafana
environment:
GF_SECURITY_ADMIN_USER: karapace
GF_SECURITY_ADMIN_PASSWORD: karapace
GF_PATHS_PROVISIONING: /grafana/provisioning
ports:
- 3000:3000
volumes:
- ./grafana/dashboards:/grafana/dashboards
- ./grafana/provisioning:/grafana/provisioning

statsd-exporter:
image: prom/statsd-exporter
command: "--statsd.listen-udp=:8125 --web.listen-address=:9102"
ports:
- 9102:9102
- 8125:8125/udp
13 changes: 12 additions & 1 deletion container/prometheus.yml → container/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
global:
scrape_interval: 10s # How frequently to scrape targets by default.
scrape_timeout: 5s # How long until a scrape request times out.
evaluation_interval: 60s # How frequently to evaluate rules.
evaluation_interval: 10s # How frequently to evaluate rules.

rule_files:
- /etc/prometheus/rules.yml

# A scrape configuration
scrape_configs:
Expand All @@ -16,3 +19,11 @@ scrape_configs:
static_configs:
- targets:
- karapace-rest:8082

- job_name: statsd-exporter
metrics_path: /metrics
tls_config:
insecure_skip_verify: true
static_configs:
- targets:
- statsd-exporter:9102
20 changes: 20 additions & 0 deletions container/prometheus/rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
groups:
- name: karapace
rules:
- record: karapace_exceptions_sum_by_exception
expr: sum by (exception) (exception)
- alert: HighHTTPRequests
expr: karapace_http_requests_total > 10
for: 5m
labels:
severity: warning
annotations:
summary: High HTTP requests for (instance={{ $labels.instance }})
description: "Service received\n HTTP Requests = {{ $value }}\n"
- alert: FireImmidiately
expr: karapace_schema_reader_schemas > 1
labels:
severity: page
annotations:
summary: Lots of schems on (instance={{ $labels.instance }})
description: "\n Schema count = {{ $value }}\n"

0 comments on commit 7f5a4b7

Please sign in to comment.