mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Live: Fix live streaming with live-service-web-worker
feature flag enabled (#55528)
This commit is contained in:
parent
c18432971b
commit
5a1f004fb1
@ -18,7 +18,6 @@ import {
|
|||||||
StreamingFrameOptions,
|
StreamingFrameOptions,
|
||||||
} from '@grafana/runtime/src/services/live';
|
} from '@grafana/runtime/src/services/live';
|
||||||
import { BackendDataSourceResponse } from '@grafana/runtime/src/utils/queryResponse';
|
import { BackendDataSourceResponse } from '@grafana/runtime/src/utils/queryResponse';
|
||||||
import { loadUrlToken } from 'app/core/utils/urlToken';
|
|
||||||
|
|
||||||
import { StreamingResponseData } from '../data/utils';
|
import { StreamingResponseData } from '../data/utils';
|
||||||
|
|
||||||
@ -26,6 +25,7 @@ import { LiveDataStream } from './LiveDataStream';
|
|||||||
import { CentrifugeLiveChannel } from './channel';
|
import { CentrifugeLiveChannel } from './channel';
|
||||||
|
|
||||||
export type CentrifugeSrvDeps = {
|
export type CentrifugeSrvDeps = {
|
||||||
|
grafanaAuthToken: string | null;
|
||||||
appUrl: string;
|
appUrl: string;
|
||||||
orgId: number;
|
orgId: number;
|
||||||
orgRole: string;
|
orgRole: string;
|
||||||
@ -70,7 +70,7 @@ export class CentrifugeService implements CentrifugeSrv {
|
|||||||
|
|
||||||
let liveUrl = `${deps.appUrl.replace(/^http/, 'ws')}/api/live/ws`;
|
let liveUrl = `${deps.appUrl.replace(/^http/, 'ws')}/api/live/ws`;
|
||||||
|
|
||||||
const token = loadUrlToken();
|
const token = deps.grafanaAuthToken;
|
||||||
if (token !== null && token !== '') {
|
if (token !== null && token !== '') {
|
||||||
liveUrl += '?auth_token=' + token;
|
liveUrl += '?auth_token=' + token;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { config, getBackendSrv, getGrafanaLiveSrv, setGrafanaLiveSrv } from '@gr
|
|||||||
import { liveTimer } from 'app/features/dashboard/dashgrid/liveTimer';
|
import { liveTimer } from 'app/features/dashboard/dashgrid/liveTimer';
|
||||||
|
|
||||||
import { contextSrv } from '../../core/services/context_srv';
|
import { contextSrv } from '../../core/services/context_srv';
|
||||||
|
import { loadUrlToken } from '../../core/utils/urlToken';
|
||||||
|
|
||||||
import { CentrifugeService } from './centrifuge/service';
|
import { CentrifugeService } from './centrifuge/service';
|
||||||
import { CentrifugeServiceWorkerProxy } from './centrifuge/serviceWorkerProxy';
|
import { CentrifugeServiceWorkerProxy } from './centrifuge/serviceWorkerProxy';
|
||||||
@ -22,6 +23,7 @@ export function initGrafanaLive() {
|
|||||||
liveEnabled: config.liveEnabled,
|
liveEnabled: config.liveEnabled,
|
||||||
sessionId,
|
sessionId,
|
||||||
dataStreamSubscriberReadiness: liveTimer.ok.asObservable(),
|
dataStreamSubscriberReadiness: liveTimer.ok.asObservable(),
|
||||||
|
grafanaAuthToken: loadUrlToken(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const centrifugeSrv = config.featureToggles['live-service-web-worker']
|
const centrifugeSrv = config.featureToggles['live-service-web-worker']
|
||||||
|
Loading…
Reference in New Issue
Block a user