2

I am trying to add tracing on a Wildfly server (specifically Keycloak Docker image)

Following this document https://docs.wildfly.org/19/Admin_Guide.html#MicroProfile_OpenTracing_SmallRye

I got as far as

/extension=org.wildfly.extension.microprofile.opentracing-smallrye:add
/subsystem=microprofile-opentracing-smallrye:add

But I can't get the next parts working to set it to point to zipkin:9411

The next command in the instructions failed

[standalone@localhost:9990 /]  /subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:add()
{
    "outcome" => "failed",
    "failure-description" => "WFLYCTL0030: No resource definition is registered for address [
    (\"subsystem\" => \"microprofile-opentracing-smallrye\"),
    (\"jaeger-tracer\" => \"my-tracer\")
]",
    "rolled-back" => true
}

However, doing it using /opt/jboss/startup-scripts/ also fails

Executing cli script: /opt/jboss/startup-scripts/enable-tracing.cli
No connection to the controller.

Using @ehsavoie answer I got a bit further

embed-server --admin-only=true
/extension=org.wildfly.extension.microprofile.opentracing-smallrye:add()
/subsystem=microprofile-opentracing-smallrye:add()
/subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:add()
/subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:write-attribute(name=sender-endpoint,value=http://tracing:9411)
/subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:write-attribute(name=propagation,value=[B3])
/subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:write-attribute(name=reporter-log-spans,value=true)
/subsystem=microprofile-opentracing-smallrye:write-attribute(name=default-tracer,value=my-tracer)
stop-embedded-server

but still does not log to zipkin which uses B3.

I also tried

/subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:write-attribute(name=sender-endpoint,value=http://tracing:9411/api/v1/spans)
2
  • I just tried your commands on WildFly 19 after removing the opentracing extension and subsystem and it passed. Could you please put a link to the image you are using ?
    – ehsavoie
    May 4, 2020 at 9:55
  • I used jboss/keycloak May 4, 2020 at 23:01

3 Answers 3

1
embed-server --admin-only=true
/extension=org.wildfly.extension.microprofile.opentracing-smallrye:add()
/subsystem=microprofile-opentracing-smallrye:add()
/subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:add()
stop-embedded-server

This jboss-cli script should enable opentracing before starting the server properly. I'm not sure how/when you can execute that with keycloack image

6
0

You need to reload after adding the subsystem:

[standalone@localhost:9990 /] /extension=org.wildfly.extension.microprofile.opentracing-smallrye:add
{"outcome" => "success"}

[standalone@localhost:9990 /] /subsystem=microprofile-opentracing-smallrye:add
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

[standalone@localhost:9990 /] reload
[standalone@localhost:9990 /] /subsystem=microprofile-opentracing-smallrye/jaeger-tracer=my-tracer:add()
{"outcome" => "success"}
1
  • 1
    can it be done from the a CLI startup script? as I had noted in the OP that I wanted it in startup scripts May 5, 2020 at 12:26
0

I would recommend https://github.com/open-telemetry/opentelemetry-java-instrumentation for tracing. It needs to be started as javaagent, so JAVA_OPTS_APPEND can be used with official Keycloak Docker image, e.g.:

JAVA_OPTS_APPEND: "-javaagent:/opentelemetry-javaagent-all.jar"

And then agent can be configured via env variables, e.g.:

OTEL_SERVICE_NAME: keycloak
OTEL_TRACES_EXPORTER: jaeger
OTEL_EXPORTER_JAEGER_ENDPOINT: <jaeger endpoint>

It works also with future Keycloak X version and without complicated startup scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.