mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Return raw result from traceql query (#86032)
Return raw result from traceql query
This commit is contained in:
@@ -85,6 +85,7 @@ export enum SearchStreamingState {
|
|||||||
* The type of the table that is used to display the search results
|
* The type of the table that is used to display the search results
|
||||||
*/
|
*/
|
||||||
export enum SearchTableType {
|
export enum SearchTableType {
|
||||||
|
Raw = 'raw',
|
||||||
Spans = 'spans',
|
Spans = 'spans',
|
||||||
Traces = 'traces',
|
Traces = 'traces',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const (
|
|||||||
|
|
||||||
// Defines values for SearchTableType.
|
// Defines values for SearchTableType.
|
||||||
const (
|
const (
|
||||||
|
SearchTableTypeRaw SearchTableType = "raw"
|
||||||
SearchTableTypeSpans SearchTableType = "spans"
|
SearchTableTypeSpans SearchTableType = "spans"
|
||||||
SearchTableTypeTraces SearchTableType = "traces"
|
SearchTableTypeTraces SearchTableType = "traces"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ composableKinds: DataQuery: {
|
|||||||
#SearchStreamingState: "pending" | "streaming" | "done" | "error" @cuetsy(kind="enum")
|
#SearchStreamingState: "pending" | "streaming" | "done" | "error" @cuetsy(kind="enum")
|
||||||
|
|
||||||
// The type of the table that is used to display the search results
|
// The type of the table that is used to display the search results
|
||||||
#SearchTableType: "traces" | "spans" @cuetsy(kind="enum")
|
#SearchTableType: "traces" | "spans" | "raw" @cuetsy(kind="enum")
|
||||||
|
|
||||||
// static fields are pre-set in the UI, dynamic fields are added by the user
|
// static fields are pre-set in the UI, dynamic fields are added by the user
|
||||||
#TraceqlSearchScope: "intrinsic" | "unscoped" | "resource" | "span" @cuetsy(kind="enum")
|
#TraceqlSearchScope: "intrinsic" | "unscoped" | "resource" | "span" @cuetsy(kind="enum")
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ export enum SearchStreamingState {
|
|||||||
* The type of the table that is used to display the search results
|
* The type of the table that is used to display the search results
|
||||||
*/
|
*/
|
||||||
export enum SearchTableType {
|
export enum SearchTableType {
|
||||||
|
Raw = 'raw',
|
||||||
Spans = 'spans',
|
Spans = 'spans',
|
||||||
Traces = 'traces',
|
Traces = 'traces',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -529,10 +529,24 @@ export function formatTraceQLResponse(
|
|||||||
instanceSettings: DataSourceInstanceSettings,
|
instanceSettings: DataSourceInstanceSettings,
|
||||||
tableType?: SearchTableType
|
tableType?: SearchTableType
|
||||||
) {
|
) {
|
||||||
if (tableType === SearchTableType.Spans) {
|
switch (tableType) {
|
||||||
return createTableFrameFromTraceQlQueryAsSpans(data, instanceSettings);
|
case SearchTableType.Spans:
|
||||||
|
return createTableFrameFromTraceQlQueryAsSpans(data, instanceSettings);
|
||||||
|
case SearchTableType.Raw:
|
||||||
|
return createDataFrameFromTraceQlQuery(data);
|
||||||
|
default:
|
||||||
|
return createTableFrameFromTraceQlQuery(data, instanceSettings);
|
||||||
}
|
}
|
||||||
return createTableFrameFromTraceQlQuery(data, instanceSettings);
|
}
|
||||||
|
|
||||||
|
function createDataFrameFromTraceQlQuery(data: TraceSearchMetadata[]) {
|
||||||
|
return [
|
||||||
|
createDataFrame({
|
||||||
|
name: 'Raw response',
|
||||||
|
refId: 'raw',
|
||||||
|
fields: [{ name: 'response', type: FieldType.string, values: [JSON.stringify(data, null, 2)] }],
|
||||||
|
}),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user