Live: Simplify live interface (#33196)
This commit is contained in:
@@ -13,9 +13,8 @@ import {
|
||||
} from '@grafana/data';
|
||||
import { merge, Observable, of } from 'rxjs';
|
||||
import { catchError, switchMap } from 'rxjs/operators';
|
||||
import { getBackendSrv, getDataSourceSrv } from '../services';
|
||||
import { getBackendSrv, getDataSourceSrv, getGrafanaLiveSrv } from '../services';
|
||||
import { BackendDataSourceResponse, toDataQueryResponse } from './queryResponse';
|
||||
import { getLiveDataStream } from './liveQuery';
|
||||
|
||||
const ExpressionDatasourceID = '__expr__';
|
||||
|
||||
@@ -223,6 +222,11 @@ export function toStreamingDataResponse(
|
||||
request: DataQueryRequest,
|
||||
rsp: DataQueryResponse
|
||||
): Observable<DataQueryResponse> {
|
||||
const live = getGrafanaLiveSrv();
|
||||
if (!live) {
|
||||
return of(rsp); // add warning?
|
||||
}
|
||||
|
||||
const buffer: StreamingFrameOptions = {
|
||||
maxLength: request.maxDataPoints ?? 500,
|
||||
};
|
||||
@@ -238,7 +242,7 @@ export function toStreamingDataResponse(
|
||||
const addr = parseLiveChannelAddress(frame.meta?.channel);
|
||||
if (addr) {
|
||||
streams.push(
|
||||
getLiveDataStream({
|
||||
live.getDataStream({
|
||||
addr,
|
||||
buffer,
|
||||
frame: frame as DataFrame,
|
||||
|
||||
Reference in New Issue
Block a user