Skip to main content

DQL Query

Exposes an API to fetch records stored in Grail

npm install @dynatrace-sdk/client-query

queryAssistanceClient

import { queryAssistanceClient } from '@dynatrace-sdk/client-query';

queryAutocomplete

queryAssistanceClient.queryAutocomplete(config): Promise<AutocompleteResponse>

Get a structured list of suggestions for the query at the given position.

For information about the required permissions see the Bucket and table permissions in Grail documentation.

Overview

We provide a list of suggestions that may be used after the cursor position. The following queries will all provide the same results:

  • query: "f"
  • query: "f", cursorPosition:1
  • query: "fetch ", cursorPosition:1

Available fields:

FieldDescription
suggestionsa list of suggestions. Each item is a separate possible suggestion, despite they might have the same outputs.
optionalwhether the suggestion is optional. If true, the query until the cursor position might work. If false, the query is definitely incomplete or invalid if cut at the cursor position.

Fields in the suggestions

FieldDescription
suggestiona string representing the whole suggestion. This information could also be derived from the parts.
alreadyTypedCharactershow many characters of this suggestion have already been typed (and will be overridden by the suggestion).
partsa list of semantically enriched information on what are the parts of a suggestion.

Fields in parts

FieldDescription
suggestiona string representing the current part of the suggestion.
typecurrent types: SPACE, PIPE, COMMAND (may be extended)

The type helps to treat specific parts of the suggestion different to others; either by a different visualization, a link to docs, etc.

Parameters

NameType
config.body*requiredAutocompleteRequest

Returns

Return typeDescription
Promise<AutocompleteResponse>A list of structured autocomplete suggestions.

Throws

Error TypeError Message
ErrorEnvelopeErrorThe supplied request is wrong. Either the query itself or other parameters are wrong. | An internal server error has occurred.

Code example

import { queryAssistanceClient } from "@dynatrace-sdk/client-query";

const data = await queryAssistanceClient.queryAutocomplete({
body: {
query:
'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
},
});

queryParse

queryAssistanceClient.queryParse(config): Promise<DQLNode>

Get a structured tree of the canonical form of the query.

For information about the required permissions see the Bucket and table permissions in Grail documentation.

Overview

Returns the parsed query as a tree, containing the structure of the canonical query. Tree-nodes can contain references to the token position where they originate from. This may help to provide hover effects, show canonical forms, mark optional items, and more.

Details

The query tree consists of nodes that contain different additional information (everything optional):

General Fields

FieldMandatoryDescription
tokenPositionnooptional. If present, it represents the position within the query string where the node refers to.
isOptionalnowhether this node could be left out and the result would still be the same query (semantically).

tokenPosition

contains start (inclusive) and end (inclusive), both contain index (0 based; fur substrings), line and column (both 1-based; for readability).

  • If tokenPosition is present, it always contains start and end with all fields
  • If tokenPosition is not present, there might still be nested nodes that do contain a position
  • If start == end, the position refers to a single character
  • If start > end, we know for sure that something was inserted.

We can always check whether the canonical representation of a node matches the text in the tokenPosition to see whether something was inserted, removed, or changed.

isOptional

only present if it is true.

Optional nodes can e.g. be optional braces that make a query more readable, but are not necessary. This could be used to enter ghost braces and implicit functions in the user's input field; maybe with different formatting (using the tokenPosition of sibling nodes we can also check whether the user wrote these or not).

Advanced Token Types

each node is of one of following types and may contain more fields:

  • Terminal Node
  • ContainerNode
  • Alternative Node

Terminal Node

can be identified by checking whether canonicalString is present

