@perses-dev/tempo-plugin 0.47.0 → 0.48.0-rc.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.
Files changed (60) hide show
  1. package/dist/cjs/components/TraceQLEditor.js +98 -0
  2. package/dist/cjs/components/TraceQLExtension.js +73 -0
  3. package/dist/cjs/components/complete.js +322 -0
  4. package/dist/cjs/components/highlight.js +41 -0
  5. package/dist/cjs/components/index.js +30 -0
  6. package/dist/cjs/index.js +1 -0
  7. package/dist/cjs/model/tempo-client.js +33 -15
  8. package/dist/cjs/plugins/tempo-datasource.js +22 -4
  9. package/dist/cjs/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.js +6 -2
  10. package/dist/cjs/plugins/tempo-trace-query/get-trace-data.js +3 -13
  11. package/dist/cjs/test/mock-data.js +58 -0
  12. package/dist/components/TraceQLEditor.d.ts +7 -0
  13. package/dist/components/TraceQLEditor.d.ts.map +1 -0
  14. package/dist/{plugins/tempo-trace-query → components}/TraceQLEditor.js +20 -4
  15. package/dist/components/TraceQLEditor.js.map +1 -0
  16. package/dist/components/TraceQLExtension.d.ts +8 -0
  17. package/dist/components/TraceQLExtension.d.ts.map +1 -0
  18. package/dist/components/TraceQLExtension.js +65 -0
  19. package/dist/components/TraceQLExtension.js.map +1 -0
  20. package/dist/components/complete.d.ts +36 -0
  21. package/dist/components/complete.d.ts.map +1 -0
  22. package/dist/components/complete.js +313 -0
  23. package/dist/components/complete.js.map +1 -0
  24. package/dist/components/highlight.d.ts +2 -0
  25. package/dist/components/highlight.d.ts.map +1 -0
  26. package/dist/components/highlight.js +33 -0
  27. package/dist/components/highlight.js.map +1 -0
  28. package/dist/components/index.d.ts +2 -0
  29. package/dist/components/index.d.ts.map +1 -0
  30. package/dist/components/index.js +15 -0
  31. package/dist/components/index.js.map +1 -0
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +2 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/model/api-types.d.ts +62 -11
  37. package/dist/model/api-types.d.ts.map +1 -1
  38. package/dist/model/api-types.js.map +1 -1
  39. package/dist/model/tempo-client.d.ts +18 -8
  40. package/dist/model/tempo-client.d.ts.map +1 -1
  41. package/dist/model/tempo-client.js +26 -10
  42. package/dist/model/tempo-client.js.map +1 -1
  43. package/dist/plugins/tempo-datasource.d.ts.map +1 -1
  44. package/dist/plugins/tempo-datasource.js +23 -5
  45. package/dist/plugins/tempo-datasource.js.map +1 -1
  46. package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.d.ts.map +1 -1
  47. package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.js +6 -2
  48. package/dist/plugins/tempo-trace-query/DashboardTempoTraceQueryEditor.js.map +1 -1
  49. package/dist/plugins/tempo-trace-query/get-trace-data.d.ts.map +1 -1
  50. package/dist/plugins/tempo-trace-query/get-trace-data.js +3 -13
  51. package/dist/plugins/tempo-trace-query/get-trace-data.js.map +1 -1
  52. package/dist/test/mock-data.d.ts +6 -5
  53. package/dist/test/mock-data.d.ts.map +1 -1
  54. package/dist/test/mock-data.js +55 -0
  55. package/dist/test/mock-data.js.map +1 -1
  56. package/package.json +8 -4
  57. package/dist/cjs/plugins/tempo-trace-query/TraceQLEditor.js +0 -46
  58. package/dist/plugins/tempo-trace-query/TraceQLEditor.d.ts +0 -4
  59. package/dist/plugins/tempo-trace-query/TraceQLEditor.d.ts.map +0 -1
  60. package/dist/plugins/tempo-trace-query/TraceQLEditor.js.map +0 -1
