Open Q&A
If there's no good subforum for your question - ask it here!
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Timeout executing a Grail DQL query from an ActiveGate using an HTTP call - Extension SDK

chris_cho
Helper

Hello,

I am not sure why I am getting a timeout exception when I execute a DQL query from an ActiveGate using the HTTP request

curl -X 'POST' 'https://{environmentid}.apps.dynatrace.com/platform/storage/query/v1/query:execute' \
-H 'accept: application/json' -H 'enforce-query-consumption-limit: false' \
-H 'Authorization: Bearer <platfom token>' \
-H 'Content-Type: application/json' \
-d '{
  "defaultTimeframeStart": "2026-01-01T00:00:00.000Z",
  "defaultTimeframeEnd": "2026-01-03T23:59:59.997Z",
  "includeTypes": false,
  "locale": "en_US",
  "query": "DQL_query",
  "requestTimeoutMilliseconds": 50,
  "timezone": "UTC"
}'

The exception message is:
HTTPS://{environmentid}.apps.dynatrace.com', port=443): Read timed out.

Executing  this HTTP request externally, or from Swagger, I am getting the expected data.

{
  "state": "SUCCEEDED",
  "progress": 100,
  "result": {
    "records": [
      {
        "timestamp": "2026-01-03T08:00:27.437000000Z",
        . . .
      }
    ],
    "types": [],
    "metadata": {
      "grail": {
        "canonicalQuery": "fetch ... | limit 1",
        . . .
        "scannedRecords": 40692,
        . . .
        "analysisTimeframe": {
          "start": "2026-01-01T00:00:00.000000000Z",
          "end": "2026-01-03T23:59:59.997000000Z"
        },
        . . .
      }
    }
  }
}

Let me know if there are any restrictions from AGs regarding HTTP calls to Grail DQL queries and if there is any workaround.

Thanks,
Chris

7 REPLIES 7

Julius_Loman
DynaMight Legend
DynaMight Legend

Most likely, there is a firewall in your environment, and your ActiveGate uses a proxy or a reverse proxy for connecting to Dynatrace SaaS. 

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

Hello @Julius_Loman,

Thank you for your reply, and taking your time considering my concern.
I will check in the morning with the admin, these details you mentioned.

My main concern is whether the ActiveGates can initiate an HTTP request, using platform token, executing Grail DQL queries, handled by an Extension SDK.

Regards,

Chris

I assume you want to execute from an ActiveGate extension. There is actually nothing blocking your code with executing http requests.

Btw - accessing Environment APIs is easy, since they are also exposed on the ActiveGate itself (use https://aghost:agport/e/<environmentid> to access them, for example https://localhost:9999/e/abc12345/api/v1/time (if your AG runs on standard 9999/tcp and don't forget AG have self-signed certs by default, unless you add your own one). 

Unfortunately, platform APIs are not exposed on AG. What is your use case anyway to query Grail from the ActiveGate?

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

Hi @Julius_Loman,

Thank you for your reply, which attest that "platform APIs are not exposed on AG". That means I cannot use any of the apps APIs, from https://{environmentid}.apps.dynatrace.com.

Indeed, I have access from AGs to environment APIs, https://{environmentid}.live.dynatrace.com.

The use case is from a custom extension SDK to execute a DQL query, getting the latest log or bizevent for a specific filter criteria.
The main idea is to store somewhere a the latest successful execution ingesting some data. I thought that BizEvents or Logs, would be the right place.
Would be any other alternative getting this data querying Logs or BizEvents, using Environment APIs?

@chris_cho I meant the API is not exposed by the ActiveGate itself. But you can still access the environment URL. ActiveGate does not block it.

If you run an ActiveGate, it listens on 9999/tcp port for communication (unless customized). This https endpoint also exposes Dynatrace Environment API - https://docs.dynatrace.com/docs/shortlink/env-api on that port. So you don't need to configure proxy or other means to access the API and the ActiveGate will pass the calls. There is no API for Grail query in the Environment API, it's part of the Platform API.


I do not know your use case in detail, but it sounds like workflows would be much easier to handle this task, and those run within the Dynatrace cluster itself, which is "close" to the Grail data. Workflows can also access other http endpoints - even onpremises.

Do you just want to store some state of the extension? Grail is probably not the best place for that.

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

I built a generic custom extension using Python Extension SDK, that supposed to be used and configured by other teams through its UI. That's why workflows may not be suitable for this initiative.
I was thinking to use workflows specifically executing dynamic DQL queries which include specific filter criteria based on different feeds.

Hello @Julius_Loman,

It looks like the issue with the timeout executing the Grail DQL Query API is due to firewall.
The firewall rules for AGs did not include the apps (platform) endpoint, just the live (environment) endpoint.
The issue has been addressed.

Thank you for your consideration and inputs! 🎉
Chris

Featured Posts