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

Metrics v2: How to pull out data from specific Key Request or use filters

How to pull out data from metrics api v2 which would contain data from one certain key request?
Should I use and obtain the entityID for my KeyRequest somehow and would there be possibility to filter the requests based on request parameters?

I can filter out some certain service but this call returns data from all the Key Requests and I would need to filter my data to one specific use case but can't get my head around how to do it.

https://xxxxxxxxx.live.dynatrace.com/api/v2/metrics/query?resolution=Inf&from=1595851920000&to=1595852100000&api-token=XXXXXXXXXX&metricSelector=builtin:service.keyRequest.dbChildCallCount&entitySelector=type(SERVICE_METHOD),entityId(SERVICE_METHOD-18444A1107CDD08C)


I have tried go trough the documentation but I would appreciate if someone could offer some help how we could filter out data.

1 REPLY 1

Radu
Dynatrace Pro
Dynatrace Pro

Hi Janne,

You are absolutely spot on! Your API call seems correct to me.

The key parts are:

  • metricSelector - must be for a '.keyRequest.' type metric
  • entitySelector - must have:
type("SERVICE_METHOD"),entityId("SERVICE_METHOD-xxxxxxxx")

Also, make sure your metric actually exists at the keyRequest level. On my environment for example, I have dbChildCall only at the service level:

builtin:service.dbChildCallCount

Try using a generic one (for testing purposes) to ensure your call returns something. Maybe something like:

builtin:service.keyRequest.count.total


I hope this helps.

Best regards,

Radu