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

Interesting Behavior when using queryExecutionClient.queryExecute

DeeJay
Frequent Guest

I recently watched "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.   I thought I would replicate his work to cement my knowledge.  Without the code and some of the DQL being off screen.  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,  after a little experimenting with different DQLs including some Logs,  I found I needed to add a ", from:now() - 100d" into my DQL,  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.  Can someone point me to the explanation of this?  Code change to make it work 
 
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,
},});

 

At Perform 2023, #Dynatrace revealed Dynatrace AppEngine, enabling users to create custom, compliant, and intelligent data-driven apps. AppEngine brings logic to data, thus offering users myriad new ways to get value from data using the Dynatrace Software Intelligence Platform. In this ...
2 REPLIES 2

gilgi
DynaMight Champion
DynaMight Champion

@DeeJay ,

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.

DeeJay
Frequent Guest

@gilgi 

Thanks for your comment,  the issue I am having is caused by an assumption on my part.  I was testing my DQL in Notebooks and I assumed the time range was the same as the default in my appEngine app.  By default a new Notebook Query Grail on my system is Last 7 days, and clearly in the 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,  I found the lifetime field which is a TIMEFRAME which makes sense now that I think about it.   

Featured Posts