With the latest release of paas-charm, we are improving the Runtime Configuration support.
This feature allows you to extend certain capabilities of your charm without modifying the Python code, simply by dropping a paas-config.yaml file alongside your charmcraft.yaml.
The first major capability enabled by this configuration is Prometheus custom metrics collection.
Does your application run a service that exposes metrics on a different port? Do you have a Celery Beat scheduler exporter that needs a specific scrape target? You can now define these explicitly.
The following snippet is an example of how to use the new paas-config.yaml to configure Prometheus targets:
prometheus:
scrape_configs:
# Application metrics from all units
- job_name: "flask-app-custom"
metrics_path: "/metrics"
static_configs:
- targets:
- "*:8081"
labels:
app: "flask"
env: "example"
# Metrics scraped from only the scheduler unit
- job_name: "flask-scheduler-metrics"
metrics_path: "/metrics"
static_configs:
- targets:
- "@scheduler:8082"
labels:
role: "scheduler"
For the full documentation, see: