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

How-to retrieve fine grain metric values for a time period

matt_brend1
Inactive


I am attempting to retrieve distinct datapoints from a custom plugin via the API and I can only retrieve a summary of the data, not individual data points. This is the query I am running.

 

https://XXX.dynatrace-managed.com/e/XXX-XXX-XXX-XXX-XXX-XXX/api/v1/timeseries?Api-Token=XXXXXX&amptimeseriesId=custom.python.XX_XXX_Queue_Plugin:XXXIOWaits&ampqueryMode=series&ampstartTimestamp=1514648927000&ampendTimestamp=1514652527000&ampaggregationType=avg


It returns the expected payload:

 

{
"result": {
"dataPoints": {},
"timeseriesId": "custom.python.XX_XXX_Queue_Plugin:XXXIOWaits",
"unit": "Count (count)",
"entities": {},
"resolutionInMillisUTC": 3610000,
"aggregationType": "AVG"
}
}


However this is a summary of the whole 1 hour period. (3610000 MilliSec)


I would like to return the values by the minute, or the values for every 30 minutes. (i.e. resolutionInMillisUTC = 180000000, or = 60000.


In the end, I'd like to increase the timeframe to 1 month and pull the SUM of the data over every 30 minutes.

2 REPLIES 2

matt_brend1
Inactive


I might have answered part of my own question. Looking at the results payload the dataPoints and entities are missing. I tried a different query:


https://XXX.dynatrace-managed.com/e/XXX-XXX-XXX-XXX-XXX-XXX/api/v1/timeseries?Api-Token=XXXXXX&amptimeseriesId=custom.python.XX_XXX_Queue_Plugin:XXXCPUWaits&amprelativeTime=day&ampaggregationType=sum


And this one returned some data.


{
"result": {
"dataPoints": {
"PROCESS_GROUP_INSTANCE-077D7A9E5A605D64": [
[
1514568600000,
1522320
],
.
.
.
.
[
1514654400000,
null
],
[
1514655000000,
null
]
]
},
"timeseriesId": "custom.python.XXX_XXX_Queue_Plugin:XXXCPUWaits",
"unit": "Count (count)",
"entities": {
"PROCESS_GROUP_INSTANCE-077D7A9E5A605D64": "CUSTOMXXX"
},
"resolutionInMillisUTC": 600000,
"aggregationType": "SUM"
}
}
<br>

So it appears that this is working to retrieve data, however I don't know why the later time periods in the day are null. If I look in the console I see data for all of today.

I then tried to pull data for a month and see that it's aggregated to 12 hours.

So the two outstanding questions are:

1. Why is the API not pulling all available data

2. Is it possible to specify the aggregation to a shorter time period?

Thank you.

wolfgang_beer
Dynatrace Leader
Dynatrace Leader

Hi Matthew.

The API is pulling all of the data and does not artificially miss data points out BUT it reacts dynamically upon your selected timeframe in order to not deliver too large payload sizes and to cope with the aggregation retention strategy. Dynatrace typically stores one minute resolution for all metrics for 14 days. So if you select any hour timeframe within the last 2 weeks you will get all minute data points.

One aspect to note here is that if one data point shows a null value no measurement was stored in that minute. If you query a larger timeframe the same data point will get aggregated to a 5 minute data points. If any of the individual 5 minute data points contained a measurement the resulting aggregated data point will contain the aggregated measurement.

This explains why the highest resolution contains null values while the aggregated metric does probably not show null measurements.

Featured Posts