FieldMandatoryDescription
typeyesthe type of the terminal node - do not confuse with the type of container nodes
canonicalStringyesthe canonical string representation. Concatenating the canonicalString of all nested terminal nodes provides the canonical form of the query.
isMandatoryOnUserOrdernomay only be present if (type="BRACE_OPEN" or type="BRACE_CLOSE") and isOptional=true. For usage see section Special node type: PARAMETERS
Current types of terminal nodes (list might grow):
  • SPACE
  • LINEBREAK
  • INDENT
  • PIPE
  • DOT
  • COLON
  • COMMA
  • BRACE_OPEN
  • BRACE_CLOSE
  • BRACKET_OPEN
  • BRACKET_CLOSE
  • PARENTHESIS_OPEN
  • PARENTHESIS_CLOSE
  • QUOTE
  • SLASH
  • BOOLEAN_TRUE
  • BOOLEAN_FALSE
  • NULL
  • COMMAND_NAME
  • PARAMETER_KEY
  • PARAMETER_VALUE_SCOPE
  • FUNCTION_NAME
  • OPERATOR
  • TRAVERSAL_OPERATOR
  • TRAVERSAL_RELATION_NAME
  • TRAVERSAL_HOP_COUNT
  • SIMPLE_IDENTIFIER
  • NUMBER
  • STRING
  • TIME_UNIT
  • TIMESTAMP_VALUE
  • METRIC_KEY
  • VARIABLE

ContainerNode

can be identified by checking whether children is present

FieldMandatoryDescription
typeyesthe type of the container node - do not confuse with the type of terminal nodes
childrenyesthe children for the node. might be of any type
Current types of container nodes (list might grow):
  • QUERY
  • EXECUTION_BLOCK
  • COMMAND
  • COMMAND_SEPARATOR
  • PARAMETER_WITH_KEY
  • GROUP
  • PARAMETERS - check examples further down
  • PARAMETER_NAMING
  • PARAMETER_SEPARATOR
  • FUNCTION
  • FUNCTION_PART - check examples further down
  • EXPRESSION
  • IDENTIFIER
  • SOURCE_ID
  • DURATION
  • TIMESTAMP
  • TIMEFRAME
  • TRAVERSAL_PATH
  • TRAVERSAL_STEP
Special node type: PARAMETERS

can contain children representing the parameters. Every second child is of type PARAMETER_SEPARATOR.

You may reorder the children based on their tokenPosition to get the user order. However, in this case, you need to consider isMandatoryOnUserOrder to determine whether the grouping braces are mandatory or not.

Example

For the query SORT a, {direction:"descending", b}, the canonical form is:

SORT a, {b, direction:"descending"}

This is the order, in which the parameters are returned in the query tree. Parameters are {a} and {{b} and {direction:"descending"}}. In this case, the braces are optional.

SORT a, {b, direction:"descending"} is equivalent to SORT a, b, direction:"descending"

However, if you reorder the children by tokenPosition, the braces are not optional, because

SORT a, direction:"descending", b is interpreted as SORT {a, direction:"descending"}, b

So, if the children in PARAMETERS are re-ordered by tokenPosition, braces (or in general: TerminalNodes) are only optional if isOptional && !isMandatoryOnUserOrder.

Special node type: FUNCTION_PART

A container node of type FUNCTION may contain nodes of type FUNCTION_PART.

If those FUNCTION_PARTs are marked as optional, this means you have to either include all or none of these optional function parts.

Example:

filter anyMatch(a.b == 1, input:a)

The optional function parts are anyMatch( and , input:a). If you leave out both, the command will still work: filter a.b == 1 and return the same result. Using one of these optional function parts and removing the other will lead to an invalid query.

Alternative Node

can be identified by checking whether alternatives is present

FieldMandatoryDescription
alternativesyesType: Map&lt;AlternativeType, DQLNode&gt;

When displaying the query, pick one option. You may use the other options for hovering, replacing, and more.

Current values of AlternativeType (list might grow):
  • CANONICAL: This node is the one we will use for our canonical form
  • USER: An alternative that is also valid, but not canonical; and this version was picked by the user.
  • INFO: only if the canonical version is not present

Examples:

  • CANONICAL is not present, USER is present: user's nodes are optional, but not canonical (usually optional nodes are still canonical)
  • CANONICAL is present, USER is not present: same as if the canonical node was optional. If this happens, it is likely that there is also an INFO node
  • CANONICAL is present, USER is present: there are different alternatives
  • INFO is present: usually if CANONICAL is not present (e.g. the parameter key for FILTER a == 1), there is an info node for FILTER condition:a == 1. This condition: was neither written by the user nor is it canonical; but it might be used to help the user understand what this parameter means.

Parameters

NameType
config.body*requiredParseRequest

Returns

