How to set the Open Telemetry exporter endpoint using an environment variable?

211 views
Skip to first unread message

Edgar Vonk

unread,
Apr 17, 2024, 2:23:59 PM4/17/24
to WildFly
Hi,

We want to set the exporter endpoint of the WildFly Open Telemetry subsystem using an environment variable (instead of using the CLI).

This works using WildFly's CLI:

/subsystem=opentelemetry:exporter(name=endpoint):write-attribute(name=endpoint,value="http://otel-collector:4317")

(which I only figured out using GitHub Copilot btw..). Does anyone know what the environment variable equivalent is?

Using https://docs.wildfly.org/31/Admin_Guide.html#overridden-attribute-value I thought it might be `SUBSYSTEM_OPENTELEMETRY__EXPORTER_NAME_ENDPOINT__ENDPOINT=http://otel-collector:4317` or something similar but nothing works so far.

We do have `WILDFLY_OVERRIDING_ENV_VARS=1` and we already set other settings in the Open Telemetry subsystem. E.g. if we want to turn off the sampler this works just fine: `SUBSYSTEM_OPENTELEMETRY__SAMPLER_TYPE=off`.

Any help would be greatly appreciated. :-)

Jeff Mesnil

unread,
Apr 17, 2024, 2:58:07 PM4/17/24
to Edgar Vonk, WildFly

On 17 Apr 2024, at 20:23, 'Edgar Vonk' via WildFly <wil...@googlegroups.com> wrote:

Hi,

We want to set the exporter endpoint of the WildFly Open Telemetry subsystem using an environment variable (instead of using the CLI).

This works using WildFly's CLI:

/subsystem=opentelemetry:exporter(name=endpoint):write-attribute(name=endpoint,value="http://otel-collector:4317")

(which I only figured out using GitHub Copilot btw..). Does anyone know what the environment variable equivalent is?

Using https://docs.wildfly.org/31/Admin_Guide.html#overridden-attribute-value I thought it might be `SUBSYSTEM_OPENTELEMETRY__EXPORTER_NAME_ENDPOINT__ENDPOINT=http://otel-collector:4317` or something similar but nothing works so far.

I think you are doubling the underscores too much. You only need 2 underscores before the attribute.  Could you give a try with:

SUBSYSTEM_OPENTELEMETRY_EXPORTER_NAME_ENDPOINT__ENDPOINT=http://otel-collector:4317

Best regards,
jeff

--
Jeff Mesnil
Engineer @ Red Hat
http://jmesnil.net/

Edgar Vonk

unread,
Apr 17, 2024, 3:56:08 PM4/17/24
to WildFly
Hi Jeff,

Thanks a lot for your help!

Having found https://docs.wildfly.org/31/wildscribe/subsystem/opentelemetry/index.html it turned out to be simpler than I thought:

SUBSYSTEM_OPENTELEMETRY__ENDPOINT=http://otel-collector:4317

To be honest those WildFly subsystem configurations still confuse me. Having read https://docs.wildfly.org/31/Admin_Guide.html#Observability_Tracing I never would have guesses how to configure this subsystem using environment variables. You really need to find https://docs.wildfly.org/31/wildscribe/subsystem/opentelemetry/index.html to understand that part I think. It would be great if the general WildFly documentation could point that out maybe?

cheers

Edgar
Reply all
Reply to author
Forward
0 new messages