How to integrate Keycloak with OpenTelemetry and send metrics to Elastic APM?

215 Views Asked by At

I used Keycloak 11 in my product and elastic-apm-agent to send keycloak metrics to Elastic APM. Below are the JAVA OPTS I used. This setup completely worked fine until I migrated keycloak 11 to 20.

-Delastic.apm.enabled=True 
-Delastic.apm.server_url=http://127.0.0.1:8203 
-Delastic.apm.span_min_duration=10ms 
-Delastic.apm.exit_span_min_duration=10ms 
-Delastic.apm.span_stack_trace_min_duration=500ms 
-Delastic.apm.use_elastic_traceparent_header=false 
-javaagent:{{ apm_home }}/elastic-apm-agent.jar
-Delastic.apm.service_name=keycloak
-Delastic.apm.server_urls={{ apm_url }}

After migrating to keycloak 20 which comes with Quarkus distribution, elastic agent stopped sending metrics to Elastic APM. I used this param -Delastic.apm.trace_methods=org.*,com.* but this is not the right approach. Seems like OpenTelemetry is suggested for sending metrics to Elastic APM, so can anyone suggest integration between keycloak 20 and openTelemetry.

More details can be found here: https://discuss.elastic.co/t/how-dependencies-are-listed-under-observability-apm-dependencies/348410

0

There are 0 best solutions below