mirror of
https://github.com/grafana/grafana.git
synced 2024-12-30 10:47:30 -06:00
Tempo: TraceQL streaming improvements (#71736)
* Remove unneeded log * Add elapsed time to streaming progress table * Use disableTraceQLStreaming toggle to determine default status of streaming
This commit is contained in:
parent
fed3c97dc1
commit
72118e372c
@ -2,10 +2,6 @@
|
||||
aliases:
|
||||
- /docs/grafana/latest/setup-grafana/configure-grafana/feature-toggles/
|
||||
description: Learn about feature toggles, which you can enable or disable.
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Configure feature toggles
|
||||
weight: 150
|
||||
---
|
||||
|
@ -59,8 +59,6 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
|
||||
}
|
||||
|
||||
func (s *Service) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
|
||||
s.logger.Info("QueryData called ", "Queries ", req.Queries)
|
||||
|
||||
// create response struct
|
||||
response := backend.NewQueryDataResponse()
|
||||
|
||||
|
@ -37,6 +37,7 @@ export function doTempoChannelStream(
|
||||
|
||||
return defer(() => getLiveStreamKey()).pipe(
|
||||
mergeMap((key) => {
|
||||
const requestTime = performance.now();
|
||||
return getGrafanaLiveSrv()
|
||||
.getStream<MutableDataFrame>({
|
||||
scope: LiveChannelScope.DataSource,
|
||||
@ -53,6 +54,8 @@ export function doTempoChannelStream(
|
||||
.pipe(
|
||||
map((evt) => {
|
||||
if ('message' in evt && evt?.message) {
|
||||
const currentTime = performance.now();
|
||||
const elapsedTime = currentTime - requestTime;
|
||||
// Schema should be [traces, metrics, state, error]
|
||||
const traces = evt.message.data.values[0][0];
|
||||
const metrics = evt.message.data.values[1][0];
|
||||
@ -71,7 +74,7 @@ export function doTempoChannelStream(
|
||||
}
|
||||
|
||||
frames = [
|
||||
metricsDataFrame(metrics, frameState),
|
||||
metricsDataFrame(metrics, frameState, elapsedTime),
|
||||
...createTableFrameFromTraceQlQuery(traces, instanceSettings),
|
||||
];
|
||||
}
|
||||
@ -85,7 +88,7 @@ export function doTempoChannelStream(
|
||||
);
|
||||
}
|
||||
|
||||
function metricsDataFrame(metrics: SearchMetrics, state: SearchStreamingState) {
|
||||
function metricsDataFrame(metrics: SearchMetrics, state: SearchStreamingState, elapsedTime: number) {
|
||||
const progressThresholds: ThresholdsConfig = {
|
||||
steps: [
|
||||
{
|
||||
@ -113,6 +116,15 @@ function metricsDataFrame(metrics: SearchMetrics, state: SearchStreamingState) {
|
||||
displayNameFromDS: 'State',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'elapsedTime',
|
||||
type: FieldType.number,
|
||||
values: [elapsedTime],
|
||||
config: {
|
||||
unit: 'ms',
|
||||
displayNameFromDS: 'Elapsed Time',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'totalBlocks',
|
||||
type: FieldType.number,
|
||||
@ -144,7 +156,7 @@ function metricsDataFrame(metrics: SearchMetrics, state: SearchStreamingState) {
|
||||
state === SearchStreamingState.Done ? 100 : ((metrics.completedJobs || 0) / (metrics.totalJobs || 1)) * 100,
|
||||
],
|
||||
config: {
|
||||
displayNameFromDS: 'Total Jobs',
|
||||
displayNameFromDS: 'Progress',
|
||||
unit: 'percent',
|
||||
min: 0,
|
||||
max: 100,
|
||||
|
@ -19,7 +19,7 @@ export const TempoQueryBuilderOptions = React.memo<Props>(({ onChange, query })
|
||||
}
|
||||
|
||||
if (!query.hasOwnProperty('streaming')) {
|
||||
query.streaming = true;
|
||||
query.streaming = !config.featureToggles.disableTraceQLStreaming;
|
||||
}
|
||||
|
||||
const onLimitChange = (e: React.FormEvent<HTMLInputElement>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user