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

API V2 /metrics/query with names transformation : How to mask the json "dimensionMap" on response ?

agravier
Newcomer

Hello,


I use the names transformation feature with endpoint "/metrics/query" to get the datapoint with the entity name on the response.
I use the metric selector : builtin:host.cpu.usage:names:merge(1)


And It works good :

{

"totalCount": 4,

"nextPageKey": null,

"result": [

{

"metricId": "builtin:host.cpu.usage:names:merge(1)",

"data": [

{

"dimensions": [

"RD501D37E80E-HOST"

],

"dimensionMap": {

"dt.entity.host.name": "RD501D37E80E-HOST"

},

"timestamps": [

1611230400000,

1611241200000,


But the key "dt.entity.host.name": RD501D37E80E-HOST" is generated exception on my integration because the key name contains the char and this char is not allowed with the mongodb driver https://docs.mongodb.com/manual/core/document/ :

  • Until support is added in the query language, the use of $ and . in field names is not recommended and is not supported by the official MongoDB drivers.


Is there a way to mask the "dimensionMap" on response by changing the query parameters ?


Thank you.
Regards, Aurélien

2 REPLIES 2

skrystosik
DynaMight Guru
DynaMight Guru

I don't think it is possible without extra script. Maybe you should use python script for example which will collect payloads in regular basis and then modify it on the fly before putting it into mongo?

Sebastian

Regards, Sebastian

AntonioSousa
DynaMight Guru
DynaMight Guru

Just for someone that might see this in the future, the use of merge(1) ahs been deprecated, and should use the dimension key name.

Please check out: https://www.dynatrace.com/support/help/shortlink/api-metrics-v2-selector#merge-transformation

Antonio Sousa

Featured Posts