Return typeDescription
Promise<DQLNode>A node containing more nodes, a node offering different (semantically equivalent) versions of the query parts, or a terminal node that shows the canonical form.

Throws

Error TypeError Message
ErrorEnvelopeErrorThe supplied request is wrong. Either the query itself or other parameters are wrong. | An internal server error has occurred.

Code example

import { queryAssistanceClient } from "@dynatrace-sdk/client-query";

const data = await queryAssistanceClient.queryParse({
body: {
query:
'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
},
});

queryVerify

queryAssistanceClient.queryVerify(config): Promise<VerifyResponse>

Verifies a query without executing it.

For information about the required permissions see the Bucket and table permissions in Grail documentation.

Overview

Verifies the supplied query string and other query parameters for lack of any errors, but without actually submitting the query for execution.

Parameters

NameType
config.body*requiredVerifyRequest

Returns

Return typeDescription
Promise<VerifyResponse>Supplied query and parameters were verified.

Throws

Error TypeError Message
ErrorEnvelopeErrorThe supplied request is wrong. | An internal server error has occurred.

Code example

import { queryAssistanceClient } from "@dynatrace-sdk/client-query";

const data = await queryAssistanceClient.queryVerify({
body: {
query:
'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
},
});

queryExecutionClient

import { queryExecutionClient } from '@dynatrace-sdk/client-query';

queryCancel

queryExecutionClient.queryCancel(config): Promise<void | QueryPollResponse>

Cancels the query and returns the result if the query was already finished, otherwise discards it.

For information about the required permissions see the Bucket and table permissions in Grail documentation.

Overview:

Cancels a running Grail query and returns a list of records if the query already finished.

The response format:

If the query was already finished, a response body including the result will be returned. Otherwise the response will contain no body.

The result has three main sections:

  • the 'records' section contains the individual records, where each record consists of a set of fields and their corresponding values.
  • the 'types' section describes the corresponding data types that a record field has.
  • the 'metadata' section contains information about the query like 'analysisTimeframe', 'timezone' or 'locale'.

Every record has an implicit 'index' according to the position in the 'records' JSON array. The types section has a list of 1..N possible type 'buckets'. Each such bucket has an 'indexRange' which indicates which records will find their field types in which bucket. The index range has two values start & end and can be thought of as [startIndex, endIndex).

A field part of a record with index 'i' will find its corresponding field type by first locating the bucket that satisfies:

startIndex <= i <= endIndex

Once the bucket is found the 'mappings' object has an entry for all the fields that are part of that record with index 'i'.

Since enforcement of a particular schema is absent at ingestion time, it is possible to have records that share the same field name but their values are of a different type. This phenomenon will hence forth be named as a "collision". When a collision does occur, we will create a new type 'bucket' that will have a different index range where the new record field types will be placed. It is guaranteed that every field of every record will have a corresponding type. Clients should always take the included types into account when consuming records!

Parameters

NameTypeDescription
config.enrichstringIf set additional data will be available in the metadata section.
config.requestToken*requiredstringThe request-token of the query.

Returns

Return typeDescription
Promise<QueryPollResponsevoid>

Throws

Error TypeError Message
ErrorEnvelopeErrorThe supplied request is wrong. Either the query itself or other parameters are wrong. | An internal server error has occurred.

Code example

import { queryExecutionClient } from "@dynatrace-sdk/client-query";

const data = await queryExecutionClient.queryCancel({
requestToken: "...",
});

queryExecute

queryExecutionClient.queryExecute(config): Promise<QueryStartResponse>

Starts a Grail query.

For information about the required permissions see the Bucket and table permissions in Grail documentation.

Overview:

Executes a query and returns a list of records.

For details about the query language see the Dynatrace Query Language documentation.

The response format:

The json response will contain the state of the started query. If the query succeeded, the result will be included. Otherwise the response will contain a request token to reference the query in future polling requests.

The result has two main sections:

  • The 'records' section contains the individual records, where each record consists of a set of fields and their corresponding values.
  • The 'types' section describes the corresponding data types that a record field has.

Every record has an implicit 'index' according to the position in the 'records' JSON array. The types section has a list of 1..N possible type 'buckets'. Each such bucket has an 'indexRange' which indicates which records will find their field types in which bucket. The index range has two values start & end and can be thought of as [startIndex, endIndex).

