eclipse / microprofile-telemetry

microprofile telemetry
Apache License 2.0
16 stars 16 forks source link

OpenTelemetry Agent #154

Open dalexandrov opened 4 months ago

dalexandrov commented 4 months ago

Currently, the specification mentions that MP Telemetry should work without issues with the Otel Metrics Agent. But this brings a lot of undefined behaviour.

If the agent is present there is practically no control on how the agent was set up, are the properties specified in the MP config applied etc.

The section in the specification should be extended providing more details on how to detect if the agent is present and how to behave if the agent is present.

Should the configuration be ignored and all the control be offloaded to the agent, or not? Should there be a specific property telling that the agent is present and no further setup and config should be done at init, to skip the undefined behaviour.

pdudits commented 4 months ago

Looking at current behaviour of opentelemetry:

But in both cases this only affects GlobalOpenTelemetry and the global one is what agent would use. In my opinion (but cannot back it with experience yet), as long as implementations use different source of OpenTelemetry implementation, these two can coexist, though I sense some trouble with context propagation.

It would be good if other members would share their experiences here so we are aware of cases we need to handle.

Should the configuration be ignored and all the control be offloaded to the agent, or not?

Since there is no stable API to verify that, it would be hard to keep this guarantee across different agent versions.

Should there be a specific property telling that the agent is present and no further setup and config should be done at init, to skip the undefined behaviour.

Having otel.sdk.disabled=false in the config is not necessary for agent to work, but is required for initialization of MP Telemetry. Omitting it would leave all the work to agent, but would also take away any guarantees provides.

Explicit config property requirement could look like this:

If config property mp.telemetry.useGlobalOpenTelemetry has value of true, the implementation SHOULD NOT attempt to configure application-specific OpenTelemetry instance, rather use GlobalOpenTelemetry.get(). This serves the cases when Open Telemetry is configured by other means, i. e. use of Java Agent.

Emily-Jiang commented 4 months ago

@dalexandrov will create a PR