DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to plot a graph comparing successful API hits today vs. same day last week?

subair-appakkan
Newcomer

I want to create a time-series chart in Dynatrace that shows the number of successful API hits for today and compares it to the same day last week (aligned by time of day).

I currently have a query that gives me the total count:

fetch user.events, scanLimitGBytes:-1
| filter app.bundle == "com.my.package"
| filter http.response.status == 200
| summarize count()

This works for totals, but I need:

  • A graph showing progression throughout the day.
  • Two series: Today (Sunday) and Last Sunday(or same weekday last week).
  • Ideally aligned so 00:00 today compares to 00:00 last week.

What’s the correct DQL syntax or recommended approach to achieve this? Should I use makeTimeseries or bin()? And how do I shift last week’s timestamps forward for overlay?
A sample image is attached.

Any examples or best practices would be appreciated!

2 REPLIES 2

p_devulapalli
Leader

@subair-appakkan  Here is an example for memory, you can use similar logic for your use case 

timeseries today = avg(dt.host.memory.usage), 
  from:now() - 24h, to:now(),
  by: {dt.entity.host},
  filter: dt.entity.host== "HOST-XXX"

| fieldsAdd lastWeek = lookup ([timeseries mem = avg(dt.host.memory.usage),   
  from:now() - 7d - 24h, to:now() - 7d,
  by:{dt.entity.host},
  filter: dt.entity.host == "HOST-XXX"],
  sourceField:dt.entity.host, lookupField:dt.entity.host)[mem]
Phani Devulapalli

subair-appakkan
Newcomer

I could not make it in the mobile application context.

Featured Posts