@dynatrace-sdk/client-query 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +50 -46
- package/cjs/index.js +441 -2
- package/docs/DOCS.md +7 -7
- package/esm/index.js +441 -2
- package/package.json +1 -1
- package/types/packages/client/query/src/lib/models/dql-node-node-type.transformation.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/field-type-type.transformation.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/query-state.transformation.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/result-record-value.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/result-record-value.transformation.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/token-type.transformation.d.ts +1 -1
- package/types/packages/client/query/src/lib/utils/url-helpers.d.ts +1 -1
- package/types/packages/http-client/src/lib/platform/abort-controller.d.ts +1 -1
- package/types/packages/http-client/src/lib/platform/abort-signal.d.ts +1 -1
- package/types/packages/http-client/src/lib/platform/decode-form-data.d.ts +48 -0
- package/types/packages/http-client/src/lib/platform/http-client.d.ts +8 -0
- package/types/packages/http-client/src/lib/types/data-types.d.ts +1 -1
- package/types/packages/http-client/src/lib/types/form-data-request-body.d.ts +2 -2
- package/types/packages/http-client/src/lib/types/form-data-response-body.d.ts +2 -2
- package/types/packages/http-client/src/lib/types/request-body-types.d.ts +1 -1
- package/types/packages/http-client/src/lib/types/response-body-types.d.ts +1 -1
- package/types/packages/platform/error-handlers/src/lib/types/global-dt-runtime-with-error-handlers.d.ts +1 -1
- package/types/packages/platform/error-handlers/src/lib/types/global-error-serializer.d.ts +1 -1
- package/types/packages/platform/error-handlers/src/lib/types/serialized-error.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -1636,10 +1636,37 @@ function toJson20($model) {
|
|
|
1636
1636
|
// packages/client/query/src/lib/apis/query-assistance-api.ts
|
|
1637
1637
|
var QueryAssistanceClient = class {
|
|
1638
1638
|
httpClient;
|
|
1639
|
+
/**
|
|
1640
|
+
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryAssistanceClient. Custom http client should implement {HttpClient} interface.
|
|
1641
|
+
* @example
|
|
1642
|
+
* const queryAssistanceClientNodeJs = new QueryAssistanceClient(yourCustomImplementation);
|
|
1643
|
+
*/
|
|
1639
1644
|
constructor(httpClientImplementation) {
|
|
1640
1645
|
this.httpClient = httpClientImplementation;
|
|
1641
1646
|
registerGlobalErrorSerializer(apiClientErrorSerializer);
|
|
1642
1647
|
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Verifies a query without executing it.
|
|
1650
|
+
*
|
|
1651
|
+
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
|
|
1652
|
+
*
|
|
1653
|
+
* ## Overview
|
|
1654
|
+
*
|
|
1655
|
+
* Verifies the supplied query string and other query parameters for lack of any errors, but without actually
|
|
1656
|
+
* submitting the query for execution.
|
|
1657
|
+
*
|
|
1658
|
+
* @returns Supplied query and parameters were verified.
|
|
1659
|
+
*
|
|
1660
|
+
* @example <caption>Code example</caption>
|
|
1661
|
+
* import { queryAssistanceClient } from "@dynatrace-sdk/client-query";
|
|
1662
|
+
*
|
|
1663
|
+
* const data = await queryAssistanceClient.queryVerify({
|
|
1664
|
+
* body: {
|
|
1665
|
+
* query:
|
|
1666
|
+
* 'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
|
|
1667
|
+
* },
|
|
1668
|
+
* });
|
|
1669
|
+
*/
|
|
1643
1670
|
async queryVerify(config) {
|
|
1644
1671
|
if (!config) {
|
|
1645
1672
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
@@ -1742,6 +1769,213 @@ var QueryAssistanceClient = class {
|
|
|
1742
1769
|
}
|
|
1743
1770
|
}
|
|
1744
1771
|
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Get a structured tree of the canonical form of the query.
|
|
1774
|
+
*
|
|
1775
|
+
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
|
|
1776
|
+
*
|
|
1777
|
+
* ## Overview
|
|
1778
|
+
*
|
|
1779
|
+
* Returns the parsed query as a tree, containing the structure of the canonical query. Tree-nodes can contain references to
|
|
1780
|
+
* the token position where they originate from. This may help to provide hover effects, show canonical forms, mark
|
|
1781
|
+
* optional items, and more.
|
|
1782
|
+
*
|
|
1783
|
+
* ## Details
|
|
1784
|
+
*
|
|
1785
|
+
* The query tree consists of nodes that contain different additional information (everything optional):
|
|
1786
|
+
*
|
|
1787
|
+
* ### General Fields
|
|
1788
|
+
*
|
|
1789
|
+
* Field | Mandatory | Description
|
|
1790
|
+
* ----------------------- | --- | ----------------------------------------------------------------------------------------
|
|
1791
|
+
* tokenPosition | no | optional. If present, it represents the position within the query string where the node refers to.
|
|
1792
|
+
* isOptional | no | whether this node could be left out and the result would still be the same query (semantically).
|
|
1793
|
+
*
|
|
1794
|
+
* #### tokenPosition
|
|
1795
|
+
*
|
|
1796
|
+
* contains `start` (inclusive) and `end` (inclusive), both contain `index` (0 based; fur substrings), `line`
|
|
1797
|
+
* and `column` (both 1-based; for readability).
|
|
1798
|
+
*
|
|
1799
|
+
* * If `tokenPosition` is present, it always contains start and end with all fields
|
|
1800
|
+
* * If `tokenPosition` is not present, there might still be nested nodes that do contain a position
|
|
1801
|
+
* * If `start == end`, the position refers to a single character
|
|
1802
|
+
* * If `start > end`, we know for sure that something was inserted.
|
|
1803
|
+
*
|
|
1804
|
+
* We can always check whether the canonical representation of a node matches the text in the tokenPosition to see whether
|
|
1805
|
+
* something was inserted, removed, or changed.
|
|
1806
|
+
*
|
|
1807
|
+
* #### isOptional
|
|
1808
|
+
*
|
|
1809
|
+
* only present if it is true.
|
|
1810
|
+
*
|
|
1811
|
+
* Optional nodes can e.g. be optional braces that make a query more readable, but are not necessary. This could be used to
|
|
1812
|
+
* enter *ghost braces* and *implicit functions* in the user's input field; maybe with different formatting
|
|
1813
|
+
* (using the tokenPosition of sibling nodes we can also check whether the user wrote these or not).
|
|
1814
|
+
*
|
|
1815
|
+
* ### Advanced Token Types
|
|
1816
|
+
*
|
|
1817
|
+
* each node is of one of following types and may contain more fields:
|
|
1818
|
+
*
|
|
1819
|
+
* * Terminal Node
|
|
1820
|
+
* * ContainerNode
|
|
1821
|
+
* * Alternative Node
|
|
1822
|
+
*
|
|
1823
|
+
* #### Terminal Node
|
|
1824
|
+
*
|
|
1825
|
+
* can be identified by checking whether `canonicalString` is present
|
|
1826
|
+
*
|
|
1827
|
+
* Field | Mandatory | Description
|
|
1828
|
+
* ------------------------ | --- | ---------------------------------------------------------------------------------------
|
|
1829
|
+
* type | yes | the type of the terminal node - do not confuse with the type of container nodes
|
|
1830
|
+
* canonicalString | yes | the canonical string representation. Concatenating the canonicalString of all nested terminal nodes provides the canonical form of the query.
|
|
1831
|
+
* isMandatoryOnUserOrder | no | may only be present if (`type="BRACE_OPEN"` or `type="BRACE_CLOSE"`) and `isOptional=true`. For usage see section [Special node type: PARAMETERS](#special-node-type-parameters)
|
|
1832
|
+
*
|
|
1833
|
+
* ##### Current types of terminal nodes (list might grow):
|
|
1834
|
+
*
|
|
1835
|
+
* * SPACE
|
|
1836
|
+
* * LINEBREAK
|
|
1837
|
+
* * INDENT
|
|
1838
|
+
* * PIPE
|
|
1839
|
+
* * DOT
|
|
1840
|
+
* * COLON
|
|
1841
|
+
* * COMMA
|
|
1842
|
+
* * BRACE_OPEN
|
|
1843
|
+
* * BRACE_CLOSE
|
|
1844
|
+
* * BRACKET_OPEN
|
|
1845
|
+
* * BRACKET_CLOSE
|
|
1846
|
+
* * PARENTHESIS_OPEN
|
|
1847
|
+
* * PARENTHESIS_CLOSE
|
|
1848
|
+
* * QUOTE
|
|
1849
|
+
* * SLASH
|
|
1850
|
+
* * BOOLEAN_TRUE
|
|
1851
|
+
* * BOOLEAN_FALSE
|
|
1852
|
+
* * NULL
|
|
1853
|
+
* * COMMAND_NAME
|
|
1854
|
+
* * PARAMETER_KEY
|
|
1855
|
+
* * PARAMETER_VALUE_SCOPE
|
|
1856
|
+
* * FUNCTION_NAME
|
|
1857
|
+
* * OPERATOR
|
|
1858
|
+
* * TRAVERSAL_OPERATOR
|
|
1859
|
+
* * TRAVERSAL_RELATION_NAME
|
|
1860
|
+
* * TRAVERSAL_HOP_COUNT
|
|
1861
|
+
* * SIMPLE_IDENTIFIER
|
|
1862
|
+
* * NUMBER
|
|
1863
|
+
* * STRING
|
|
1864
|
+
* * TIME_UNIT
|
|
1865
|
+
* * TIMESTAMP_VALUE
|
|
1866
|
+
* * METRIC_KEY
|
|
1867
|
+
* * VARIABLE
|
|
1868
|
+
*
|
|
1869
|
+
* #### ContainerNode
|
|
1870
|
+
*
|
|
1871
|
+
* can be identified by checking whether `children` is present
|
|
1872
|
+
*
|
|
1873
|
+
* Field | Mandatory | Description
|
|
1874
|
+
* ----------------------- | --- | ----------------------------------------------------------------------------------------
|
|
1875
|
+
* type | yes | the type of the container node - do not confuse with the type of terminal nodes
|
|
1876
|
+
* children | yes | the children for the node. might be of any type
|
|
1877
|
+
*
|
|
1878
|
+
* ##### Current types of container nodes (list might grow):
|
|
1879
|
+
*
|
|
1880
|
+
* * QUERY
|
|
1881
|
+
* * EXECUTION_BLOCK
|
|
1882
|
+
* * COMMAND
|
|
1883
|
+
* * COMMAND_SEPARATOR
|
|
1884
|
+
* * PARAMETER_WITH_KEY
|
|
1885
|
+
* * GROUP
|
|
1886
|
+
* * PARAMETERS - check examples further down
|
|
1887
|
+
* * PARAMETER_NAMING
|
|
1888
|
+
* * PARAMETER_SEPARATOR
|
|
1889
|
+
* * FUNCTION
|
|
1890
|
+
* * FUNCTION_PART - check examples further down
|
|
1891
|
+
* * EXPRESSION
|
|
1892
|
+
* * IDENTIFIER
|
|
1893
|
+
* * SOURCE_ID
|
|
1894
|
+
* * DURATION
|
|
1895
|
+
* * TIMESTAMP
|
|
1896
|
+
* * TIMEFRAME
|
|
1897
|
+
* * TRAVERSAL_PATH
|
|
1898
|
+
* * TRAVERSAL_STEP
|
|
1899
|
+
*
|
|
1900
|
+
* ##### Special node type: PARAMETERS
|
|
1901
|
+
*
|
|
1902
|
+
* can contain children representing the parameters. Every second child is of type PARAMETER_SEPARATOR.
|
|
1903
|
+
*
|
|
1904
|
+
* You may reorder the children based on their tokenPosition to get the user order. However, in this case,
|
|
1905
|
+
* you need to consider `isMandatoryOnUserOrder` to determine whether the grouping braces are mandatory or not.
|
|
1906
|
+
*
|
|
1907
|
+
* ###### Example
|
|
1908
|
+
*
|
|
1909
|
+
* For the query `SORT a, {direction:"descending", b}`, the canonical form is:
|
|
1910
|
+
*
|
|
1911
|
+
* `SORT a, {b, direction:"descending"}`
|
|
1912
|
+
*
|
|
1913
|
+
* This is the order, in which the parameters are returned in the query tree.
|
|
1914
|
+
* Parameters are {a} and {{b} and {direction:"descending"}}. In this case, the braces are optional.
|
|
1915
|
+
*
|
|
1916
|
+
* `SORT a, {b, direction:"descending"}` is equivalent to `SORT a, b, direction:"descending"`
|
|
1917
|
+
*
|
|
1918
|
+
* However, if you reorder the children by tokenPosition, the braces are not optional, because
|
|
1919
|
+
*
|
|
1920
|
+
* `SORT a, direction:"descending", b` is interpreted as `SORT {a, direction:"descending"}, b`
|
|
1921
|
+
*
|
|
1922
|
+
* So, if the children in PARAMETERS are re-ordered by tokenPosition, braces (or in general: TerminalNodes)
|
|
1923
|
+
* are only optional if `isOptional && !isMandatoryOnUserOrder`.
|
|
1924
|
+
*
|
|
1925
|
+
* ##### Special node type: FUNCTION_PART
|
|
1926
|
+
*
|
|
1927
|
+
* A container node of type `FUNCTION` may contain nodes of type `FUNCTION_PART`.
|
|
1928
|
+
*
|
|
1929
|
+
* If those `FUNCTION_PART`s are marked as optional, this means you have to either include *all* or *none* of these
|
|
1930
|
+
* optional function parts.
|
|
1931
|
+
*
|
|
1932
|
+
* *Example*:
|
|
1933
|
+
*
|
|
1934
|
+
* `filter anyMatch(a.b == 1, input:a)`
|
|
1935
|
+
*
|
|
1936
|
+
* The optional function parts are `anyMatch(` and `, input:a)`. If you leave out both, the command will still work:
|
|
1937
|
+
* `filter a.b == 1` and return the same result. Using one of these optional function parts and removing the other will lead
|
|
1938
|
+
* to an invalid query.
|
|
1939
|
+
*
|
|
1940
|
+
* #### Alternative Node
|
|
1941
|
+
*
|
|
1942
|
+
* can be identified by checking whether `alternatives` is present
|
|
1943
|
+
*
|
|
1944
|
+
* Field | Mandatory | Description
|
|
1945
|
+
* ----------------------- | --- | ----------------------------------------------------------------------------------------
|
|
1946
|
+
* alternatives | yes | Type: Map<AlternativeType, DQLNode>
|
|
1947
|
+
*
|
|
1948
|
+
* When displaying the query, pick one option. You may use the other options for hovering, replacing, and more.
|
|
1949
|
+
*
|
|
1950
|
+
* ##### Current values of AlternativeType (list might grow):
|
|
1951
|
+
*
|
|
1952
|
+
* * CANONICAL: This node is the one we will use for our canonical form
|
|
1953
|
+
* * USER: An alternative that is also valid, but not canonical; and this version was picked by the user.
|
|
1954
|
+
* * INFO: only if the canonical version is not present
|
|
1955
|
+
*
|
|
1956
|
+
* *Examples*:
|
|
1957
|
+
*
|
|
1958
|
+
* * `CANONICAL` is not present, `USER` is present: user's nodes are optional, but not canonical (usually optional nodes
|
|
1959
|
+
* are still canonical)
|
|
1960
|
+
* * `CANONICAL` is present, `USER` is not present: same as if the canonical node was optional. If this happens, it is
|
|
1961
|
+
* likely that there is also an `INFO` node
|
|
1962
|
+
* * `CANONICAL` is present, `USER` is present: there are different alternatives
|
|
1963
|
+
* * `INFO` is present: usually if `CANONICAL` is not present (e.g. the parameter key for `FILTER a == 1`), there is an info node
|
|
1964
|
+
* for `FILTER condition:a == 1`. This `condition:` was neither written by the user nor is it canonical; but it might be
|
|
1965
|
+
* used to help the user understand what this parameter means.
|
|
1966
|
+
*
|
|
1967
|
+
* @returns 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.
|
|
1968
|
+
*
|
|
1969
|
+
* @example <caption>Code example</caption>
|
|
1970
|
+
* import { queryAssistanceClient } from "@dynatrace-sdk/client-query";
|
|
1971
|
+
*
|
|
1972
|
+
* const data = await queryAssistanceClient.queryParse({
|
|
1973
|
+
* body: {
|
|
1974
|
+
* query:
|
|
1975
|
+
* 'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
|
|
1976
|
+
* },
|
|
1977
|
+
* });
|
|
1978
|
+
*/
|
|
1745
1979
|
async queryParse(config) {
|
|
1746
1980
|
if (!config) {
|
|
1747
1981
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
@@ -1847,6 +2081,57 @@ var QueryAssistanceClient = class {
|
|
|
1847
2081
|
}
|
|
1848
2082
|
}
|
|
1849
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Get a structured list of suggestions for the query at the given position.
|
|
2086
|
+
*
|
|
2087
|
+
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
|
|
2088
|
+
*
|
|
2089
|
+
* ## Overview
|
|
2090
|
+
*
|
|
2091
|
+
* We provide a list of suggestions that may be used after the cursor position. The following queries will all provide the
|
|
2092
|
+
* same results:
|
|
2093
|
+
*
|
|
2094
|
+
* * `query: "f"`
|
|
2095
|
+
* * `query: "f", cursorPosition:1`
|
|
2096
|
+
* * `query: "fetch ", cursorPosition:1`
|
|
2097
|
+
*
|
|
2098
|
+
* Available fields:
|
|
2099
|
+
*
|
|
2100
|
+
* | Field | Description |
|
|
2101
|
+
* |-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
2102
|
+
* | suggestions | a list of suggestions. Each item is a separate possible suggestion, despite they might have the same outputs. |
|
|
2103
|
+
* | optional | whether 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. |
|
|
2104
|
+
*
|
|
2105
|
+
* Fields in the `suggestions`
|
|
2106
|
+
*
|
|
2107
|
+
* | Field | Description |
|
|
2108
|
+
* |------------------------|------------------------------------------------------------------------------------------------------------|
|
|
2109
|
+
* | suggestion | a string representing the whole suggestion. This information could also be derived from the parts. |
|
|
2110
|
+
* | alreadyTypedCharacters | how many characters of this suggestion have already been typed (and will be overridden by the suggestion). |
|
|
2111
|
+
* | parts | a list of semantically enriched information on what are the parts of a suggestion. |
|
|
2112
|
+
*
|
|
2113
|
+
* Fields in `parts`
|
|
2114
|
+
*
|
|
2115
|
+
* | Field | Description |
|
|
2116
|
+
* |------------|-----------------------------------------------------------|
|
|
2117
|
+
* | suggestion | a string representing the current part of the suggestion. |
|
|
2118
|
+
* | type | current types: SPACE, PIPE, COMMAND (may be extended) |
|
|
2119
|
+
*
|
|
2120
|
+
* The `type` helps to treat specific parts of the suggestion different to others; either by a different visualization,
|
|
2121
|
+
* a link to docs, etc.
|
|
2122
|
+
*
|
|
2123
|
+
* @returns A list of structured autocomplete suggestions.
|
|
2124
|
+
*
|
|
2125
|
+
* @example <caption>Code example</caption>
|
|
2126
|
+
* import { queryAssistanceClient } from "@dynatrace-sdk/client-query";
|
|
2127
|
+
*
|
|
2128
|
+
* const data = await queryAssistanceClient.queryAutocomplete({
|
|
2129
|
+
* body: {
|
|
2130
|
+
* query:
|
|
2131
|
+
* 'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
|
|
2132
|
+
* },
|
|
2133
|
+
* });
|
|
2134
|
+
*/
|
|
1850
2135
|
async queryAutocomplete(config) {
|
|
1851
2136
|
if (!config) {
|
|
1852
2137
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
@@ -3288,10 +3573,60 @@ var toQueryString = (rawQuery, flags = {}) => {
|
|
|
3288
3573
|
// packages/client/query/src/lib/apis/query-execution-api.ts
|
|
3289
3574
|
var QueryExecutionClient = class {
|
|
3290
3575
|
httpClient;
|
|
3576
|
+
/**
|
|
3577
|
+
* @param {HttpClient} httpClientImplementation - You can provide custom http client as a parameter to constructor of a QueryExecutionClient. Custom http client should implement {HttpClient} interface.
|
|
3578
|
+
* @example
|
|
3579
|
+
* const queryExecutionClientNodeJs = new QueryExecutionClient(yourCustomImplementation);
|
|
3580
|
+
*/
|
|
3291
3581
|
constructor(httpClientImplementation) {
|
|
3292
3582
|
this.httpClient = httpClientImplementation;
|
|
3293
3583
|
registerGlobalErrorSerializer(apiClientErrorSerializer);
|
|
3294
3584
|
}
|
|
3585
|
+
/**
|
|
3586
|
+
* Retrieves query status and final result from Grail.
|
|
3587
|
+
*
|
|
3588
|
+
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
|
|
3589
|
+
*
|
|
3590
|
+
* ### Overview:
|
|
3591
|
+
*
|
|
3592
|
+
* Polls the status of a Grail query. Returns the status of the query, including the result if the query finished.
|
|
3593
|
+
*
|
|
3594
|
+
* ### The response format:
|
|
3595
|
+
* The json response will contain the state of the query. If the query succeeded, the result will be included.
|
|
3596
|
+
*
|
|
3597
|
+
* The result has two main sections:
|
|
3598
|
+
* * The 'records' section contains the individual records, where each record consists of a set of fields and their corresponding values.
|
|
3599
|
+
* * The 'types' section describes the corresponding data types that a record field has.
|
|
3600
|
+
*
|
|
3601
|
+
* Every record has an implicit 'index' according to the position in the 'records' JSON array.
|
|
3602
|
+
* The types section has a list of 1..N possible type 'buckets'. Each such bucket has an 'indexRange' which indicates which
|
|
3603
|
+
* 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).
|
|
3604
|
+
*
|
|
3605
|
+
* A field part of a record with index 'i' will find its corresponding field type by first locating the bucket that satisfies:
|
|
3606
|
+
*
|
|
3607
|
+
* ```text
|
|
3608
|
+
* startIndex <= i <= endIndex
|
|
3609
|
+
* ```
|
|
3610
|
+
*
|
|
3611
|
+
* Once the bucket is found the 'mappings' object has an entry for all the fields that are part of that record with index 'i'.
|
|
3612
|
+
*
|
|
3613
|
+
*
|
|
3614
|
+
* Since enforcement of a particular schema is absent at ingestion time, it is possible to have records that share the same
|
|
3615
|
+
* field name but their values are of a different type. This phenomenon will hence forth be named as a **"collision"**.
|
|
3616
|
+
* When a collision does occur, we will create a new type 'bucket' that will have a different index range where
|
|
3617
|
+
* the new record field types will be placed.
|
|
3618
|
+
* It is guaranteed that every field of every record will have a corresponding type.
|
|
3619
|
+
* **Clients should always take the included types into account when consuming records!**
|
|
3620
|
+
*
|
|
3621
|
+
* @returns The current status and results of the supplied query.
|
|
3622
|
+
*
|
|
3623
|
+
* @example <caption>Code example</caption>
|
|
3624
|
+
* import { queryExecutionClient } from "@dynatrace-sdk/client-query";
|
|
3625
|
+
*
|
|
3626
|
+
* const data = await queryExecutionClient.queryPoll({
|
|
3627
|
+
* requestToken: "...",
|
|
3628
|
+
* });
|
|
3629
|
+
*/
|
|
3295
3630
|
async queryPoll(config) {
|
|
3296
3631
|
if (!config) {
|
|
3297
3632
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
@@ -3359,7 +3694,10 @@ var QueryExecutionClient = class {
|
|
|
3359
3694
|
}
|
|
3360
3695
|
}
|
|
3361
3696
|
case 410: {
|
|
3362
|
-
const responseValue = await response.body(
|
|
3697
|
+
const responseValue = await response.body(
|
|
3698
|
+
"text"
|
|
3699
|
+
/* type from spec unsupported */
|
|
3700
|
+
);
|
|
3363
3701
|
throw new ClientRequestError(
|
|
3364
3702
|
`410`,
|
|
3365
3703
|
response,
|
|
@@ -3404,6 +3742,57 @@ var QueryExecutionClient = class {
|
|
|
3404
3742
|
}
|
|
3405
3743
|
}
|
|
3406
3744
|
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Starts a Grail query.
|
|
3747
|
+
*
|
|
3748
|
+
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
|
|
3749
|
+
*
|
|
3750
|
+
* ### Overview:
|
|
3751
|
+
*
|
|
3752
|
+
* Executes a query and returns a list of records.
|
|
3753
|
+
*
|
|
3754
|
+
* For details about the query language see the [Dynatrace Query Language documentation](https://dt-url.net/bv03yk8).
|
|
3755
|
+
*
|
|
3756
|
+
* ### The response format:
|
|
3757
|
+
*
|
|
3758
|
+
* 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.
|
|
3759
|
+
*
|
|
3760
|
+
* The result has two main sections:
|
|
3761
|
+
* * The 'records' section contains the individual records, where each record consists of a set of fields and their corresponding values.
|
|
3762
|
+
* * The 'types' section describes the corresponding data types that a record field has.
|
|
3763
|
+
*
|
|
3764
|
+
* Every record has an implicit 'index' according to the position in the 'records' JSON array.
|
|
3765
|
+
* The types section has a list of 1..N possible type 'buckets'. Each such bucket has an 'indexRange' which indicates which
|
|
3766
|
+
* 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).
|
|
3767
|
+
*
|
|
3768
|
+
* A field part of a record with index 'i' will find its corresponding field type by first locating the bucket that satisfies:
|
|
3769
|
+
*
|
|
3770
|
+
* ```text
|
|
3771
|
+
* startIndex <= i <= endIndex
|
|
3772
|
+
* ```
|
|
3773
|
+
*
|
|
3774
|
+
* Once the bucket is found the 'mappings' object has an entry for all the fields that are part of that record with index 'i'.
|
|
3775
|
+
*
|
|
3776
|
+
*
|
|
3777
|
+
* Since enforcement of a particular schema is absent at ingestion time, it is possible to have records that share the same
|
|
3778
|
+
* field name but their values are of a different type. This phenomenon will hence forth be named as a **"collision"**.
|
|
3779
|
+
* When a collision does occur, we will create a new type 'bucket' that will have a different index range where
|
|
3780
|
+
* the new record field types will be placed.
|
|
3781
|
+
* It is guaranteed that every field of every record will have a corresponding type.
|
|
3782
|
+
* **Clients should always take the included types into account when consuming records!**
|
|
3783
|
+
*
|
|
3784
|
+
* @returns The final status and results of the supplied query if it finished within a supplied requestTimeoutMilliseconds. | The status of the query to start.
|
|
3785
|
+
*
|
|
3786
|
+
* @example <caption>Code example</caption>
|
|
3787
|
+
* import { queryExecutionClient } from "@dynatrace-sdk/client-query";
|
|
3788
|
+
*
|
|
3789
|
+
* const data = await queryExecutionClient.queryExecute({
|
|
3790
|
+
* body: {
|
|
3791
|
+
* query:
|
|
3792
|
+
* 'fetch events | filter event.type == "davis" AND davis.status != "CLOSED" | fields timestamp, davis.title, davis.underMaintenance, davis.status | sort timestamp | limit 10',
|
|
3793
|
+
* },
|
|
3794
|
+
* });
|
|
3795
|
+
*/
|
|
3407
3796
|
async queryExecute(config) {
|
|
3408
3797
|
if (!config) {
|
|
3409
3798
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
@@ -3659,6 +4048,53 @@ var QueryExecutionClient = class {
|
|
|
3659
4048
|
}
|
|
3660
4049
|
}
|
|
3661
4050
|
}
|
|
4051
|
+
/**
|
|
4052
|
+
* Cancels the query and returns the result if the query was already finished, otherwise discards it.
|
|
4053
|
+
*
|
|
4054
|
+
* For information about the required permissions see the [Bucket and table permissions in Grail documentation](https://docs.dynatrace.com/docs/shortlink/assign-bucket-table-permissions).
|
|
4055
|
+
*
|
|
4056
|
+
* ### Overview:
|
|
4057
|
+
*
|
|
4058
|
+
* Cancels a running Grail query and returns a list of records if the query already finished.
|
|
4059
|
+
*
|
|
4060
|
+
* ### The response format:
|
|
4061
|
+
*
|
|
4062
|
+
* If the query was already finished, a response body including the result will be returned. Otherwise the response will contain no body.
|
|
4063
|
+
*
|
|
4064
|
+
* The result has three main sections:
|
|
4065
|
+
* * the 'records' section contains the individual records, where each record consists of a set of fields and their corresponding values.
|
|
4066
|
+
* * the 'types' section describes the corresponding data types that a record field has.
|
|
4067
|
+
* * the 'metadata' section contains information about the query like 'analysisTimeframe', 'timezone' or 'locale'.
|
|
4068
|
+
*
|
|
4069
|
+
* Every record has an implicit 'index' according to the position in the 'records' JSON array.
|
|
4070
|
+
* The types section has a list of 1..N possible type 'buckets'. Each such bucket has an 'indexRange' which indicates which
|
|
4071
|
+
* 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).
|
|
4072
|
+
*
|
|
4073
|
+
* A field part of a record with index 'i' will find its corresponding field type by first locating the bucket that satisfies:
|
|
4074
|
+
*
|
|
4075
|
+
* ```text
|
|
4076
|
+
* startIndex <= i <= endIndex
|
|
4077
|
+
* ```
|
|
4078
|
+
*
|
|
4079
|
+
* Once the bucket is found the 'mappings' object has an entry for all the fields that are part of that record with index 'i'.
|
|
4080
|
+
*
|
|
4081
|
+
*
|
|
4082
|
+
* Since enforcement of a particular schema is absent at ingestion time, it is possible to have records that share the same
|
|
4083
|
+
* field name but their values are of a different type. This phenomenon will hence forth be named as a **"collision"**.
|
|
4084
|
+
* When a collision does occur, we will create a new type 'bucket' that will have a different index range where
|
|
4085
|
+
* the new record field types will be placed.
|
|
4086
|
+
* It is guaranteed that every field of every record will have a corresponding type.
|
|
4087
|
+
* **Clients should always take the included types into account when consuming records!**
|
|
4088
|
+
*
|
|
4089
|
+
* @returns The query already finished.
|
|
4090
|
+
*
|
|
4091
|
+
* @example <caption>Code example</caption>
|
|
4092
|
+
* import { queryExecutionClient } from "@dynatrace-sdk/client-query";
|
|
4093
|
+
*
|
|
4094
|
+
* const data = await queryExecutionClient.queryCancel({
|
|
4095
|
+
* requestToken: "...",
|
|
4096
|
+
* });
|
|
4097
|
+
*/
|
|
3662
4098
|
async queryCancel(config) {
|
|
3663
4099
|
if (!config) {
|
|
3664
4100
|
throw new ApiClientError("API client error", "API client call is missing mandatory config parameter");
|
|
@@ -3744,7 +4180,10 @@ var QueryExecutionClient = class {
|
|
|
3744
4180
|
}
|
|
3745
4181
|
}
|
|
3746
4182
|
case 410: {
|
|
3747
|
-
const responseValue = await response.body(
|
|
4183
|
+
const responseValue = await response.body(
|
|
4184
|
+
"text"
|
|
4185
|
+
/* type from spec unsupported */
|
|
4186
|
+
);
|
|
3748
4187
|
throw new ClientRequestError(
|
|
3749
4188
|
`410`,
|
|
3750
4189
|
response,
|
package/docs/DOCS.md
CHANGED
|
@@ -14,7 +14,7 @@ import NpmLogo from '@site/static/img/npm-logo.png';
|
|
|
14
14
|
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-query" target="_blank" rel="noopener noreferrer"> <span class="margin-right--xs">@dynatrace-sdk/client-query</span> <img className="no-zoom" width="20px" src={NpmLogo} /> </a>
|
|
15
15
|
</div>
|
|
16
16
|
<div class="col" style={{textAlign: 'right'}}>
|
|
17
|
-
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.11.
|
|
17
|
+
<a href="https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.11.1" target="_blank" rel="noopener noreferrer">v1.11.1</a>
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
@@ -29,6 +29,7 @@ import { queryAssistanceClient } from '@dynatrace-sdk/client-query';
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
|
|
32
33
|
### queryAutocomplete
|
|
33
34
|
|
|
34
35
|
<div class="padding-bottom--md">
|
|
@@ -97,7 +98,6 @@ A list of structured autocomplete suggestions.
|
|
|
97
98
|
<details>
|
|
98
99
|
<summary>
|
|
99
100
|
Code example
|
|
100
|
-
|
|
101
101
|
</summary>
|
|
102
102
|
|
|
103
103
|
```ts
|
|
@@ -118,6 +118,7 @@ const data = await queryAssistanceClient.queryAutocomplete({
|
|
|
118
118
|
</div>
|
|
119
119
|
|
|
120
120
|
|
|
121
|
+
|
|
121
122
|
### queryParse
|
|
122
123
|
|
|
123
124
|
<div class="padding-bottom--md">
|
|
@@ -356,7 +357,6 @@ A node containing more nodes, a node offering different (semantically equivalen
|
|
|
356
357
|
<details>
|
|
357
358
|
<summary>
|
|
358
359
|
Code example
|
|
359
|
-
|
|
360
360
|
</summary>
|
|
361
361
|
|
|
362
362
|
```ts
|
|
@@ -377,6 +377,7 @@ const data = await queryAssistanceClient.queryParse({
|
|
|
377
377
|
</div>
|
|
378
378
|
|
|
379
379
|
|
|
380
|
+
|
|
380
381
|
### queryVerify
|
|
381
382
|
|
|
382
383
|
<div class="padding-bottom--md">
|
|
@@ -416,7 +417,6 @@ Supplied query and parameters were verified.
|
|
|
416
417
|
<details>
|
|
417
418
|
<summary>
|
|
418
419
|
Code example
|
|
419
|
-
|
|
420
420
|
</summary>
|
|
421
421
|
|
|
422
422
|
```ts
|
|
@@ -443,6 +443,7 @@ import { queryExecutionClient } from '@dynatrace-sdk/client-query';
|
|
|
443
443
|
```
|
|
444
444
|
|
|
445
445
|
|
|
446
|
+
|
|
446
447
|
### queryCancel
|
|
447
448
|
|
|
448
449
|
<div class="padding-bottom--md">
|
|
@@ -512,7 +513,6 @@ The query already finished.
|
|
|
512
513
|
<details>
|
|
513
514
|
<summary>
|
|
514
515
|
Code example
|
|
515
|
-
|
|
516
516
|
</summary>
|
|
517
517
|
|
|
518
518
|
```ts
|
|
@@ -530,6 +530,7 @@ const data = await queryExecutionClient.queryCancel({
|
|
|
530
530
|
</div>
|
|
531
531
|
|
|
532
532
|
|
|
533
|
+
|
|
533
534
|
### queryExecute
|
|
534
535
|
|
|
535
536
|
<div class="padding-bottom--md">
|
|
@@ -600,7 +601,6 @@ The final status and results of the supplied query if it finished within a suppl
|
|
|
600
601
|
<details>
|
|
601
602
|
<summary>
|
|
602
603
|
Code example
|
|
603
|
-
|
|
604
604
|
</summary>
|
|
605
605
|
|
|
606
606
|
```ts
|
|
@@ -621,6 +621,7 @@ const data = await queryExecutionClient.queryExecute({
|
|
|
621
621
|
</div>
|
|
622
622
|
|
|
623
623
|
|
|
624
|
+
|
|
624
625
|
### queryPoll
|
|
625
626
|
|
|
626
627
|
<div class="padding-bottom--md">
|
|
@@ -689,7 +690,6 @@ The current status and results of the supplied query.
|
|
|
689
690
|
<details>
|
|
690
691
|
<summary>
|
|
691
692
|
Code example
|
|
692
|
-
|
|
693
693
|
</summary>
|
|
694
694
|
|
|
695
695
|
```ts
|