@@ -0,0 +1,313 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { syntaxTree } from '@codemirror/language';
14
+ import { String as StringType, FieldExpression, AttributeField, Resource, Identifier, Span, SpansetFilter, FieldOp } from '@grafana/lezer-traceql';
15
+ export async function complete({ state, pos }, client) {
16
+ // First, identify the completion scopes, for example Scopes() and TagName(scope=intrinsic)
17
+ const completions = identifyCompletions(state, pos, syntaxTree(state));
18
+ if (!completions) {
19
+ // No completion scopes found for current cursor position.
20
+ return null;
21
+ }
22
+ // Then, retrieve completion options for all identified scopes (from the Tempo API).
23
+ const options = await retrieveOptions(completions.scopes, client);
24
+ return {
25
+ options,
26
+ from: completions.from,
27
+ to: completions.to
28
+ };
29
+ }
30
+ /**
31
+ * Identify completion scopes (e.g. TagValue) and position, based on the current node in the syntax tree.
32
+ *
33
+ * For development, you can visualize the tree of a TraceQL query using this tool:
34
+ * https://github.com/grafana/lezer-traceql/blob/main/tools/tree-viz.html
35
+ *
36
+ * Function is exported for tests only.
37
+ */ export function identifyCompletions(state, pos, tree) {
38
+ const node = tree.resolveInner(pos, -1);
39
+ switch(node.type.id){
40
+ case SpansetFilter:
41
+ var _node_firstChild;
42
+ // autocomplete {
43
+ // autocomplete {}
44
+ // do not autocomplete if cursor is after } or { status=ok }
45
+ if ((node.firstChild === null || ((_node_firstChild = node.firstChild) === null || _node_firstChild === void 0 ? void 0 : _node_firstChild.type.id) === 0) && !state.sliceDoc(node.from, pos).includes('}')) {
46
+ return {
47
+ scopes: [
48
+ {
49
+ kind: 'Scopes'
50
+ },
51
+ {
52
+ kind: 'TagName',
53
+ scope: 'intrinsic'
54
+ }
55
+ ],
56
+ from: pos
57
+ };
58
+ }
59
+ break;
60
+ case FieldExpression:
61
+ // autocomplete { status=ok &&
62
+ return {
63
+ scopes: [
64
+ {
65
+ kind: 'Scopes'
66
+ },
67
+ {
68
+ kind: 'TagName',
69
+ scope: 'intrinsic'
70
+ }
71
+ ],
72
+ from: pos
73
+ };
74
+ case AttributeField:
75
+ var _node_firstChild1, _node_firstChild2;
76
+ // autocomplete { resource.
77
+ if (((_node_firstChild1 = node.firstChild) === null || _node_firstChild1 === void 0 ? void 0 : _node_firstChild1.type.id) === Resource) {
78
+ return {
79
+ scopes: [
80
+ {
81
+ kind: 'TagName',
82
+ scope: 'resource'
83
+ }
84
+ ],
85
+ from: pos
86
+ };
87
+ }
88
+ // autocomplete { span.
89
+ if (((_node_firstChild2 = node.firstChild) === null || _node_firstChild2 === void 0 ? void 0 : _node_firstChild2.type.id) === Span) {
90
+ return {
91
+ scopes: [
92
+ {
93
+ kind: 'TagName',
94
+ scope: 'span'
95
+ }
96
+ ],
97
+ from: pos
98
+ };
99
+ }
100
+ // autocomplete { .
101
+ if (state.sliceDoc(node.from, node.to) === '.') {
102
+ return {
103
+ scopes: [
104
+ {
105
+ kind: 'TagName',
106
+ scope: 'resource'
107
+ },
108
+ {
109
+ kind: 'TagName',
110
+ scope: 'span'
111
+ }
112
+ ],
113
+ from: pos
114
+ };
115
+ }
116
+ break;
117
+ case Identifier:
118
+ var _node_parent;
119
+ if (((_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.type.id) === AttributeField) {
120
+ var _node_parent_firstChild, _node_parent1, _node_parent_firstChild1, _node_parent2, _node_parent_firstChild2, _node_parent3;
121
+ const text = state.sliceDoc(node.parent.from, node.parent.to);
122
+ // autocomplete { span:s
123
+ // only intrinsic fields can have a : in the name.
124
+ if (text.includes(':')) {
125
+ return {
126
+ scopes: [
127
+ {
128
+ kind: 'TagName',
129
+ scope: 'intrinsic'
130
+ }
131
+ ],
132
+ from: node.parent.from
133
+ };
134
+ }
135
+ // autocomplete { resource.s
136
+ if (((_node_parent1 = node.parent) === null || _node_parent1 === void 0 ? void 0 : (_node_parent_firstChild = _node_parent1.firstChild) === null || _node_parent_firstChild === void 0 ? void 0 : _node_parent_firstChild.type.id) === Resource) {
137
+ return {
138
+ scopes: [
139
+ {
140
+ kind: 'TagName',
141
+ scope: 'resource'
142
+ }
143
+ ],
144
+ from: node.from
145
+ };
146
+ }
147
+ // autocomplete { span.s
148
+ if (((_node_parent2 = node.parent) === null || _node_parent2 === void 0 ? void 0 : (_node_parent_firstChild1 = _node_parent2.firstChild) === null || _node_parent_firstChild1 === void 0 ? void 0 : _node_parent_firstChild1.type.id) === Span) {
149
+ return {
150
+ scopes: [
151
+ {
152
+ kind: 'TagName',
153
+ scope: 'span'
154
+ }
155
+ ],
156
+ from: node.from
157
+ };
158
+ }
159
+ // autocomplete { .s
160
+ if (((_node_parent3 = node.parent) === null || _node_parent3 === void 0 ? void 0 : (_node_parent_firstChild2 = _node_parent3.firstChild) === null || _node_parent_firstChild2 === void 0 ? void 0 : _node_parent_firstChild2.type.id) === Identifier) {
161
+ return {
162
+ scopes: [
163
+ {
164
+ kind: 'TagName',
165
+ scope: 'resource'
166
+ },
167
+ {
168
+ kind: 'TagName',
169
+ scope: 'span'
170
+ }
171
+ ],
172
+ from: node.from
173
+ };
174
+ }
175
+ }
176
+ break;
177
+ case FieldOp:
178
+ var _node_parent_firstChild3, _node_parent4;
179
+ // autocomplete { status=
180
+ // autocomplete { span.http.method=
181
+ if (((_node_parent4 = node.parent) === null || _node_parent4 === void 0 ? void 0 : (_node_parent_firstChild3 = _node_parent4.firstChild) === null || _node_parent_firstChild3 === void 0 ? void 0 : _node_parent_firstChild3.type.id) === FieldExpression) {
182
+ const fieldExpr = node.parent.firstChild;
183
+ const attribute = state.sliceDoc(fieldExpr.from, fieldExpr.to);
184
+ return {
185
+ scopes: [
186
+ {
187
+ kind: 'TagValue',
188
+ tag: attribute,
189
+ quotes: true
190
+ }
191
+ ],
192
+ from: pos
193
+ };
194
+ }
195
+ break;
196
+ case StringType:
197
+ var _node_parent_parent_parent_firstChild, _node_parent_parent_parent, _node_parent_parent, _node_parent5;
198
+ // autocomplete { resource.service.name="
199
+ if (((_node_parent5 = node.parent) === null || _node_parent5 === void 0 ? void 0 : (_node_parent_parent = _node_parent5.parent) === null || _node_parent_parent === void 0 ? void 0 : (_node_parent_parent_parent = _node_parent_parent.parent) === null || _node_parent_parent_parent === void 0 ? void 0 : (_node_parent_parent_parent_firstChild = _node_parent_parent_parent.firstChild) === null || _node_parent_parent_parent_firstChild === void 0 ? void 0 : _node_parent_parent_parent_firstChild.type.id) === FieldExpression) {
200
+ const fieldExpr = node.parent.parent.parent.firstChild;
201
+ const attribute = state.sliceDoc(fieldExpr.from, fieldExpr.to);
202
+ return {
203
+ scopes: [
204
+ {
205
+ kind: 'TagValue',
206
+ tag: attribute
207
+ }
208
+ ],
209
+ from: node.from + 1
210
+ }; // node.from+1 to ignore leading "
211
+ }
212
+ break;
213
+ case 0 /* error node */ :
214
+ var _node_prevSibling, _node_parent_firstChild4, _node_parent6, _node_parent7, _node_parent8;
215
+ // autocomplete { status=e
216
+ if (((_node_prevSibling = node.prevSibling) === null || _node_prevSibling === void 0 ? void 0 : _node_prevSibling.type.id) === FieldOp && ((_node_parent6 = node.parent) === null || _node_parent6 === void 0 ? void 0 : (_node_parent_firstChild4 = _node_parent6.firstChild) === null || _node_parent_firstChild4 === void 0 ? void 0 : _node_parent_firstChild4.type.id) === FieldExpression) {
217
+ const fieldExpr = node.parent.firstChild;
218
+ const attribute = state.sliceDoc(fieldExpr.from, fieldExpr.to);
219
+ return {
220
+ scopes: [
221
+ {
222
+ kind: 'TagValue',
223
+ tag: attribute
224
+ }
225
+ ],
226
+ from: node.from
227
+ };
228
+ }
229
+ // autocomplete { s
230
+ // autocomplete { status=ok && s
231
+ if (((_node_parent7 = node.parent) === null || _node_parent7 === void 0 ? void 0 : _node_parent7.type.id) === SpansetFilter || ((_node_parent8 = node.parent) === null || _node_parent8 === void 0 ? void 0 : _node_parent8.type.id) === FieldExpression) {
232
+ return {
233
+ scopes: [
234
+ {
235
+ kind: 'Scopes'
236
+ },
237
+ {
238
+ kind: 'TagName',
239
+ scope: 'intrinsic'
240
+ }
241
+ ],
242
+ from: node.from
243
+ };
244
+ }
245
+ break;
246
+ }
247
+ }
248
+ /**
249
+ * Retrieve all completion options based on the previously identified completion scopes.
250
+ */ async function retrieveOptions(completions, client) {
251
+ const results = [];
252
+ for (const completion of completions){
253
+ switch(completion.kind){
254
+ case 'Scopes':
255
+ results.push(Promise.resolve([
256
+ {
257
+ label: 'span'
258
+ },
259
+ {
260
+ label: 'resource'
261
+ }
262
+ ]));
263
+ break;
264
+ case 'TagName':
265
+ if (client) {
266
+ results.push(completeTagName(client, completion.scope));
267
+ }
268
+ break;
269
+ case 'TagValue':
270
+ if (client) {
271
+ results.push(completeTagValue(client, completion.tag, completion.quotes));
272
+ }
273
+ break;
274
+ }
275
+ }
276
+ // Retrieve options concurrently
277
+ // e.g. for unscoped attribute fields, retrieve list of span and resource attributes concurrently.
278
+ const options = await Promise.all(results);
279
+ return options.flat();
280
+ }
281
+ async function completeTagName(client, scope) {
282
+ const response = await client.searchTags({
283
+ scope
284
+ });
285
+ return response.scopes.flatMap((scope)=>scope.tags).map((tag)=>({
286
+ label: tag
287
+ }));
288
+ }
289
+ async function completeTagValue(client, tag, quotes) {
290
+ const response = await client.searchTagValues({
291
+ tag
292
+ });
293
+ const completions = [];
294
+ for (const { type, value } of response.tagValues){
295
+ switch(type){
296
+ case 'string':
297
+ completions.push({
298
+ displayLabel: value,
299
+ label: quotes ? `"${value}"` : value
300
+ });
301
+ break;
302
+ case 'keyword':
303
+ case 'int':
304
+ completions.push({
305
+ label: value
306
+ });
307
+ break;
308
+ }
309
+ }
310
+ return completions;
311
+ }
312
+
313
+ //# sourceMappingURL=complete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/complete.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Completion, CompletionContext, CompletionResult } from '@codemirror/autocomplete';\nimport { syntaxTree } from '@codemirror/language';\nimport { EditorState } from '@codemirror/state';\nimport { Tree } from '@lezer/common';\nimport {\n String as StringType,\n FieldExpression,\n AttributeField,\n Resource,\n Identifier,\n Span,\n SpansetFilter,\n FieldOp,\n} from '@grafana/lezer-traceql';\nimport { TempoClient } from '../model/tempo-client';\n\n/** CompletionScope specifies the completion kind, e.g. whether to complete tag names or values etc. */\ntype CompletionScope =\n | { kind: 'Scopes' } // 'resource'|'span'\n | { kind: 'TagName'; scope: 'resource' | 'span' | 'intrinsic' }\n | { kind: 'TagValue'; tag: string; quotes?: boolean };\n\n/**\n * Completions specifies the identified scopes and position of the completion in the current editor text.\n * For example, when entering '{' the following completions are possible: Scopes(), TagName(scope=intrinsic)\n */\nexport interface Completions {\n scopes: CompletionScope[];\n from: number;\n to?: number;\n}\n\nexport async function complete(\n { state, pos }: CompletionContext,\n client?: TempoClient\n): Promise<CompletionResult | null> {\n // First, identify the completion scopes, for example Scopes() and TagName(scope=intrinsic)\n const completions = identifyCompletions(state, pos, syntaxTree(state));\n if (!completions) {\n // No completion scopes found for current cursor position.\n return null;\n }\n\n // Then, retrieve completion options for all identified scopes (from the Tempo API).\n const options = await retrieveOptions(completions.scopes, client);\n return { options, from: completions.from, to: completions.to };\n}\n\n/**\n * Identify completion scopes (e.g. TagValue) and position, based on the current node in the syntax tree.\n *\n * For development, you can visualize the tree of a TraceQL query using this tool:\n * https://github.com/grafana/lezer-traceql/blob/main/tools/tree-viz.html\n *\n * Function is exported for tests only.\n */\nexport function identifyCompletions(state: EditorState, pos: number, tree: Tree): Completions | undefined {\n const node = tree.resolveInner(pos, -1);\n\n switch (node.type.id) {\n case SpansetFilter:\n // autocomplete {\n // autocomplete {}\n // do not autocomplete if cursor is after } or { status=ok }\n if (\n (node.firstChild === null || node.firstChild?.type.id === 0) &&\n !state.sliceDoc(node.from, pos).includes('}')\n ) {\n return {\n scopes: [{ kind: 'Scopes' }, { kind: 'TagName', scope: 'intrinsic' }],\n from: pos,\n };\n }\n break;\n\n case FieldExpression:\n // autocomplete { status=ok &&\n return {\n scopes: [{ kind: 'Scopes' }, { kind: 'TagName', scope: 'intrinsic' }],\n from: pos,\n };\n\n case AttributeField:\n // autocomplete { resource.\n if (node.firstChild?.type.id === Resource) {\n return { scopes: [{ kind: 'TagName', scope: 'resource' }], from: pos };\n }\n\n // autocomplete { span.\n if (node.firstChild?.type.id === Span) {\n return { scopes: [{ kind: 'TagName', scope: 'span' }], from: pos };\n }\n\n // autocomplete { .\n if (state.sliceDoc(node.from, node.to) === '.') {\n return {\n scopes: [\n { kind: 'TagName', scope: 'resource' },\n { kind: 'TagName', scope: 'span' },\n ],\n from: pos,\n };\n }\n break;\n\n case Identifier:\n if (node.parent?.type.id === AttributeField) {\n const text = state.sliceDoc(node.parent.from, node.parent.to);\n // autocomplete { span:s\n // only intrinsic fields can have a : in the name.\n if (text.includes(':')) {\n return { scopes: [{ kind: 'TagName', scope: 'intrinsic' }], from: node.parent.from };\n }\n\n // autocomplete { resource.s\n if (node.parent?.firstChild?.type.id === Resource) {\n return { scopes: [{ kind: 'TagName', scope: 'resource' }], from: node.from };\n }\n\n // autocomplete { span.s\n if (node.parent?.firstChild?.type.id === Span) {\n return { scopes: [{ kind: 'TagName', scope: 'span' }], from: node.from };\n }\n\n // autocomplete { .s\n if (node.parent?.firstChild?.type.id === Identifier) {\n return {\n scopes: [\n { kind: 'TagName', scope: 'resource' },\n { kind: 'TagName', scope: 'span' },\n ],\n from: node.from,\n };\n }\n }\n break;\n\n case FieldOp:\n // autocomplete { status=\n // autocomplete { span.http.method=\n if (node.parent?.firstChild?.type.id === FieldExpression) {\n const fieldExpr = node.parent.firstChild;\n const attribute = state.sliceDoc(fieldExpr.from, fieldExpr.to);\n return { scopes: [{ kind: 'TagValue', tag: attribute, quotes: true }], from: pos };\n }\n break;\n\n case StringType:\n // autocomplete { resource.service.name=\"\n if (node.parent?.parent?.parent?.firstChild?.type.id === FieldExpression) {\n const fieldExpr = node.parent.parent.parent.firstChild;\n const attribute = state.sliceDoc(fieldExpr.from, fieldExpr.to);\n return { scopes: [{ kind: 'TagValue', tag: attribute }], from: node.from + 1 }; // node.from+1 to ignore leading \"\n }\n break;\n\n case 0 /* error node */:\n // autocomplete { status=e\n if (node.prevSibling?.type.id === FieldOp && node.parent?.firstChild?.type.id === FieldExpression) {\n const fieldExpr = node.parent.firstChild;\n const attribute = state.sliceDoc(fieldExpr.from, fieldExpr.to);\n return { scopes: [{ kind: 'TagValue', tag: attribute }], from: node.from };\n }\n\n // autocomplete { s\n // autocomplete { status=ok && s\n if (node.parent?.type.id === SpansetFilter || node.parent?.type.id === FieldExpression) {\n return {\n scopes: [{ kind: 'Scopes' }, { kind: 'TagName', scope: 'intrinsic' }],\n from: node.from,\n };\n }\n break;\n }\n}\n\n/**\n * Retrieve all completion options based on the previously identified completion scopes.\n */\nasync function retrieveOptions(completions: CompletionScope[], client?: TempoClient): Promise<Completion[]> {\n const results: Array<Promise<Completion[]>> = [];\n\n for (const completion of completions) {\n switch (completion.kind) {\n case 'Scopes':\n results.push(Promise.resolve([{ label: 'span' }, { label: 'resource' }]));\n break;\n\n case 'TagName':\n if (client) {\n results.push(completeTagName(client, completion.scope));\n }\n break;\n\n case 'TagValue':\n if (client) {\n results.push(completeTagValue(client, completion.tag, completion.quotes));\n }\n break;\n }\n }\n\n // Retrieve options concurrently\n // e.g. for unscoped attribute fields, retrieve list of span and resource attributes concurrently.\n const options = await Promise.all(results);\n return options.flat();\n}\n\nasync function completeTagName(client: TempoClient, scope: 'resource' | 'span' | 'intrinsic'): Promise<Completion[]> {\n const response = await client.searchTags({ scope });\n return response.scopes.flatMap((scope) => scope.tags).map((tag) => ({ label: tag }));\n}\n\nasync function completeTagValue(client: TempoClient, tag: string, quotes?: boolean): Promise<Completion[]> {\n const response = await client.searchTagValues({ tag });\n const completions: Completion[] = [];\n for (const { type, value } of response.tagValues) {\n switch (type) {\n case 'string':\n completions.push({ displayLabel: value, label: quotes ? `\"${value}\"` : value });\n break;\n\n case 'keyword':\n case 'int':\n completions.push({ label: value });\n break;\n }\n }\n return completions;\n}\n"],"names":["syntaxTree","String","StringType","FieldExpression","AttributeField","Resource","Identifier","Span","SpansetFilter","FieldOp","complete","state","pos","client","completions","identifyCompletions","options","retrieveOptions","scopes","from","to","tree","node","resolveInner","type","id","firstChild","sliceDoc","includes","kind","scope","parent","text","fieldExpr","attribute","tag","quotes","prevSibling","results","completion","push","Promise","resolve","label","completeTagName","completeTagValue","all","flat","response","searchTags","flatMap","tags","map","searchTagValues","value","tagValues","displayLabel"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,QAAQ,uBAAuB;AAGlD,SACEC,UAAUC,UAAU,EACpBC,eAAe,EACfC,cAAc,EACdC,QAAQ,EACRC,UAAU,EACVC,IAAI,EACJC,aAAa,EACbC,OAAO,QACF,yBAAyB;AAmBhC,OAAO,eAAeC,SACpB,EAAEC,KAAK,EAAEC,GAAG,EAAqB,EACjCC,MAAoB;IAEpB,2FAA2F;IAC3F,MAAMC,cAAcC,oBAAoBJ,OAAOC,KAAKZ,WAAWW;IAC/D,IAAI,CAACG,aAAa;QAChB,0DAA0D;QAC1D,OAAO;IACT;IAEA,oFAAoF;IACpF,MAAME,UAAU,MAAMC,gBAAgBH,YAAYI,MAAM,EAAEL;IAC1D,OAAO;QAAEG;QAASG,MAAML,YAAYK,IAAI;QAAEC,IAAIN,YAAYM,EAAE;IAAC;AAC/D;AAEA;;;;;;;CAOC,GACD,OAAO,SAASL,oBAAoBJ,KAAkB,EAAEC,GAAW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AOxC;AACT"}
@@ -0,0 +1,2 @@
1
+ export declare const traceQLHighlight: import("@lezer/common").NodePropSource;
2
+ //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../src/components/highlight.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,wCAiB3B,CAAC"}
@@ -0,0 +1,33 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { styleTags, tags } from '@lezer/highlight';
14
+ export const traceQLHighlight = styleTags({
15
+ LineComment: tags.comment,
16
+ 'Parent Resource Span Identifier': tags.labelName,
17
+ IntrinsicField: tags.labelName,
18
+ String: tags.string,
19
+ 'Integer Float Duration': tags.number,
20
+ Static: tags.literal,
21
+ 'Aggregate AggregateExpression': tags.function(tags.keyword),
22
+ 'And Or': tags.logicOperator,
23
+ 'Gt Lt Desc Anc tilde ExperimentalOp': tags.bitwiseOperator,
24
+ ComparisonOp: tags.compareOperator,
25
+ Pipe: tags.operator,
26
+ ScalarOp: tags.arithmeticOperator,
27
+ '( )': tags.paren,
28
+ '[ ]': tags.squareBracket,
29
+ '{ }': tags.brace,
30
+ '⚠': tags.invalid
31
+ });
32
+
33
+ //# sourceMappingURL=highlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/highlight.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { styleTags, tags } from '@lezer/highlight';\n\nexport const traceQLHighlight = styleTags({\n LineComment: tags.comment,\n 'Parent Resource Span Identifier': tags.labelName,\n IntrinsicField: tags.labelName,\n String: tags.string,\n 'Integer Float Duration': tags.number,\n Static: tags.literal,\n 'Aggregate AggregateExpression': tags.function(tags.keyword),\n 'And Or': tags.logicOperator,\n 'Gt Lt Desc Anc tilde ExperimentalOp': tags.bitwiseOperator, // structural operators\n ComparisonOp: tags.compareOperator,\n Pipe: tags.operator,\n ScalarOp: tags.arithmeticOperator,\n '( )': tags.paren,\n '[ ]': tags.squareBracket,\n '{ }': tags.brace,\n '⚠': tags.invalid,\n});\n"],"names":["styleTags","tags","traceQLHighlight","LineComment","comment","labelName","IntrinsicField","String","string","number","Static","literal","function","keyword","logicOperator","bitwiseOperator","ComparisonOp","compareOperator","Pipe","operator","ScalarOp","arithmeticOperator","paren","squareBracket","brace","invalid"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,SAAS,EAAEC,IAAI,QAAQ,mBAAmB;AAEnD,OAAO,MAAMC,mBAAmBF,UAAU;IACxCG,aAAaF,KAAKG,OAAO;IACzB,mCAAmCH,KAAKI,SAAS;IACjDC,gBAAgBL,KAAKI,SAAS;IAC9BE,QAAQN,KAAKO,MAAM;IACnB,0BAA0BP,KAAKQ,MAAM;IACrCC,QAAQT,KAAKU,OAAO;IACpB,iCAAiCV,KAAKW,QAAQ,CAACX,KAAKY,OAAO;IAC3D,UAAUZ,KAAKa,aAAa;IAC5B,uCAAuCb,KAAKc,eAAe;IAC3DC,cAAcf,KAAKgB,eAAe;IAClCC,MAAMjB,KAAKkB,QAAQ;IACnBC,UAAUnB,KAAKoB,kBAAkB;IACjC,OAAOpB,KAAKqB,KAAK;IACjB,OAAOrB,KAAKsB,aAAa;IACzB,OAAOtB,KAAKuB,KAAK;IACjB,KAAKvB,KAAKwB,OAAO;AACnB,GAAG"}
@@ -0,0 +1,2 @@
1
+ export * from './TraceQLEditor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './TraceQLEditor';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './TraceQLEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB"}
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ import { TempoTraceQuery } from './plugins/tempo-trace-query/TempoTraceQuery';
3
3
  export { TempoTraceQuery, TempoDatasource };
4
4
  export * from './model/tempo-client';
5
5
  export * from './model/tempo-selectors';
6
+ export * from './components/TraceQLExtension';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAG5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAG9E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAG5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,+BAA+B,CAAC"}
package/dist/index.js CHANGED
@@ -17,5 +17,7 @@ export { TempoTraceQuery, TempoDatasource };
17
17
  // For consumers to leverage in DatasourceStoreProvider onCreate
18
18
  export * from './model/tempo-client';
19
19
  export * from './model/tempo-selectors';
20
+ // For consumers of TraceQLExtension
21
+ export * from './components/TraceQLExtension';
20
22
 
21
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TempoDatasource } from './plugins/tempo-datasource';\nimport { TempoTraceQuery } from './plugins/tempo-trace-query/TempoTraceQuery';\n\n// Export plugins under the same name as the kinds they handle from the plugin.json\nexport { TempoTraceQuery, TempoDatasource };\n\n// For consumers to leverage in DatasourceStoreProvider onCreate\nexport * from './model/tempo-client';\nexport * from './model/tempo-selectors';\n"],"names":["TempoDatasource","TempoTraceQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,eAAe,QAAQ,8CAA8C;AAE9E,mFAAmF;AACnF,SAASA,eAAe,EAAED,eAAe,GAAG;AAE5C,gEAAgE;AAChE,cAAc,uBAAuB;AACrC,cAAc,0BAA0B"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TempoDatasource } from './plugins/tempo-datasource';\nimport { TempoTraceQuery } from './plugins/tempo-trace-query/TempoTraceQuery';\n\n// Export plugins under the same name as the kinds they handle from the plugin.json\nexport { TempoTraceQuery, TempoDatasource };\n\n// For consumers to leverage in DatasourceStoreProvider onCreate\nexport * from './model/tempo-client';\nexport * from './model/tempo-selectors';\n\n// For consumers of TraceQLExtension\nexport * from './components/TraceQLExtension';\n"],"names":["TempoDatasource","TempoTraceQuery"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,eAAe,QAAQ,8CAA8C;AAE9E,mFAAmF;AACnF,SAASA,eAAe,EAAED,eAAe,GAAG;AAE5C,gEAAgE;AAChE,cAAc,uBAAuB;AACrC,cAAc,0BAA0B;AAExC,oCAAoC;AACpC,cAAc,gCAAgC"}
@@ -17,7 +17,8 @@ export type AttributeValue = {
17
17
  };
