Hi guys. I'm trying to set up elastic apm with opentelemetry, but I see messages with NULL in the otel-collector logs, it seems that there is something missing in my settings?
https://gist.github.com/Nitrino/77cd49acc3517290eb8d880caef7ef42
I use:
{:opentelemetry_api, "~> 0.3"},
{:opentelemetry_exporter, "~> 0.4"},
{:opentelemetry_ecto, "~> 0.1.0"},
{:opentelemetry_plug, github: "opentelemetry-beam/opentelemetry_plug"},
{:opentelemetry_phoenix, github: "opentelemetry-beam/opentelemetry_phoenix"},
And set up a configuration:
config :opentelemetry, :resource,
service: [
name: "qb_calls",
namespace: "qb_calls"
]
config :opentelemetry,
:processors,
ot_batch_processor: %{
exporter: {:opentelemetry_exporter, %{protocol: :http_protobuf, endpoints: [{:http, 'localhost', 55681, []}]}}
}
I tried to enable ot_exporter_stdout
for debugging (:ot_batch_processor.set_exporter(:ot_exporter_stdout, [])
) and seemingly correct output in the console.
https://gist.github.com/Nitrino/3d7375d7c75f1be1352280f63fcd64aa
I can't figure out what's wrong with my settings
with_span
since the tracer isn't needed in many calls anymore) remain the same
otel_exporter_stdout
)span_with_sleep_ms(Delay) ->
Sampler = otel_sampler:setup(always_on, #{}),
Tracer = opentelemetry:get_tracer(otel_example),
otel_tracer:with_span(Tracer, <<"span_with_sleep_ms/1">>, #{sampler => Sampler},
fun(SpanCtx) ->
otel_span:set_attribute(SpanCtx, <<"Delay">>, Delay),
timer:sleep(Delay)
end).