@@ -6,9 +6,15 @@ import {
66 DataSourceInstanceSettings ,
77 DataSourceJsonData ,
88} from '@grafana/data' ;
9- import { BackendDataSourceResponse , DataSourceWithBackend , config , getBackendSrv , toDataQueryResponse } from '@grafana/runtime' ;
9+ import {
10+ BackendDataSourceResponse ,
11+ DataSourceWithBackend ,
12+ config ,
13+ getBackendSrv ,
14+ toDataQueryResponse ,
15+ } from '@grafana/runtime' ;
1016import { merge , Observable , of } from 'rxjs' ;
11- import { catchError , map } from 'rxjs/operators' ;
17+ import { catchError , map } from 'rxjs/operators' ;
1218import { getRequestLooper } from './requestLooper' ;
1319
1420export interface CustomMeta {
@@ -38,9 +44,11 @@ export class DatasourceWithAsyncBackend<
3844 private runningQueries : { [ hash : string ] : RunningQueryInfo } = { } ;
3945 private requestCounter = 100 ;
4046 private asyncQueryDataSupport : boolean ;
47+ private requestIdPrefix : number ;
4148
4249 constructor ( instanceSettings : DataSourceInstanceSettings < TOptions > , asyncQueryDataSupport = false ) {
4350 super ( instanceSettings ) ;
51+ this . requestIdPrefix = instanceSettings . id ;
4452 this . asyncQueryDataSupport = asyncQueryDataSupport ;
4553 }
4654
@@ -85,7 +93,7 @@ export class DatasourceWithAsyncBackend<
8593 let allData : DataFrame [ ] = [ ] ;
8694
8795 return getRequestLooper (
88- { ...request , targets : [ target ] , requestId : `aws_ts_ ${ this . requestCounter ++ } ` } ,
96+ { ...request , targets : [ target ] , requestId : `${ this . requestIdPrefix } _ ${ this . requestCounter ++ } ` } ,
8997 {
9098 /**
9199 * Additional query to execute if the current query is still in a running state
@@ -136,7 +144,8 @@ export class DatasourceWithAsyncBackend<
136144 } ;
137145
138146 let headers = { } ;
139- const cachingDisabled = ! config . featureToggles . useCachingService || ! config . featureToggles . awsAsyncQueryCaching
147+ const cachingDisabled =
148+ ! config . featureToggles . useCachingService || ! config . featureToggles . awsAsyncQueryCaching ;
140149 if ( cachingDisabled && isRunning ( status ) ) {
141150 // bypass query caching for Grafana Enterprise to
142151 // prevent an infinite loop
@@ -152,9 +161,12 @@ export class DatasourceWithAsyncBackend<
152161
153162 return getBackendSrv ( )
154163 . fetch < BackendDataSourceResponse > ( options )
155- . pipe ( map ( ( result ) => ( { data : toDataQueryResponse ( result ) . data } ) ) , catchError ( ( err ) => {
156- return of ( toDataQueryResponse ( err ) ) ;
157- } ) ) ;
164+ . pipe (
165+ map ( ( result ) => ( { data : toDataQueryResponse ( result ) . data } ) ) ,
166+ catchError ( ( err ) => {
167+ return of ( toDataQueryResponse ( err ) ) ;
168+ } )
169+ ) ;
158170 } ,
159171
160172 /**
0 commit comments