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

Dynatrace Environment API 2.0/metrics/query

Balamurugesh
Guide

hi, I am trying to pull monthwise availability metrics of synthetic monitors from dynatrace using below query,

curl -X GET "https://abc.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.availabili..." -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token apiKey"

Issue: When i run this query, am getting availability metrics for 2 months instead of a month. For instance, i ran the above query today and got availability details for Jan and december instead of december.  Need your inputs ni refactoring the above query to get monthwise data for a particular month.

4 REPLIES 4

Julius_Loman
DynaMight Guru
DynaMight Guru

If you want only a single value for the entire timespan, then you need either set the resolution to inf instead of 1M or use the :fold transformation in the metric selector

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Thanks Julius. abovee solution worked.

 

Also, in response am getting date format as "1/1/2023 12:00:00 AM".  Can i get it in different format like "23-Jan"?

API works with epoch timestamps. There is no way it returns a different format, maybe the tool which converts that epoch for you already?

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner