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

Davis needs time to store events and problems after the workflow has triggered

henk_stobbe
DynaMight Leader
DynaMight Leader

Hello,

 

when a Event or problem workflow is triggered, I you try to do a dql query to retrieve the attached  problem or events resp. It seems these are not yet available.

After sometime when you run the workflow again retrieving the events attached to a problem and retrieving the problem attached to an event gives no issue;s.

Who knows the wait time before Davis has added these records to a bucket, after a trigger?

 

KR Henk

5 REPLIES 5

christian_kreuz
Dynatrace Advisor
Dynatrace Advisor

It should only take 10 seconds from Workflow being triggered by an Event (this is done internally), to the Event appearing in Grail.

I would recommend adding a Run JavaScript step with

export default async function ({ execution_id }) {
  console.log('Starting to sleep');
  const milliseconds = 15000; // sleep time
  await new Promise(resolve => setTimeout(resolve, milliseconds));
  console.log('Done sleeping');
}

 before the actual DQL statement.

In addition, a built-in "delay" feature for Workflows is planned.

Hi Christian,

FYI this is how my WF looks (-; creating the 5 mins delay!

I will retry to skip the two delay scripts and limit the wait in the main part see what happens. (also I will use the Promise ,  great reminder)

 

Again thanks for your help!

 

henk_stobbe_0-1721904045739.png

 

Hi Christian,

Very small remark/question: I assume all workflow task are separated, I mean the next step will only start if the previous is finished? 

KR Henk

Looking at your screenshot, those tasks should be running in sequence, not parallel.

However, within a single JavaScript task, some things can run parallel, for instance:

export default async function ({ execution_id }) {
  console.log('Starting...');
  setTimeout(() => { console.log('First'); }, 1000);
  setTimeout(() => { console.log('Second'); }, 500);
  console.log('Done!');
}

 

This code sample will lead to an unexpected output of

Starting...
Done!
Second
First

 

you need to use await and a promise to make it right here:

export default async function ({ execution_id }) {
  console.log('Starting...');
  await new Promise(resolve => setTimeout(() => { console.log('First'); resolve(); }, 1000));
  await new Promise(resolve => setTimeout(() => { console.log('Second'); resolve(); }, 500));
  
  console.log('Done!');
}

and you will get the expected output of Starting..., First, Second and Done.

ChristopherHejl
Dynatrace Advisor
Dynatrace Advisor

FYI: we just added another task option to make a task wait a user defined time before executing..This will become available in the upcoming weeks and should make this a lot easier.

Featured Posts