Cron like schedule for 2.0 Extensions?

@Mike_L is this still planned for 1.301? I see this is our next release. I’m wanting to try it out as soon as its available.

Yes, it was completed in 1.301.

@Mike_L -- Please help to share the documentation to refer and update our extension via VSCODE with schedule instead of interval

VScode will support it as soon as you can select the 1.301 schema.

@Mike_L 
Will the the Custom Extensions Creator support this?

Yes

We noticed our ActiveGates were updated recently.

We have a custom DB 2.0 extension that we need to add cron scheduling to ASAP, but I’m not seeing the 1.301 schema mentioned above in VS Code.

Which one of these schemas should we be selecting?

All of our current 2.0 extensions are set to: minDynatraceVersion: “1.279.0”

1.301 or higher. I am not sure why you don’t have 1.301 on your server though.

Thank you, @Mike_L.

Are there any concerns if our extensions are not all using the same minDynatraceVersion:?

At the moment, we only want to add cron to one of our extensions.

Which means, the rest of them will remain on minDynatraceVersion: “1.279.0”.

When updating schemas, is it necessary to do it to ALL extensions?

There’s no concern. It just means that the one with 1.301/1.303 can only run on AG’s of at least that version.

Perfect.

Does the time of day used in the cron expression still need to be in UTC, @Mike_L?

In Extensions 1.0, the cron schedule was set to execute using UTC time.

We need Dynatrace to execute the query at 12:00PM CST on only specific days, but we had to enter 17:00PM CST because it needed to be entered using UTC.

schedule: “0 17 3,10,17,24 * *”

Has anyone confirmed that cron works?

We replaced interval with schedule (using a simple cron expression) and our custom DB Extension now fails for bad JSON/YAML config. :neutral_face:

There are no JSON errors highlighted in the Dynatrace VS Code Extension.

Does the schedule need to go in a specific place in the YAML?

We have it working on our side. I can recommend to use the vscode extension and use schema version 1.300 or later. It will make sure that you put the attribute on the correct place. Be a bit careful with the format, I put the example further down as there are some specialities such as 0/5 for every 5 minutes.

Thank you, @Mike_L .

I’m guessing it does not like the cron expression?

Here’s the cron expression we were using in Extensions 1.0:

Here’s what I have in the new 2.0 extension.yaml:

schedule: “0 17 2,9,16,23 * *”

I placed this under the query like you did in your example.

Am I just missing a question mark in place of the 5th index?

This is not something that was required in Extensions 1.0:

It’s indeed missing the ?, it needs to follow this format: https://www.javainuse.com/cron

Got it working… maybe. :sweat_smile:

Still need to see if it executes the query on the days and time specified in our cron expression.

Here’s the final cron expression.

I needed to replace the last * with a ?.

It would be nice if the Dynatrace VS Code Extension actually flagged my original expression as an error, as the extension’s logs recorded this as an error.

Before:

schedule: “0 17 2,9,16,23 * *”

After:

schedule: “0 17 2,9,16,23 * ?”

Could someone update the Dynatrace VS Code Extension so it provides a better example of how to use the cron schedule?

This messaging is a little confusing:

I suggest having this info box include a link to the official documentation:

This messaging is a lot more clear:

Good news, @Mike_L.

The query is executing on the specified day and time, as expected.

However, it is not returning any metric data.

The query was working fine when we were executing it daily.

But since we went from interval to the new cron schedule, Dynatrace says the query is now “failing”.

It’s a valid query, as I can execute it over and over against our database without issue.

What’s the query execution timeout threshold? How long can a query run before Dynatrace declares it failed?

You can add for example:

timeout: 120

It should be on the same indentation as the query to set the timeout to 2 minutes.

Feel free to contribute to it here, or raise an issue. It’s an open source project: GitHub - dynatrace-extensions/dynatrace-extensions-vscode: A VisualStudio Code extension to support all aspects of developing Dynatrace Extensions 2.0 · GitHub