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
|
||||
*/
|
||||
export enum SearchTableType {
|
||||
Raw = 'raw',
|
||||
Spans = 'spans',
|
||||
Traces = 'traces',
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ const (
|
||||
|
||||
// Defines values for SearchTableType.
|
||||
const (
|
||||
SearchTableTypeRaw SearchTableType = "raw"
|
||||
SearchTableTypeSpans SearchTableType = "spans"
|
||||
SearchTableTypeTraces SearchTableType = "traces"
|
||||
)
|
||||
|
||||
@@ -59,7 +59,7 @@ composableKinds: DataQuery: {
|
||||
#SearchStreamingState: "pending" | "streaming" | "done" | "error" @cuetsy(kind="enum")
|
||||
|
||||
// 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
|
||||
#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
|
||||
*/
|
||||
export enum SearchTableType {
|
||||
Raw = 'raw',
|
||||
Spans = 'spans',
|
||||
Traces = 'traces',
|
||||
}
|
||||
|
||||
@@ -529,11 +529,25 @@ export function formatTraceQLResponse(
|
||||
instanceSettings: DataSourceInstanceSettings,
|
||||
tableType?: SearchTableType
|
||||
) {
|
||||
if (tableType === SearchTableType.Spans) {
|
||||
switch (tableType) {
|
||||
case SearchTableType.Spans:
|
||||
return createTableFrameFromTraceQlQueryAsSpans(data, instanceSettings);
|
||||
}
|
||||
case SearchTableType.Raw:
|
||||
return createDataFrameFromTraceQlQuery(data);
|
||||
default:
|
||||
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)] }],
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create data frame while adding spans for each trace into a subtable.
|
||||
|
||||
Reference in New Issue
Block a user