Skip to content

Commit

Permalink
Explain rationale for not using some prometheus scrape settings in ch…
Browse files Browse the repository at this point in the history
…arms (#255)

Co-authored-by: sed-i <[email protected]>
  • Loading branch information
Michele Mancioppi and sed-i authored Mar 30, 2022
1 parent 1b0d2b3 commit e964e63
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/charms/prometheus_k8s/v0/prometheus_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(self, *args):
not with fully qualified targets.
Multiple jobs with different metrics paths and labels are allowed, but
each job must be given a unique name. For example
each job must be given a unique name:
```
[
Expand Down Expand Up @@ -162,14 +162,10 @@ def __init__(self, *args):
the continuity of the metrics time series gathered by Prometheus when the leader unit
changes (e.g. on upgrade or rescale).
It is also possible to configure other scrape related parameters using
these job specifications as described by the Prometheus
[documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config).
The permissible subset of job specific scrape configuration parameters
supported in a `MetricsEndpointProvider` job specification are:
Additionally, it is also technically possible, but **strongly discouraged**, to
configure the following scrape-related settings, which behave as described by the
[Prometheus documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config):
- `job_name`
- `metrics_path`
- `static_configs`
- `scrape_interval`
- `scrape_timeout`
Expand All @@ -181,6 +177,11 @@ def __init__(self, *args):
- `label_name_length_limit`
- `label_value_length_limit`
The settings above are supported by the `prometheus_scrape` library only for the sake of
specialized facilities like the [Prometheus Scrape Config](https://charmhub.io/prometheus-scrape-config-k8s)
charm. Virtually no charms should use these settings, and charmers definitely **should not**
expose them to the Juju administrator via configuration options.
## Consumer Library Usage
The `MetricsEndpointConsumer` object may be used by Prometheus
Expand Down Expand Up @@ -308,7 +309,7 @@ def _on_scrape_targets_changed(self, event):
`scrape_jobs` and `alert_rules` keys in application relation data
of Metrics provider charms hold eponymous information.
"""
""" # noqa: W505

import json
import logging
Expand Down

0 comments on commit e964e63

Please sign in to comment.