Reputation: 7568
I'm trying to work out how to configure the micronaut framework with open telemetry. I've created a project which is currently not working here https://github.com/CraftyFella/micronaut-opentelemetry
I feel I've done something fundametally wrong though as while i'm getting traces appear in new relic, they don't contain any of the micronaut configured custom spans using the micronaut annotations.
The documentation is quite light for open telemetry on the micronaut website, so I'm hoping someone in that community can enlighten me into the steps to create a micronaut example that pushes open telemetry info.
Upvotes: 1
Views: 1192
Reputation: 685
Jack here from New Relic. Disclosure: I work on the opentelemetry-java project but haven't used micronaut before.
I dug into the code and found DefaultOpenTelemetryFactory, which appears to be the code that translates application.yml
configuration to OpenTelemetry configuration. It mostly just relies on the built in autoconfigure options, with some code that translates yaml to the flattened options expected by OpenTelemetry autoconfigure. So:
otel:
traces:
exporter: otlp
metrics:
exporter: otlp
is equivalent to:
export OTEL_TRACES_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=otlp
New Relic maintains an example that shows how to configure OpenTelemetry to export to New Relic. The minimal configuration equivalent in micronaut yaml config would be:
otel:
traces:
exporter: otlp
metrics:
exporter: otlp
logs:
exporter: otlp
exporter:
otlp:
endpoint: https://otlp.nr-data.net:4317
headers: api-key=<YOUR_LICENSE_KEY>
compression: gzip
# New Relic requires metrics to be delta
metrics_temporality_preference: delta
I've successfully tested this configuration in the sample app you provided.
(BTW, I encourage you to open an issue with the micronaut-tracing project explaining what was missing in the documentation :).)
Upvotes: 2