# Cron like schedule for 2.0 Extensions?

**URL:** <https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713>\
**Category:** Extensions\
**Tags:** extensions\
**Created:** [November 20, 2023, 12:39pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713 "2023-11-20T12:39:56Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![sivart\_89](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@sivart\_89](https://community.dynatrace.com/u/sivart_89)\
**Post date:** [September 18, 2024, 11:20am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/21 "2024-09-18T11:20:31Z")

</div>

[@Mike\_L](https://community.dynatrace.com/user/11520)&nbsp;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.

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [September 18, 2024, 9:24pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/22 "2024-09-18T21:24:02Z")

</div>

Yes, it was completed in 1.301.

---

<div class="post-metadata">

**Author:** ![Vidhyasagar](https://avatars.discourse-cdn.com/v4/letter/v/a9adbd/32.png) [@Vidhyasagar](https://community.dynatrace.com/u/Vidhyasagar)\
**Post date:** [September 19, 2024, 5:52am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/23 "2024-09-19T05:52:44Z")

</div>

[@Mike\_L](https://community.dynatrace.com/user/11520)&nbsp;-- Please help to share the documentation to refer and update our extension via VSCODE with schedule instead of interval

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [September 19, 2024, 7:40am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/24 "2024-09-19T07:40:24Z")

</div>

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

 ![IMG_4423.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/0/0d93e0f2da033f83a13f9515865d257ddcc4259b.jpeg)

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [September 23, 2024, 10:44am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/25 "2024-09-23T10:44:57Z")

</div>

[@Mike\_L](https://community.dynatrace.com/user/11520)&nbsp;  
Will the the Custom Extensions Creator support this?

---

<div class="post-metadata">

**Author:** ![david\_lopes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/david_lopes/32/27273_2.png) [@david\_lopes](https://community.dynatrace.com/u/david_lopes)\
**Post date:** [September 23, 2024, 11:28am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/26 "2024-09-23T11:28:07Z")

</div>

Yes

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [October 31, 2024, 6:05pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/27 "2024-10-31T18:05:11Z")

</div>

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”**

 ![ASE_0-1730397705302.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/d/ad88b290a9439d0f369422d44a5758e64c734f0d.png)

 ![ASE_1-1730397772221.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/398018ffae064ac240b4ab896fad35ae76277b60.png)

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [October 31, 2024, 6:14pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/28 "2024-10-31T18:14:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 1, 2024, 2:27pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/29 "2024-11-01T14:27:39Z")

</div>

Thank you, [@Mike\_L](https://community.dynatrace.com/user/11520).

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?

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [November 1, 2024, 4:52pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/30 "2024-11-01T16:52:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 1, 2024, 6:41pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/31 "2024-11-01T18:41:00Z")

</div>

Perfect.

Does the time of day used in the cron expression still need to be in UTC, [@Mike\_L](https://community.dynatrace.com/user/11520)?

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 \* \*”**

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 13, 2024, 4:08pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/32 "2024-11-13T16:08:04Z")

</div>

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. 😐

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?

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [November 13, 2024, 9:50pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/33 "2024-11-13T21:50:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 14, 2024, 4:59pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/34 "2024-11-14T16:59:43Z")

</div>

Thank you, [@Mike\_L](https://community.dynatrace.com/user/11520) .

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

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

 ![ASE_0-1731603086324.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/c11fb1ff1fbd41735386aedbb7136200a455a53e.png)

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:

 ![ASE_1-1731603439457.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/e/9ef2fdb541e29bb9c478f0f728ce590be6da1244.png)

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [November 14, 2024, 5:05pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/35 "2024-11-14T17:05:26Z")

</div>

It’s indeed missing the ?, it needs to follow this format:&nbsp;[https://www.javainuse.com/cron](https://www.javainuse.com/cron)

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 14, 2024, 8:10pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/36 "2024-11-14T20:10:09Z")

</div>

Got it working… maybe. 😅

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 \* ?”

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 24, 2024, 1:42am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/37 "2024-11-24T01:42:02Z")

</div>

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:

 ![ASE_0-1732412138628.png](https://global.discourse-cdn.com/dynatrace/original/2X/b/b6e89e8d5a2f2d7569c991faee6633459c44b472.png)

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

> **[SQL data source reference](https://docs.dynatrace.com/docs/ingest-from/extensions/develop-your-extensions/data-sources/sql/sql-reference)**
>
> Learn about SQL extensions in the Extensions framework.

This messaging is a lot more clear:

 ![ASE_1-1732412369383.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/6/260fae02627a2d5e7804a30293a6215a4d4e104a.png)

---

<div class="post-metadata">

**Author:** ![ASE](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@ASE](https://community.dynatrace.com/u/ASE)\
**Post date:** [November 24, 2024, 1:57am UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/38 "2024-11-24T01:57:40Z")

</div>

Good news, [@Mike\_L](https://community.dynatrace.com/user/11520).

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?

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [November 26, 2024, 12:50pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/39 "2024-11-26T12:50:18Z")

</div>

You can add for example:

```php
timeout: 120

```

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

---

<div class="post-metadata">

**Author:** ![Mike\_L](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mike_l/32/11717_2.png) [@Mike\_L](https://community.dynatrace.com/u/Mike_L)\
**Post date:** [November 26, 2024, 12:51pm UTC](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713/40 "2024-11-26T12:51:47Z")

</div>

Feel free to contribute to it here, or raise an issue. It’s an open source project:&nbsp;[GitHub - dynatrace-extensions/dynatrace-extensions-vscode: A VisualStudio Code extension to support all aspects of developing Dynatrace Extensions 2.0 · GitHub](https://github.com/dynatrace-extensions/dynatrace-extensions-vscode)

[Previous page](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713.md?page=1)

[Next page](https://community.dynatrace.com/t/cron-like-schedule-for-2-0-extensions/42713.md?page=3)