A field part of a record with index 'i' will find its corresponding field type by first locating the bucket that satisfies:

startIndex <= i <= endIndex

Once the bucket is found the 'mappings' object has an entry for all the fields that are part of that record with index 'i'.

Since enforcement of a particular schema is absent at ingestion time, it is possible to have records that share the same field name but their values are of a different type. This phenomenon will hence forth be named as a "collision". When a collision does occur, we will create a new type 'bucket' that will have a different index range where the new record field types will be placed. It is guaranteed that every field of every record will have a corresponding type. Clients should always take the included types into account when consuming records!

Parameters

NameTypeDescription
config.body*requiredExecuteRequest
config.enrichstringIf set additional data will be available in the metadata section.

Returns

Return typeDescription
Promise<QueryStartResponse>The final status and results of the supplied query if it finished within a supplied requestTimeoutMilliseconds. | The status of the query to start.

Throws

Error TypeError Message
ErrorEnvelopeErrorThe supplied request is wrong. Either the query itself or other parameters are wrong. | Too many requests. | An internal server error has occurred. | Service is unavailable. | Client error. | Server error.
InsufficientPermissionInsufficient permissions.

Code example

import { queryExecutionClient } from "@dynatrace-sdk/client-query";

const data = await queryExecutionClient.queryExecute({
body: {
query:
'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
},
});

queryPoll

queryExecutionClient.queryPoll(config): Promise<QueryPollResponse>

Retrieves query status and final result from Grail.

For information about the required permissions see the Bucket and table permissions in Grail documentation.

Overview:

Polls the status of a Grail query. Returns the status of the query, including the result if the query finished.

The response format:

The json response will contain the state of the query. If the query succeeded, the result will be included.

The result has two main sections:

  • The 'records' section contains the individual records, where each record consists of a set of fields and their corresponding values.
  • The 'types' section describes the corresponding data types that a record field has.

Every record has an implicit 'index' according to the position in the 'records' JSON array. The types section has a list of 1..N possible type 'buckets'. Each such bucket has an 'indexRange' which indicates which records will find their field types in which bucket. The index range has two values start & end and can be thought of as [startIndex, endIndex).

A field part of a record with index 'i' will find its corresponding field type by first locating the bucket that satisfies:

startIndex <= i <= endIndex

Once the bucket is found the 'mappings' object has an entry for all the fields that are part of that record with index 'i'.

Since enforcement of a particular schema is absent at ingestion time, it is possible to have records that share the same field name but their values are of a different type. This phenomenon will hence forth be named as a "collision". When a collision does occur, we will create a new type 'bucket' that will have a different index range where the new record field types will be placed. It is guaranteed that every field of every record will have a corresponding type. Clients should always take the included types into account when consuming records!

Parameters

NameTypeDescription
config.enrichstringIf set additional data will be available in the metadata section.
config.requestTimeoutMillisecondsnumberThe time a client is willing to wait for the query result. In case the query finishes within the specified timeout, the query result is returned. Otherwise, the query status is returned.
config.requestToken*requiredstringThe request-token of the query.

Returns

Return typeDescription
Promise<QueryPollResponse>The current status and results of the supplied query.

Throws

Error TypeError Message
ErrorEnvelopeErrorThe supplied request is wrong. Either the query itself or other parameters are wrong. | An internal server error has occurred.

Code example

import { queryExecutionClient } from "@dynatrace-sdk/client-query";

const data = await queryExecutionClient.queryPoll({
requestToken: "...",
});

Types

AutocompleteRequest

NameTypeDescription
cursorPositionnumber
localestringThe query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'.
maxDataSuggestionsnumber
query*requiredstringThe full query string.
queryOptionsQueryOptionsQuery options enhance query functionality for Dynatrace internal services.
timezonestringThe query timezone. If none is specified, UTC is used as fallback. The list of valid input values matches that of the IANA Time Zone Database (TZDB). It accepts values in their canonical names like 'Europe/Paris', the abbreviated version like CET or the UTC offset format like '+01:00'

AutocompleteResponse

The response of the autocomplete call.