18
18
  };
19
19
  /**
20
- * Parameters of Tempo HTTP API endpoint GET /api/search
20
+ * Request parameters of Tempo HTTP API endpoint GET /api/search
21
+ * https://grafana.com/docs/tempo/latest/api_docs/#search
21
22
  */
22
23
  export interface SearchRequestParameters {
23
24
  q: string;
@@ -25,12 +26,13 @@ export interface SearchRequestParameters {
25
26
  end?: number;
26
27
  }
27
28
  /**
28
- * Response of Tempo HTTP API endpoint GET /api/search/<query>
29
+ * Response of Tempo HTTP API endpoint GET /api/search
30
+ * https://grafana.com/docs/tempo/latest/api_docs/#search
29
31
  */
30
- export interface SearchTraceQueryResponse {
31
- traces: TraceSearchResult[];
32
+ export interface SearchResponse {
33
+ traces: TraceSearchResponse[];
32
34
  }
33
- export interface TraceSearchResult {
35
+ export interface TraceSearchResponse {
34
36
  traceID: string;
35
37
  rootServiceName: string;
36
38
  rootTraceName: string;
@@ -39,33 +41,40 @@ export interface TraceSearchResult {
39
41
  durationMs?: number;
40
42
  /** @deprecated spanSet is deprecated in favor of spanSets */
41
43
  spanSet?: {
42
- spans: SpanSearchResult[];
44
+ spans: SpanSearchResponse[];
43
45
  matched: number;
44
46
  };
45
47
  spanSets?: Array<{
46
- spans: SpanSearchResult[];
48
+ spans: SpanSearchResponse[];
47
49
  matched: number;
48
50
  }>;
49
51
  /** ServiceStats are only available in Tempo vParquet4+ blocks */
50
52
  serviceStats?: Record<string, ServiceStats>;
51
53
  }
52
- export interface SpanSearchResult {
54
+ export interface SpanSearchResponse {
53
55
  spanID: string;
54
- name: string;
56
+ name?: string;
55
57
  startTimeUnixNano: string;
56
58
  durationNanos: string;
57
- attributes: Attribute[];
59
+ attributes?: Attribute[];
58
60
  }
59
61
  export interface ServiceStats {
60
62
  spanCount: number;
61
63
  /** number of spans with errors, unset if zero */
62
64
  errorCount?: number;
63
65
  }
66
+ /**
67
+ * Request parameters of Tempo HTTP API endpoint GET /api/traces/<traceID>
68
+ * https://grafana.com/docs/tempo/latest/api_docs/#query
69
+ */
70
+ export interface QueryRequestParameters {
71
+ traceId: string;
72
+ }
64
73
  /**
65
74
  * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>
66
75
  * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go
67
76
  */
68
- export interface SearchTraceIDResponse {
77
+ export interface QueryResponse {
69
78
  batches: Batch[];
70
79
  }
71
80
  export interface Batch {
@@ -106,4 +115,46 @@ export interface SpanStatus {
106
115
  export declare const SpanStatusUnset = "STATUS_CODE_UNSET";
107
116
  export declare const SpanStatusOk = "STATUS_CODE_OK";
108
117
  export declare const SpanStatusError = "STATUS_CODE_ERROR";
118
+ /**
119
+ * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tags
120
+ * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2
121
+ */
122
+ export interface SearchTagsRequestParameters {
123
+ scope?: 'resource' | 'span' | 'intrinsic';
124
+ q?: string;
125
+ start?: number;
126
+ end?: number;
127
+ }
128
+ /**
129
+ * Response of Tempo HTTP API endpoint GET /api/v2/search/tags
130
+ * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2
131
+ */
132
+ export interface SearchTagsResponse {
133
+ scopes: SearchTagsScope[];
134
+ }
135
+ export interface SearchTagsScope {
136
+ name: 'resource' | 'span' | 'intrinsic';
137
+ tags: string[];
138
+ }
139
+ /**
140
+ * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values
141
+ * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2
142
+ */
143
+ export interface SearchTagValuesRequestParameters {
144
+ tag: string;
145
+ q?: string;
146
+ start?: number;
147
+ end?: number;
148
+ }
149
+ /**
150
+ * Response of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values
151
+ * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2
152
+ */
153
+ export interface SearchTagValuesResponse {
154
+ tagValues: SearchTagValue[];
155
+ }
156
+ export interface SearchTagValue {
157
+ type: string;
158
+ value: string;
159
+ }
109
160
  //# sourceMappingURL=api-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../../src/model/api-types.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GACvB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpB;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,GACtB;IAAE,UAAU,EAAE;QAAE,MAAM,EAAE,cAAc,EAAE,CAAA;KAAE,CAAA;CAAE,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,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AC1C,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IAC1C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/api-types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Common types\n */\nexport interface Attribute {\n key: string;\n value: AttributeValue;\n}\n\nexport type AttributeValue =\n | { stringValue: string }\n | { intValue: string }\n | { boolValue: boolean }\n | { arrayValue: { values: AttributeValue[] } };\n\n/**\n * Parameters of Tempo HTTP API endpoint GET /api/search\n */\nexport interface SearchRequestParameters {\n q: string;\n start?: number;\n end?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search/<query>\n */\nexport interface SearchTraceQueryResponse {\n traces: TraceSearchResult[];\n}\n\nexport interface TraceSearchResult {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n /** unset if duration is less than 1ms */\n durationMs?: number;\n /** @deprecated spanSet is deprecated in favor of spanSets */\n spanSet?: {\n spans: SpanSearchResult[];\n matched: number;\n };\n spanSets?: Array<{\n spans: SpanSearchResult[];\n matched: number;\n }>;\n /** ServiceStats are only available in Tempo vParquet4+ blocks */\n serviceStats?: Record<string, ServiceStats>;\n}\n\nexport interface SpanSearchResult {\n spanID: string;\n name: string;\n startTimeUnixNano: string;\n durationNanos: string;\n attributes: Attribute[];\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go\n */\nexport interface SearchTraceIDResponse {\n batches: Batch[];\n}\n\nexport interface Batch {\n resource: Resource;\n scopeSpans: ScopeSpan[];\n}\n\nexport interface Resource {\n attributes: Attribute[];\n}\n\nexport interface ScopeSpan {\n scope: Scope;\n spans: Span[];\n}\n\nexport interface Scope {\n name: string;\n}\n\nexport interface Span {\n traceId: string;\n spanId: string;\n parentSpanId?: string;\n name: string;\n kind: string;\n startTimeUnixNano: string;\n endTimeUnixNano: string;\n attributes?: Attribute[];\n events?: SpanEvent[];\n status?: SpanStatus;\n}\n\nexport interface SpanEvent {\n timeUnixNano: string;\n name: string;\n attributes?: Attribute[];\n}\n\nexport interface SpanStatus {\n code?: typeof SpanStatusUnset | typeof SpanStatusOk | typeof SpanStatusError;\n message?: string;\n}\n\nexport const SpanStatusUnset = 'STATUS_CODE_UNSET';\nexport const SpanStatusOk = 'STATUS_CODE_OK';\nexport const SpanStatusError = 'STATUS_CODE_ERROR';\n"],"names":["SpanStatusUnset","SpanStatusOk","SpanStatusError"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;;CAEC,GAgHD,OAAO,MAAMA,kBAAkB,oBAAoB;AACnD,OAAO,MAAMC,eAAe,iBAAiB;AAC7C,OAAO,MAAMC,kBAAkB,oBAAoB"}
1
+ {"version":3,"sources":["../../src/model/api-types.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Common types\n */\nexport interface Attribute {\n key: string;\n value: AttributeValue;\n}\n\nexport type AttributeValue =\n | { stringValue: string }\n | { intValue: string }\n | { boolValue: boolean }\n | { arrayValue: { values: AttributeValue[] } };\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchRequestParameters {\n q: string;\n start?: number;\n end?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/search\n * https://grafana.com/docs/tempo/latest/api_docs/#search\n */\nexport interface SearchResponse {\n traces: TraceSearchResponse[];\n}\n\nexport interface TraceSearchResponse {\n traceID: string;\n rootServiceName: string;\n rootTraceName: string;\n startTimeUnixNano: string;\n /** unset if duration is less than 1ms */\n durationMs?: number;\n /** @deprecated spanSet is deprecated in favor of spanSets */\n spanSet?: {\n spans: SpanSearchResponse[];\n matched: number;\n };\n spanSets?: Array<{\n spans: SpanSearchResponse[];\n matched: number;\n }>;\n /** ServiceStats are only available in Tempo vParquet4+ blocks */\n serviceStats?: Record<string, ServiceStats>;\n}\n\nexport interface SpanSearchResponse {\n spanID: string;\n name?: string;\n startTimeUnixNano: string;\n durationNanos: string;\n attributes?: Attribute[];\n}\n\nexport interface ServiceStats {\n spanCount: number;\n /** number of spans with errors, unset if zero */\n errorCount?: number;\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * https://grafana.com/docs/tempo/latest/api_docs/#query\n */\nexport interface QueryRequestParameters {\n traceId: string;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/traces/<traceID>\n * OTEL trace proto: https://github.com/open-telemetry/opentelemetry-proto-go/blob/main/otlp/trace/v1/trace.pb.go\n */\nexport interface QueryResponse {\n batches: Batch[];\n}\n\nexport interface Batch {\n resource: Resource;\n scopeSpans: ScopeSpan[];\n}\n\nexport interface Resource {\n attributes: Attribute[];\n}\n\nexport interface ScopeSpan {\n scope: Scope;\n spans: Span[];\n}\n\nexport interface Scope {\n name: string;\n}\n\nexport interface Span {\n traceId: string;\n spanId: string;\n parentSpanId?: string;\n name: string;\n kind: string;\n startTimeUnixNano: string;\n endTimeUnixNano: string;\n attributes?: Attribute[];\n events?: SpanEvent[];\n status?: SpanStatus;\n}\n\nexport interface SpanEvent {\n timeUnixNano: string;\n name: string;\n attributes?: Attribute[];\n}\n\nexport interface SpanStatus {\n code?: typeof SpanStatusUnset | typeof SpanStatusOk | typeof SpanStatusError;\n message?: string;\n}\n\nexport const SpanStatusUnset = 'STATUS_CODE_UNSET';\nexport const SpanStatusOk = 'STATUS_CODE_OK';\nexport const SpanStatusError = 'STATUS_CODE_ERROR';\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsRequestParameters {\n scope?: 'resource' | 'span' | 'intrinsic';\n q?: string;\n start?: number;\n end?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tags\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tags-v2\n */\nexport interface SearchTagsResponse {\n scopes: SearchTagsScope[];\n}\n\nexport interface SearchTagsScope {\n name: 'resource' | 'span' | 'intrinsic';\n tags: string[];\n}\n\n/**\n * Request parameters of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesRequestParameters {\n tag: string;\n q?: string;\n start?: number;\n end?: number;\n}\n\n/**\n * Response of Tempo HTTP API endpoint GET /api/v2/search/tag/<tag>/values\n * https://grafana.com/docs/tempo/latest/api_docs/#search-tag-values-v2\n */\nexport interface SearchTagValuesResponse {\n tagValues: SearchTagValue[];\n}\n\nexport interface SearchTagValue {\n type: string;\n value: string;\n}\n"],"names":["SpanStatusUnset","SpanStatusOk","SpanStatusError"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC;;CAEC,GA0HD,OAAO,MAAMA,kBAAkB,oBAAoB;AACnD,OAAO,MAAMC,eAAe,iBAAiB;AAC7C,OAAO,MAAMC,kBAAkB,oBAAoB"}