# Interesting Behavior when using queryExecutionClient.queryExecute

**URL:** <https://community.dynatrace.com/t/interesting-behavior-when-using-queryexecutionclient-queryexecute/43169>\
**Category:** Developer Q&A Forum\
**Tags:** dql, dynatrace-app-toolkit, custom-app\
**Created:** [December 12, 2023, 11:16pm UTC](https://community.dynatrace.com/t/interesting-behavior-when-using-queryexecutionclient-queryexecute/43169 "2023-12-12T23:16:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeeJay](https://avatars.discourse-cdn.com/v4/letter/d/48db29/32.png) [@DeeJay](https://community.dynatrace.com/u/DeeJay)\
**Post date:** [December 12, 2023, 11:16pm UTC](https://community.dynatrace.com/t/interesting-behavior-when-using-queryexecutionclient-queryexecute/43169/1 "2023-12-12T23:16:28Z")

</div>

I recently watched&nbsp;"A Practitioners Guide to “Dynatrace AppEngine: Everything thinkable is now possible”

[![](https://global.discourse-cdn.com/dynatrace/original/3X/e/7/e7da411e00a0e847c773bc390370886aa1457a5c.jpeg "A Practitioners Guide to "Dynatrace AppEngine: Everything thinkable is now possible") ](https://www.youtube.com/watch?v=D5SDmLx6Aj4)

. where Stefan Wassebauer did a technical demo of fetching dt.entity.service and getting the called and calling services.&nbsp; &nbsp;I thought I would replicate his work to cement my knowledge.&nbsp; Without the code and some of the DQL being off screen.&nbsp; I started with Notebooks in my environment to make sure I knew where to start.

This is the DQL that I ended up with:

fetch dt.entity.service

| fieldsAdd num\_callers = arraySize(called\_by[dt.entity.service]), num\_called = arraySize(calls[dt.entity.service])  
| filter num\_callers \> 1  
| filter num\_called \> 1  
| limit 20

when I added this to my code for app Engine

export default async function () {const result = await queryExecutionClient.queryExecute({body:{query: “fetch dt.entity.service | fieldsAdd num\_callers = arraySize(called\_by[dt.entity.service]), num\_called = arraySize(calls[dt.entity.service]) | filter num\_callers \> 1 | filter num\_called \> 1 | limit 10”,requestTimeoutMilliseconds: 30000,},});I found that I was only getting 1 record returned,&nbsp; after a little experimenting with different DQLs including some Logs,&nbsp; I found I needed to add a “, from:now() - 100d” into my DQL,&nbsp; I am only a couple of months into working with Dynatrace and DQL is still new to me but I don’t understand why I would need a time range in my DQL when working with dt.entities.&nbsp; Can someone point me to the explanation&nbsp;of this?&nbsp; Code change to make it work&nbsp;export default async function () {const result = await queryExecutionClient.queryExecute({body:{query: “fetch dt.entity.service _**, from:now() - 100d**_ | fieldsAdd num\_callers = arraySize(called\_by[dt.entity.service]), num\_called = arraySize(calls[dt.entity.service]) | filter num\_callers \> 1 | filter num\_called \> 1 | limit 10”,requestTimeoutMilliseconds: 30000,},});

---

<div class="post-metadata">

**Author:** ![gilgi](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gilgi/32/11747_2.png) [@gilgi](https://community.dynatrace.com/u/gilgi)\
**Post date:** [December 13, 2023, 6:58am UTC](https://community.dynatrace.com/t/interesting-behavior-when-using-queryexecutionclient-queryexecute/43169/2 "2023-12-13T06:58:08Z")

</div>

[@DeeJay](https://community.dynatrace.com/user/67077)&nbsp;,

Could it be that it’s just because you don’t have services with both number of callers and called services are greater than 1 in the whort time period?

I would suggest first display the values without increasing the timerange to make sure its correct.

---

<div class="post-metadata">

**Author:** ![DeeJay](https://avatars.discourse-cdn.com/v4/letter/d/48db29/32.png) [@DeeJay](https://community.dynatrace.com/u/DeeJay)\
**Post date:** [December 13, 2023, 1:58pm UTC](https://community.dynatrace.com/t/interesting-behavior-when-using-queryexecutionclient-queryexecute/43169/3 "2023-12-13T13:58:50Z")

</div>

[@gilgi](https://community.dynatrace.com/user/12008)

Thanks for your comment,&nbsp; the issue I am having is caused by an assumption on my part.&nbsp; I was testing my DQL in Notebooks and I assumed the time range was the same as the default in my appEngine app.&nbsp; By default a new Notebook Query Grail on my system is Last 7 days, and clearly in the&nbsp;queryExecutionClient.queryExecute the time range is less.

The other assumption I was making is that a dt.entity.service didn’t have a time range but when I did a  
describe dt.entity.service in my notebook,&nbsp; I found the lifetime field which is a TIMEFRAME which makes sense now that I think about it.