NameTypeDescription
optional*requiredbooleanTrue if the suggestions are optional.
suggestedTtlSecondsnumberSuggested duration in seconds, for how long the response may be cached and reused by the client. It is derived from the volatility of the suggestions on the server (if the suggestions are static, how long the server will cache the volatile suggestions, ...). If not provided, then the result may be cached for long time. Value below 1 means that the result should not be cached.
suggestions*requiredArray<AutocompleteSuggestion>The list of suggestions.

AutocompleteSuggestion

Single suggestion for completion of the query.

NameTypeDescription
alreadyTypedCharacters*requirednumberNumber of characters that the user already typed for this suggestion.
parts*requiredArray<AutocompleteSuggestionPart>List of suggestion parts.
suggestion*requiredstringThe suggested continuation of the query.

AutocompleteSuggestionPart

Part of the suggestion.

NameTypeDescription
infostringThe type of the suggestion.
suggestion*requiredstringThe suggested continuation of the query.
synopsisstringThe synopsis of the suggestion.
type*required"SPACE" | "LINEBREAK" | "INDENT" | "PIPE" | "DOT" | "COLON" | "COMMA" | "ASSIGNMENT" | "BRACE_OPEN" | "BRACE_CLOSE" | "BRACKET_OPEN" | "BRACKET_CLOSE" | "PARENTHESIS_OPEN" | "PARENTHESIS_CLOSE" | "QUOTE" | "SINGLE_QUOTE" | "SLASH" | "BOOLEAN_TRUE" | "BOOLEAN_FALSE" | "NULL" | "COMMAND_NAME" | "PARAMETER_KEY" | "PARAMETER_VALUE_SCOPE" | "FUNCTION_NAME" | "TIMESERIES_AGGREGATION" | "TIMESERIES_AGGREGATION_EXPRESSION" | "OPERATOR" | "TRAVERSAL_OPERATOR" | "TRAVERSAL_RELATION_NAME" | "TRAVERSAL_HOP_COUNT" | "SIMPLE_IDENTIFIER" | "DATA_OBJECT" | "NUMBER" | "STRING" | "TIME_UNIT" | "TIMESTAMP_VALUE" | "METRIC_KEY" | "VARIABLE" | "END_COMMENT" | "UID_VALUE" | "PARSE_PATTERN" | "FIELD_PATTERN" | "ENTITY_SELECTOR_PART" | "FIELD_MODIFIER" | "ENTITY_TYPE" | "ENTITY_ATTRIBUTE" | "SMARTSCAPE_ID_VALUE"The type of the autocomplete token.

DQLAlternativeNode

The DQL node that has alternatives.

NameTypeDescription
alternativesobjectThe different alternatives.
isOptional*requiredbooleanTrue if the node is optional.
nodeType*required"TERMINAL" | "CONTAINER" | "ALTERNATIVE"The type of the node.
tokenPositionTokenPositionThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.

DQLContainerNode

The DQL node that contains other nodes.

NameTypeDescription
childrenArray<DQLNode>The list of children nodes.
isOptional*requiredbooleanTrue if the node is optional.
nodeType*required"TERMINAL" | "CONTAINER" | "ALTERNATIVE"The type of the node.
tokenPositionTokenPositionThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.
type"QUERY" | "EXECUTION_BLOCK" | "COMMAND" | "COMMAND_SEPARATOR" | "PARAMETER_WITH_KEY" | "GROUP" | "PARAMETERS" | "PARAMETER_NAMING" | "PARAMETER_ASSIGNMENT" | "PARAMETER_SEPARATOR" | "FUNCTION" | "FUNCTION_PART" | "EXPRESSION" | "IDENTIFIER" | "SOURCE_ID" | "DURATION" | "TIMESTAMP" | "TIMEFRAME" | "TRAVERSAL_PATH" | "TRAVERSAL_STEP"The type of the node.

DQLNode

General Node in the DQL query.

NameTypeDescription
isOptional*requiredbooleanTrue if the node is optional.
nodeType*required"TERMINAL" | "CONTAINER" | "ALTERNATIVE"The type of the node.
tokenPositionTokenPositionThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.

DQLTerminalNode

Node that represents single token.

