Graphite Plugin: fix annotation migration regression with ref-ids (#53361)

* fix regression with ref-ids

* remove duplicate check for annotations in fix
This commit is contained in:
Brendan O'Handley 2022-08-08 12:32:35 -04:00 committed by GitHub
parent ba89471598
commit 85db523dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,11 +189,10 @@ export class GraphiteDatasource
} }
query(options: DataQueryRequest<GraphiteQuery>): Observable<DataQueryResponse> { query(options: DataQueryRequest<GraphiteQuery>): Observable<DataQueryResponse> {
if (options.targets.some((target: GraphiteQuery) => target.fromAnnotations)) {
const streams: Array<Observable<DataQueryResponse>> = []; const streams: Array<Observable<DataQueryResponse>> = [];
for (const target of options.targets) { for (const target of options.targets) {
// hiding target is handled in buildGraphiteParams
if (target.fromAnnotations) {
streams.push( streams.push(
new Observable((subscriber) => { new Observable((subscriber) => {
this.annotationEvents(options.range, target) this.annotationEvents(options.range, target)
@ -202,7 +201,11 @@ export class GraphiteDatasource
.finally(() => subscriber.complete()); .finally(() => subscriber.complete());
}) })
); );
} else { }
return merge(...streams);
}
// handle the queries here // handle the queries here
const graphOptions = { const graphOptions = {
from: this.translateTime(options.range.from, false, options.timezone), from: this.translateTime(options.range.from, false, options.timezone),
@ -237,14 +240,7 @@ export class GraphiteDatasource
httpOptions.requestId = this.name + '.panelId.' + options.panelId; httpOptions.requestId = this.name + '.panelId.' + options.panelId;
} }
streams.push(this.doGraphiteRequest(httpOptions).pipe(map(this.convertResponseToDataFrames))); return this.doGraphiteRequest(httpOptions).pipe(map(this.convertResponseToDataFrames));
}
}
if (streams.length === 0) {
return of({ data: [] });
}
return merge(...streams);
} }
addTracingHeaders(httpOptions: { headers: any }, options: { dashboardId?: number; panelId?: number }) { addTracingHeaders(httpOptions: { headers: any }, options: { dashboardId?: number; panelId?: number }) {