aerogear / keycloak-metrics-spi

Adds a Metrics Endpoint to Keycloak
Apache License 2.0
526 stars 151 forks source link

Pushgateway with basic auth #145

Closed twiden closed 11 months ago

twiden commented 1 year ago

Is there a way to push metrics to a Prometheus Pushgateway that has basic auth enabled?

(Enabling basic auth in Pushgateway protects all HTTP endpoints including POST metrics)

hashworks commented 11 months ago

We would need to set a connection factory: pg.setConnectionFactory(new BasicAuthHttpConnectionFactory("user", "pass")); in here.

hashworks commented 11 months ago

Example: https://github.com/prometheus/client_java/blob/main/integration_tests/it_pushgateway/src/main/java/io/prometheus/client/it/pushgateway/ExampleBatchJob.java#L32C13-L32C91