NameTypeDescription
canonicalStringstringCanonical form.
isMandatoryOnUserOrderbooleanFor optional items only: whether this node becomes mandatory when user order is used. True only for some optional 'ghost braces'
isOptional*requiredbooleanTrue if the node is optional.
nodeType*required"TERMINAL" | "CONTAINER" | "ALTERNATIVE"The type of the node.
tokenPositionTokenPositionThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.
type"SPACE" | "LINEBREAK" | "INDENT" | "PIPE" | "DOT" | "COLON" | "COMMA" | "ASSIGNMENT" | "BRACE_OPEN" | "BRACE_CLOSE" | "BRACKET_OPEN" | "BRACKET_CLOSE" | "PARENTHESIS_OPEN" | "PARENTHESIS_CLOSE" | "QUOTE" | "SINGLE_QUOTE" | "SLASH" | "BOOLEAN_TRUE" | "BOOLEAN_FALSE" | "NULL" | "COMMAND_NAME" | "PARAMETER_KEY" | "PARAMETER_VALUE_SCOPE" | "FUNCTION_NAME" | "TIMESERIES_AGGREGATION" | "TIMESERIES_AGGREGATION_EXPRESSION" | "OPERATOR" | "TRAVERSAL_OPERATOR" | "TRAVERSAL_RELATION_NAME" | "TRAVERSAL_HOP_COUNT" | "SIMPLE_IDENTIFIER" | "DATA_OBJECT" | "NUMBER" | "STRING" | "TIME_UNIT" | "TIMESTAMP_VALUE" | "METRIC_KEY" | "VARIABLE" | "END_COMMENT" | "UID_VALUE" | "PARSE_PATTERN" | "FIELD_PATTERN" | "ENTITY_SELECTOR_PART" | "FIELD_MODIFIER" | "ENTITY_TYPE" | "ENTITY_ATTRIBUTE" | "SMARTSCAPE_ID_VALUE"The type of the autocomplete token.

ErrorEnvelope

An 'envelope' error object that has the mandatory error object.

NameTypeDescription
error*requiredErrorResponseThe response for error state

ErrorResponse

The response for error state

NameTypeDescription
code*requirednumberError code, which normally matches the HTTP error code.
detailsErrorResponseDetailsDetailed information about the error.
message*requiredstringA short, clear error message without details

ErrorResponseDetails

Detailed information about the error.

NameTypeDescription
argumentsArray<string>The arguments for the message format.
constraintViolationsArray<ErrorResponseDetailsConstraintViolationsItem>Information about an input parameter that violated some validation rule of the service API.
errorMessagestringComplete error message.
errorMessageFormatstringThe message format of the error message, string.format based.
errorMessageFormatSpecifierTypesArray<string>The corresponding DQL format specifier types for each format specifier used in the error message format.
errorTypestringThe error type, e.g. COMMAND_NAME_MISSING
exceptionTypestringThe exception type.
missingPermissionsArray<string>List of missing IAM permissions necessary to successfully execute the request.
missingScopesArray<string>List of missing IAM scopes necessary to successfully execute the request.
queryIdstring
queryStringstringSubmitted query string.
syntaxErrorPositionTokenPositionThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.

ErrorResponseDetailsConstraintViolationsItem

NameTypeDescription
message*requiredstringMessage describing the error.
parameterDescriptorstringDescribes the violating parameter.
parameterLocationstringDescribes the general location of the violating parameter.

ExecuteRequest

NameTypeDescription
defaultSamplingRationumberIn case not specified in the DQL string, the sampling ratio defined here is applied. Note that this is only applicable to log queries.
defaultScanLimitGbytesnumberLimit in gigabytes for the amount data that will be scanned during read.
defaultTimeframeEndstringThe query timeframe 'end' timestamp in ISO-8601 or RFC3339 format. If the timeframe 'start' parameter is missing, the whole timeframe is ignored. Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.
defaultTimeframeStartstringThe query timeframe 'start' timestamp in ISO-8601 or RFC3339 format. If the timeframe 'end' parameter is missing, the whole timeframe is ignored. Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.
enablePreviewbooleanRequest preview results. If a preview is available within the requestTimeoutMilliseconds, then it will be returned as part of the response.
fetchTimeoutSecondsnumberThe query will stop reading data after reaching the fetch-timeout. The query execution will continue, providing a partial result based on the read data.
filterSegmentsFilterSegmentsRepresents a collection of filter segments.
localestringThe query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'.
maxResultBytesnumberThe maximum number of result bytes that this query will return.
maxResultRecordsnumberThe maximum number of result records that this query will return.
query*requiredstringThe full query string.
queryOptionsQueryOptionsQuery options enhance query functionality for Dynatrace internal services.
requestTimeoutMillisecondsnumberThe time a client is willing to wait for the query result. In case the query finishes within the specified timeout, the query result is returned. Otherwise, the requestToken is returned, allowing polling for the result.
timezonestringThe query timezone. If none is specified, UTC is used as fallback. The list of valid input values matches that of the IANA Time Zone Database (TZDB). It accepts values in their canonical names like 'Europe/Paris', the abbreviated version like CET or the UTC offset format like '+01:00'

