Prometheus extension dimensions

Hi all,

I’m making a prometheus extension where metrics named with the id of the producer thread as in the code example. Right now each thread generates a separate dynatrace metric, but I would prefer the thread id as a dimension and only one metric named myapp.Smscntr. Is there any solution to this?

My current code:

prometheus:<br>  - group: myapp metrics 0<br>    interval:<br>      minutes: 1<br>    featureSet: all<br>    dimensions:<br>      - key: myapp<br>        value: const:myapp<br>    subgroups:<br>                     <br>    - subgroup: myapp global gauge<br>      dimensions:<br>        - key: global_gauges<br>          value: const:global_gauges<br>      metrics:<br>        <br><br>        - key: myapp.Smscntr_Thread_0<br>          value: metric:Smscntr_Thread:0<br>          type: gauge<br>          featureSet: all<br><br><br>        - key: myapp.Smscntr_Thread_1<br>          value: metric:Smscntr_Thread:1<br>          type: gauge<br>          featureSet: all<br><br><br>        - key: myapp.Smscntr_Thread_2<br>          value: metric:Smscntr_Thread:2<br>          type: gauge<br>          featureSet: all

Thanks,
Peter

Any chance you can modify your prometheus source? If your source will be like:

Smscntr_Thread{thread="0"} value_0<br>Smscntr_Thread{thread="1"} value_1<br>Smscntr_Thread{thread="2"} value_2

then you can just use:

value: metric:Smscntr_Thread

and you will end with one metric with 3 dimensions.

Hello @rastislav_danis ,

Thanks for the suggestion. Unfortunately changing the source is not possible.

Then i’m afraid it’s not easily possible. There is no ootb option how to map 3 different prometheus metric endpoints into 1 dynatrace metric via prometheus v2 extension. You can use f.e. python v2 extension to achieve this.