mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
loki: do not use backend-mode when keepCookies is used (#49222)
This commit is contained in:
parent
78e22aac59
commit
0355772e36
@ -105,6 +105,7 @@ export class LokiDatasource
|
||||
private streams = new LiveStreams();
|
||||
languageProvider: LanguageProvider;
|
||||
maxLines: number;
|
||||
useBackendMode: boolean;
|
||||
|
||||
constructor(
|
||||
private instanceSettings: DataSourceInstanceSettings<LokiOptions>,
|
||||
@ -116,6 +117,9 @@ export class LokiDatasource
|
||||
this.languageProvider = new LanguageProvider(this);
|
||||
const settingsData = instanceSettings.jsonData || {};
|
||||
this.maxLines = parseInt(settingsData.maxLines ?? '0', 10) || DEFAULT_MAX_LINES;
|
||||
const keepCookiesUsed = (settingsData.keepCookies ?? []).length > 0;
|
||||
// only use backend-mode when keep-cookies is not used
|
||||
this.useBackendMode = !keepCookiesUsed && (config.featureToggles.lokiBackendMode ?? false);
|
||||
}
|
||||
|
||||
_request(apiUrl: string, data?: any, options?: Partial<BackendSrvRequest>): Observable<Record<string, any>> {
|
||||
@ -168,7 +172,7 @@ export class LokiDatasource
|
||||
...this.getRangeScopedVars(request.range),
|
||||
};
|
||||
|
||||
if (config.featureToggles.lokiBackendMode) {
|
||||
if (this.useBackendMode) {
|
||||
// we "fix" the loki queries to have `.queryType` and not have `.instant` and `.range`
|
||||
const fixedRequest = {
|
||||
...request,
|
||||
|
@ -57,6 +57,7 @@ export interface LokiOptions extends DataSourceJsonData {
|
||||
maxLines?: string;
|
||||
derivedFields?: DerivedFieldConfig[];
|
||||
alertmanager?: string;
|
||||
keepCookies?: string[];
|
||||
}
|
||||
|
||||
export interface LokiStats {
|
||||
|
Loading…
Reference in New Issue
Block a user