FieldType

The possible type of a field in DQL.

NameType
type*required"string" | "boolean" | "undefined" | "binary" | "double" | "long" | "timestamp" | "timeframe" | "duration" | "ip_address" | "geo_point" | "array" | "record" | "uid" | "smartscape_id"
typesArray<RangedFieldTypes>

FilterSegment

A filter segment is identified by an ID. Each segment includes a list of variable definitions.

NameType
id*requiredstring
variablesArray<FilterSegmentVariableDefinition>

FilterSegmentVariableDefinition

Defines a variable with a name and a list of values.

NameType
name*requiredstring
values*requiredArray<string>

FilterSegments

Represents a collection of filter segments.

type: Array<FilterSegment>

GeoPoint

DQL data type representing a geolocation point.

NameTypeDescription
latitude*requirednumberThe coordinate that specifies the north-south position of a point on the surface of the earth.
longitude*requirednumberThe coordinate that specifies the east-west position of a point on the surface of the earth.

GrailMetadata

Collects various bits of metadata information.

NameTypeDescription
analysisTimeframeTimeframeDQL data type timeframe.
canonicalQuerystringThe canonical form of the query. It has normalized spaces and canonical constructs.
dqlVersionstringThe version of DQL that was used to process the query request.
executionTimeMillisecondsnumberThe time it took to execute the query.
localestringEffective locale for the query.
notificationsArray<MetadataNotification>Collected messages during the execution of the query.
querystringThe submitted query.
queryIdstringThe id of the query
sampledbooleanTrue if sampling was used for at least one segment.
scannedBytesnumberNumber of scanned bytes during the query execution.
scannedDataPointsnumber
scannedRecordsnumberNumber of scanned records during the query execution.
timezonestringEffective timezone for the query.

Metadata

Collects various bits of metadata information.

NameTypeDescription
grailGrailMetadataCollects various bits of metadata information.
metricsArray<MetricMetadata>

MetadataNotification

The message that provides additional information about the execution of the query.

NameTypeDescription
argumentsArray<string>The arguments for the message format.
messagestringThe complete message of the notification.
messageFormatstringThe message format of the notification, string.format based
messageFormatSpecifierTypesArray<string>The corresponding DQL format specifier types for each format specifier used in the error message format.
notificationTypestringThe notification type, e.g. LIMIT_ADDED.
severitystringThe severity of the notification, currently: INFO, WARN, ERROR.
syntaxPositionTokenPositionThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.

MetricMetadata

An object that defines additional metric metadata.

NameTypeDescription
descriptionstringThe description of the metadata.
displayNamestringThe display name of the metadata.
fieldNamestringThe name of the associated field used in the query.
metric.keystringThe metric key.
ratestringThe specified rate normalization parameter.
rollupstringMetadata about the rollup type.
shiftedbooleanIndicates if the shifted parameter was used.
unitstringThe unit used.

ParseRequest

NameTypeDescription
localestringThe query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'.
query*requiredstringThe full query string.
queryOptionsQueryOptionsQuery options enhance query functionality for Dynatrace internal services.
timezonestringThe query timezone. If none is specified, UTC is used as fallback. The list of valid input values matches that of the IANA Time Zone Database (TZDB). It accepts values in their canonical names like 'Europe/Paris', the abbreviated version like CET or the UTC offset format like '+01:00'

PositionInfo

The exact position in the query string.

