Tempo: TraceQL query response streaming (#69212)

* Refactor Tempo datasource backend to support multiple queryData types.
Added traceId query type that is set when performing the request but doesn't map to a tab.

* WIP data is reaching the frontend

* WIP

* Use channels and goroutines

* Some fixes

* Simplify backend code.
Return traces, metrics, state and error in a dataframe.
Shared state type between FE and BE.
Use getStream() instead of getQueryData()

* Handle errors in frontend

* Update Tempo and use same URL for RPC and HTTP

* Cleanup backend code

* Merge main

* Create grpc client only with host and authenticate

* Create grpc client only with host and authenticate

* Cleanup

* Add streaming to TraceQL Search tab

* Fix merge conflicts

* Added tests for processStream

* make gen-cue

* make gen-cue

* goimports

* lint

* Cleanup go.mod

* Comments

* Addressing PR comments

* Fix streaming for tracel search tab

* Added streaming kill switch as the disableTraceQLStreaming feature toggle

* Small comment

* Fix conflicts

* Correctly capture and send all errors as a DF to client

* Fix infinite error loop

* Fix merge conflicts

* Fix test

* Update deprecated import

* Fix feature toggles gen

* Fix merge conflicts
This commit is contained in:
Andre Pereira
2023-07-14 15:10:46 +01:00
committed by GitHub
parent fb2a57d3a3
commit c1709c9301
27 changed files with 1802 additions and 401 deletions
@@ -47,6 +47,10 @@ export interface TempoQuery extends common.DataQuery {
* Query traces by span name
*/
spanName?: string;
/**
* Use the streaming API to get partial results as they are available
*/
streaming?: boolean;
}
export const defaultTempoQuery: Partial<TempoQuery> = {
@@ -56,7 +60,17 @@ export const defaultTempoQuery: Partial<TempoQuery> = {
/**
* search = Loki search, nativeSearch = Tempo search for backwards compatibility
*/
export type TempoQueryType = ('traceql' | 'traceqlSearch' | 'search' | 'serviceMap' | 'upload' | 'nativeSearch' | 'clear');
export type TempoQueryType = ('traceql' | 'traceqlSearch' | 'search' | 'serviceMap' | 'upload' | 'nativeSearch' | 'traceId' | 'clear');
/**
* The state of the TraceQL streaming search query
*/
export enum SearchStreamingState {
Done = 'done',
Error = 'error',
Pending = 'pending',
Streaming = 'streaming',
}
/**
* static fields are pre-set in the UI, dynamic fields are added by the user