07 May 2024 12:35 PM - last edited on 08 May 2024 07:36 AM by MaciejNeumann
I am trying to create a metric event using metric selector and the following query:
(builtin:service.requestCount.total:filter(eq("dt.entity.service","SERVICE-9BE003D3882DE5E9")):splitBy()-builtin:service.requestCount.total:filter(eq("dt.entity.service","SERVICE-6AE4AF81ED4ED89B")):splitBy())
Note that there is a possible lag between the 2 service request counts, therefor I want to sample once every 5 or 10 minutes.
However metric events sample by default once every minute and I did not find a way to change this, so I was thinking to possibly put the sample timeframe in the query, is that something that's possible to do? I wasn't able to find it in the documentation.
If not, is there any other was to change the sampling time frame from 1 minute samples?
Solved! Go to Solution.
07 May 2024 06:06 PM
It seems very weird that you'd have to do this, but if it really is the case, it sounds like the timeshift transformation might be useful.
https://docs.dynatrace.com/docs/shortlink/api-metrics-v2-selector#timeshift
21 Jul 2024 10:55 PM
Hi @Eric_Yu ,
I hope you are well.
I have a similar need, however my case is in the form of Tracking my DDU consumption from the start of the year up until now so I would need a timeframe from January 1st until now and timeshift does not help to cater for this. Is there another way to build out this query as My query contains arithmetic structuring and does not translate into DQL in it's current form? Thank you.
14 May 2024 10:45 AM
Hi @KVL,
First, I believe I know what You want to achieve (tried this many times), and it isn't best solution.
But if You want to have aggregate data from 5min You can use “:rate(5m)”. This way You will get collective data for each 5min. Still calculation error stays due first and last minutes of respective services.
Using timeshift as @Eric_Yu suggested have similar issue as some requests are within Your original minute and some are in timeshifted one. I personally consider rate being better of those 2.
Best way is using Grail and DQL where You can match Business identifier in both of those transactions and count those that doesn't have match.
With this option You will not only give You exact data, but also can be used to find those specific transaction that didn't went through process with second request.
Bests
Michał
29 May 2024 11:29 AM
Could you please give me an example of this? What query would I use to achieve this comparison with DQL?
"
Best way is using Grail and DQL where You can match Business identifier in both of those transactions and count those that doesn't have match.
With this option You will not only give You exact data, but also can be used to find those specific transaction that didn't went through process with second request.
."