erldns icon indicating copy to clipboard operation
erldns copied to clipboard

Start opentelemetry_api otp application

Open olof opened this issue 2 years ago • 6 comments

This is needed even in environments where opentelemetry itself isn't enabled, as it provides the interface for erldns to define its traces. Without this, erldns_worker would crash when processing queries, as the opentelemetry module doesn't exist:

{'module could not be loaded',
    [{opentelemetry,get_tracer,[erldns_worker],[]},
     {erldns_worker,handle_cast,2,
         [{file,".../erldns/src/erldns_worker.erl"},
          {line,69}]},

Note: I didn't notice this issue when starting my application using rebar3 shell; it was only when I deployed using a release (rebar3 release) this started to occur, so I assume it has to do with how the modules included in the release are collected. Without this change, relx wouldn't know to include the opentelemetry module (provided by the opentelemetry_api application), whereas rebar3 shell seems to have another another mechanism to find modules.

olof avatar Apr 05 '22 16:04 olof

(The test failure is addressed by #141.)

olof avatar Apr 05 '22 17:04 olof

After reviewing the documentation and running some tests locally, I can confirm that the opentelemetry_api should be included as a direct dependency.

@olof if you can merge main into this branch we can approve and merge this PR.

Thanks for your contribution.

DXTimer avatar Jul 13 '22 08:07 DXTimer

@olof if you can merge main into this branch we can approve and merge this PR.

Updated (rebased, hope that's ok).

olof avatar Jul 27 '22 16:07 olof

New test failures; doesn't look directly related to my change from what can tell.

olof avatar Jul 27 '22 16:07 olof

@olof the tests fail because now we have an actual reference to perform a type check and the currently used map() type for SpanCtx is invalid. The correct typing needs to be used in this case: ' otel_tracer:tracer_ctx()`. The type error only occurs in three places, would you be open to updating the type checks to get the specs to pass?

DXTimer avatar Jul 27 '22 18:07 DXTimer

Ah, got it! It was my fault after all :). Didn't realize the connection. I've just updated the pull request branch with your suggestion applied. Thanks!

olof avatar Jul 27 '22 21:07 olof