aerogear / keycloak-metrics-spi

Adds a Metrics Endpoint to Keycloak
Apache License 2.0
551 stars 156 forks source link

Pushgateway Error code 200 #68

Closed Alexxanddr closed 4 years ago

Alexxanddr commented 4 years ago

Description

I have an error using prometheus push gateway, i configured the variable with endpoint and keycloak push successfully metrics to pushgateway, but in keycloak log i have an error

Expected Behavior

log 200 ok for push to prometheus pushgatway

Actual Behavior

`

2020-06-22T08:19:33.374 [] [] [Thread-401] ERROR -- o.j.a.k.m.PrometheusExporter : Unable to send to prometheus PushGateway: java.io.IOException: Response code from http://pushgateway.********.svc:9091/metrics/job/keycloak/instance/10.130.14.135 was 200

  | at io.prometheus.client.exporter.PushGateway.doRequest(PushGateway.java:297)   | at io.prometheus.client.exporter.PushGateway.pushAdd(PushGateway.java:171)   | at org.jboss.aerogear.keycloak.metrics.PrometheusExporter.push(PrometheusExporter.java:289)   | at org.jboss.aerogear.keycloak.metrics.PrometheusExporter.lambda$pushAsync$0(PrometheusExporter.java:281)   | at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)   | at java.base/java.lang.Thread.run(Thread.java:834)

`

Environment

Steps to reproduce

Deploy keycloak on openshift and use the library

pb82 commented 4 years ago

@Alexxanddr strange, a valid response code was declined. I'll try to investigate, but do you need to use the PushGateway in your case? If you are using the Prometheus Operator you could use something like a PodMonitor to monitor multiple Keycloak Instances. And if you only have one Keycloak instance there shouldn't be any need to use the PushGateway, scraping will work fine.

Alexxanddr commented 4 years ago

@pb82 i have deployed prometheus with deployment config, not with operator, and at this moment i have 2 instances of keycloak in dev environment, but in production environment i want to add more pod. I need push gateway because i have a prometheus for entire cluster, and this scrape all pod, and now the scraping directly on keycloak not show the instance value.

Alexxanddr commented 4 years ago

@pb82 i have changed the version of prometheus simpleclient library with the latest, with argument at build: -PprometheusVersion="0.9.0"

and it works successfully! i think the problem it was the 0.3.0 version of prometheus library

pb82 commented 4 years ago

Great, glad that it worked. Hmm yeah the defautl is quite old we should probably upgrade that.

domste commented 4 years ago

Is there any plan on when to upgrade the prometheus version?