Micrometer.DynatraceMetricsRegistry - Dynatrace always returns 400 error

I am building a Spring Boot 2.2.1.RELEASE application and using Micrometer, Actuator and DynatraceMetricsRegistry for piping custom metrics, JVM and HTTP metrics into Dynatrace . But this is not working as expected in Dynatrace.

I get the following errors as per the polling interval configured in the application.properties for Dynatrace :

Log Excerpt :

2020-02-06 02:21:06.234 ERROR 64357 --- [trics-publisher] i.m.dynatrace.DynatraceMeterRegistry : failed to create custom metric custom:jvm.threads.states in dynatrace: {“error”:{“code”:400,“message”:“The dimensions of an already configured timeseries id cannot be changed. Currently configured dimensions are: jvm.threads.states”}}

2020-02-06 02:21:06.634 ERROR 64357 --- [trics-publisher] i.m.dynatrace.DynatraceMeterRegistry : failed to create custom metric custom:http.server.requests.count in dynatrace: {“error”:{“code”:400,“message”:"The dimensions of an already configured timeseries id cannot be changed. Currently configured dimensions are: coffee"}}

2020-02-06 02:21:06.973 ERROR 64357 --- [trics-publisher] i.m.dynatrace.DynatraceMeterRegistry : failed to create custom metric custom:http.server.requests.max in dynatrace: {“error”:{“code”:400,“message”:“The dimensions of an already configured timeseries id cannot be changed. Currently configured dimensions are: coffee”}}

…

…

2020-02-06 02:21:09.997 ERROR 64357 --- [trics-publisher] i.m.dynatrace.DynatraceMeterRegistry : failed to send metrics to dynatrace: {“error”:{“code”:400,“message”:“Constraints violated.”,“constraintViolations”:[{“path”:“series[20].dimensions”,“message”:“Dimensions don’t match dimensions specified in configuration. Allowed extra dimensions from the configuration are: jvm.gc.memory.allocated”,“parameterLocation”:“PAYLOAD_BODY”,“location”:null}]}}

I have created a custom device under the technologies section in Dynatrace and no metrics are getting captured in the dynatrace dashboard. Please help .

My application.properties are :

management.endpoints.web.exposure.include=health,info

Although the below ones are obfuscated they are correct and worked when I tested this using a REST client tool :

management.metrics.export.dynatrace.api-token=XXXXXX
management.metrics.export.dynatrace.uri=https://XXXXXX.live.dynatrace.com
management.metrics.export.dynatrace.device-id=XXXXXX
management.metrics.export.dynatrace.enabled=true
management.metrics.export.dynatrace.group=XXXXXX
management.metrics.export.dynatrace.step=1m

It means that you have already created custom metrics on this ID and you cannot redefine dimensions for it. You should change id of metric, or delete them and recreate again.

Sebastian

I’m having similar issue…We recently received dynatrace custom device details like
api-token and uri

I configured the below properties in spring-boot application.yml file

management:
  metrics:
    export:
      dynatrace:
        api-token: here token provided by the team who created dynatrace custom device
        device-id: here gave random name
        enabled: true
        uri: here url provided by the team who created dynatrace custom device
        step: 1m

Also, I have below property configured in application.yml

management
  endpoints:
    web:
      exposure:
        include: 'info,health,metrics,refresh,prometheus'

Adding error details
 DynatraceMeterRegistry.class 2021-04-17 13:50:00,112 ERROR[io.micrometer.dynatrace.DynatraceMeterRegistry,THREAD=main,] failed to create custom metric in dynatrace: custom:jvm.gc.memory.promoted java.net.SocketTimeoutException: connect timed out -- --

Hello! I just wanted to let you know - and for future references - that we have published a new version of the micrometer registry for Dynatrace: https://micrometer.io/docs/registry/dynatrace, with simplified deployment and that automatically connecting your Micrometer metrics to the topology.

Documentation: Send Micrometer metrics to Dynatrace — Dynatrace Docs

Sonja