Configure Prometheus to allow a custom scrape query param
* Set `prometheus.io/param` on a Kubernetes Service to scrape the service endpoints and pass a custom query parameter * For example, scrape Consul with `?format=prometheus` ```yaml kind: Service metadata: annotations: prometheus.io/scrape: 'true' prometheus.io/port: '8500' prometheus.io/path: /v1/agent/metrics prometheus.io/param: format=prometheus ```
This commit is contained in:
parent
6ed048eb65
commit
a9f9c59b91
|
@ -11,6 +11,10 @@ Notable changes between versions.
|
||||||
|
|
||||||
* Switch Kubernetes Container Runtime from `docker` to `containerd` ([#1087](https://github.com/poseidon/typhoon/pull/1087))
|
* Switch Kubernetes Container Runtime from `docker` to `containerd` ([#1087](https://github.com/poseidon/typhoon/pull/1087))
|
||||||
|
|
||||||
|
### Addons
|
||||||
|
|
||||||
|
* Configure Prometheus to allow a custom scrape query parameter ([#1095](https://github.com/poseidon/typhoon/pull/1095))
|
||||||
|
|
||||||
## v1.23.0
|
## v1.23.0
|
||||||
|
|
||||||
* Kubernetes [v1.23.0](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md#v1230)
|
* Kubernetes [v1.23.0](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md#v1230)
|
||||||
|
|
|
@ -175,6 +175,7 @@ data:
|
||||||
# * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
|
# * `prometheus.io/path`: If the metrics path is not `/metrics` override this.
|
||||||
# * `prometheus.io/port`: If the metrics are exposed on a different port to the
|
# * `prometheus.io/port`: If the metrics are exposed on a different port to the
|
||||||
# service then set this appropriately.
|
# service then set this appropriately.
|
||||||
|
# * `prometheus.io/param`: Custom metrics query parameter, like "format=prometheus".
|
||||||
- job_name: 'kubernetes-service-endpoints'
|
- job_name: 'kubernetes-service-endpoints'
|
||||||
kubernetes_sd_configs:
|
kubernetes_sd_configs:
|
||||||
- role: endpoints
|
- role: endpoints
|
||||||
|
@ -197,6 +198,11 @@ data:
|
||||||
target_label: __address__
|
target_label: __address__
|
||||||
regex: ([^:]+)(?::\d+)?;(\d+)
|
regex: ([^:]+)(?::\d+)?;(\d+)
|
||||||
replacement: $1:$2
|
replacement: $1:$2
|
||||||
|
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_param]
|
||||||
|
action: replace
|
||||||
|
target_label: __param_$1
|
||||||
|
regex: ([^=]+)=(.*)
|
||||||
|
replacement: $2
|
||||||
- action: labelmap
|
- action: labelmap
|
||||||
regex: __meta_kubernetes_service_label_(.+)
|
regex: __meta_kubernetes_service_label_(.+)
|
||||||
- source_labels: [__meta_kubernetes_namespace]
|
- source_labels: [__meta_kubernetes_namespace]
|
||||||
|
|
Loading…
Reference in New Issue