Search code examples
spring-bootamazon-cloudwatchspring-boot-actuatormicrometer

micrometer & spring boot: aws otlp opentelemtry to cloudwatch


It's not clear to me what dependency I really need.

Up to now, I've been creating only metrics and sending them to cloudwatch.

I've been using io.micrometer:micrometer-registry-cloudwatch2.

However, currently I need to also generate tracing and I need to use OpenTelemetry in order to take advantadge of autoinstrumentation.

So, should I add dependency io.micrometer:micrometer-registry-otlp or I should remove micrometer-registry-cloudwatch2 in place of micrometer-registry-otlp?

Cloudwatch accepts OTLP?


Solution

  • I need to also generate tracing and I need to use OpenTelemetry in order to take advantadge of autoinstrumentation.

    The auto-instrumentation in Spring does not need OpenTelemetry, you can use OTel or Brave under the hood for tracing, it's your choice,

    So, should I add dependency io.micrometer:micrometer-registry-otlp or I should remove micrometer-registry-cloudwatch2 in place of micrometer-registry-otlp?

    You might want to look at Micrometer Tracing docs: https://docs.micrometer.io/tracing/reference/ Both micrometer-registry-cloudwatch2 and micrometer-registry-otlp are for metrics not tracing. If you want to use Micrometer Tracing you will need two things:

    1. A tracer bridge (Brave or OTel)
    2. A reporter/exporter for the tracer

    For example:

    implementation 'io.micrometer:micrometer-tracing-bridge-brave'
    implementation 'io.zipkin.reporter2:zipkin-reporter-brave'
    

    or

    implementation 'io.micrometer:micrometer-tracing-bridge-otel'
    implementation 'io.opentelemetry:opentelemetry-exporter-otlp'
    

    Check the docs, it discusses these details: https://docs.micrometer.io/tracing/reference/tracers.html

    Cloudwatch accepts OTLP?

    This can be a quick search with your favorite search engine. Based on my query, it seems not, it seems you should use X-Ray which is supported by both Brave and OTel but for OTel you need to deploy an extra component in your infra: the OTel Collector.