Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live: Fix live streaming with live-service-web-worker feature flag enabled #55528

Merged
merged 1 commit into from Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/app/features/live/centrifuge/service.ts
Expand Up @@ -18,14 +18,14 @@ import {
StreamingFrameOptions,
} from '@grafana/runtime/src/services/live';
import { BackendDataSourceResponse } from '@grafana/runtime/src/utils/queryResponse';
import { loadUrlToken } from 'app/core/utils/urlToken';

import { StreamingResponseData } from '../data/utils';

import { LiveDataStream } from './LiveDataStream';
import { CentrifugeLiveChannel } from './channel';

export type CentrifugeSrvDeps = {
grafanaAuthToken: string | null;
appUrl: string;
orgId: number;
orgRole: string;
Expand Down Expand Up @@ -70,7 +70,7 @@ export class CentrifugeService implements CentrifugeSrv {

let liveUrl = `${deps.appUrl.replace(/^http/, 'ws')}/api/live/ws`;

const token = loadUrlToken();
const token = deps.grafanaAuthToken;
if (token !== null && token !== '') {
liveUrl += '?auth_token=' + token;
}
Expand Down
2 changes: 2 additions & 0 deletions public/app/features/live/index.ts
Expand Up @@ -2,6 +2,7 @@ import { config, getBackendSrv, getGrafanaLiveSrv, setGrafanaLiveSrv } from '@gr
import { liveTimer } from 'app/features/dashboard/dashgrid/liveTimer';

import { contextSrv } from '../../core/services/context_srv';
import { loadUrlToken } from '../../core/utils/urlToken';

import { CentrifugeService } from './centrifuge/service';
import { CentrifugeServiceWorkerProxy } from './centrifuge/serviceWorkerProxy';
Expand All @@ -22,6 +23,7 @@ export function initGrafanaLive() {
liveEnabled: config.liveEnabled,
sessionId,
dataStreamSubscriberReadiness: liveTimer.ok.asObservable(),
grafanaAuthToken: loadUrlToken(),
};

const centrifugeSrv = config.featureToggles['live-service-web-worker']
Expand Down