cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Prometheus extension dimensions

PeterKenyeres
Newcomer_

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:
  - group: myapp metrics 0
    interval:
      minutes: 1
    featureSet: all
    dimensions:
      - key: myapp
        value: const:myapp
    subgroups:
                     
    - subgroup: myapp global gauge
      dimensions:
        - key: global_gauges
          value: const:global_gauges
      metrics:
        

        - key: myapp.Smscntr_Thread_0
          value: metric:Smscntr_Thread:0
          type: gauge
          featureSet: all


        - key: myapp.Smscntr_Thread_1
          value: metric:Smscntr_Thread:1
          type: gauge
          featureSet: all


        - key: myapp.Smscntr_Thread_2
          value: metric:Smscntr_Thread:2
          type: gauge
          featureSet: all

Thanks,
Peter

3 REPLIES 3

rastislav_danis
DynaMight Pro
DynaMight Pro

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

Smscntr_Thread{thread="0"} value_0
Smscntr_Thread{thread="1"} value_1
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.

Alanata a.s.

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.

Alanata a.s.

Featured Posts