NameTypeDescription
column*requirednumberQuery position column zero based index.
index*requirednumberQuery position index.
line*requirednumberQuery position line zero based index.

QueryOptions

Query options enhance query functionality for Dynatrace internal services.

type: Record<string, string | undefined>

QueryPollResponse

The response of GET query:execute call.

NameTypeDescription
progressnumberThe progress of the query from 0 to 100.
resultQueryResultThe result of the DQL query.
state*required"NOT_STARTED" | "RUNNING" | "SUCCEEDED" | "RESULT_GONE" | "CANCELLED" | "FAILED"Possible state of the query.
ttlSecondsnumberTime to live in seconds.

QueryResult

The result of the DQL query.

NameTypeDescription
metadata*requiredMetadataCollects various bits of metadata information.
records*requiredArray<null | ResultRecord>List of records containing the result fields data.
types*requiredArray<RangedFieldTypes>The data types for the result records.

QueryStartResponse

The response when starting a query.

NameTypeDescription
progressnumberThe progress of the query from 0 to 100.
requestTokenstringThe token returned by the POST query:execute call.
resultQueryResultThe result of the DQL query.
state*required"NOT_STARTED" | "RUNNING" | "SUCCEEDED" | "RESULT_GONE" | "CANCELLED" | "FAILED"Possible state of the query.
ttlSecondsnumberTime to live in seconds.

RangedFieldTypes

The field type in range.

NameTypeDescription
indexRangeArray<number>The range of elements at use this type in arrays (null for records).
mappings*requiredRangedFieldTypesMappingsThe mapping between the field name and data type.

RangedFieldTypesMappings

The mapping between the field name and data type.

type: Record<string, FieldType | undefined>

ResultRecord

Single record that contains the result fields.

type: Record<string, ResultRecordValue | null | undefined>

Timeframe

DQL data type timeframe.

NameTypeDescription
endDateThe end time of the timeframe.
startDateThe start time of the timeframe.

TokenPosition

The position of a token in a query string used for errors and notification to map the message to a specific part of the query.

NameTypeDescription
end*requiredPositionInfoThe exact position in the query string.
start*requiredPositionInfoThe exact position in the query string.

VerifyRequest

NameTypeDescription
generateCanonicalQuerybooleandefault: false
localestringThe query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'.
query*requiredstringThe full query string.
queryOptionsQueryOptionsQuery options enhance query functionality for Dynatrace internal services.
timezonestringThe query timezone. If none is specified, UTC is used as fallback. The list of valid input values matches that of the IANA Time Zone Database (TZDB). It accepts values in their canonical names like 'Europe/Paris', the abbreviated version like CET or the UTC offset format like '+01:00'

VerifyResponse

Verify response.

NameTypeDescription
canonicalQuerystring
notificationsArray<MetadataNotification>The notifications related to the supplied DQL query string.
valid*requiredbooleanTrue if the supplied DQL query string is valid.

Enums

DQLNodeNodeType

The type of the node.

Enum keys

Alternative | Container | Terminal

FieldTypeType

Enum keys

Array | Binary | Boolean | Double | Duration | GeoPoint | IpAddress | Long | Record | SmartscapeId | String | Timeframe | Timestamp | Uid | Undefined

QueryState

Possible state of the query.

Enum keys

Cancelled | Failed | NotStarted | ResultGone | Running | Succeeded

TokenType

The type of the autocomplete token.

Enum keys

Assignment | BooleanFalse | BooleanTrue | BraceClose | BraceOpen | BracketClose | BracketOpen | Colon | Comma | CommandName | DataObject | Dot | EndComment | EntityAttribute | EntitySelectorPart | EntityType | FieldModifier | FieldPattern | FunctionName | Indent | Linebreak | MetricKey | Null | Number | Operator | ParameterKey | ParameterValueScope | ParenthesisClose | ParenthesisOpen | ParsePattern | Pipe | Quote | SimpleIdentifier | SingleQuote | Slash | SmartscapeIdValue | Space | String | TimeUnit | TimeseriesAggregation | TimeseriesAggregationExpression | TimestampValue | TraversalHopCount | TraversalOperator | TraversalRelationName | UidValue | Variable

Still have questions?
Find answers in the Dynatrace Community