|
|
|
@ -296,12 +296,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery, |
|
|
|
|
super.query({ |
|
|
|
|
targets: [target], |
|
|
|
|
} as DataQueryRequest) |
|
|
|
|
).then((rsp) => { |
|
|
|
|
if (rsp.data?.length) { |
|
|
|
|
return frameToMetricFindValue(rsp.data[0]); |
|
|
|
|
} |
|
|
|
|
return []; |
|
|
|
|
}); |
|
|
|
|
).then(this.toMetricFindValue); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async metricFindQuery(query: string, options?: any): Promise<MetricFindValue[]> { |
|
|
|
@ -316,12 +311,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery, |
|
|
|
|
...(options ?? {}), // includes 'range'
|
|
|
|
|
targets: [target], |
|
|
|
|
}) |
|
|
|
|
).then((rsp) => { |
|
|
|
|
if (rsp.data?.length) { |
|
|
|
|
return frameToMetricFindValue(rsp.data[0]); |
|
|
|
|
} |
|
|
|
|
return []; |
|
|
|
|
}); |
|
|
|
|
).then(this.toMetricFindValue); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const interpolated = this.templateSrv.replace(query, options?.scopedVars, this.interpolateQueryExpr); |
|
|
|
@ -331,6 +321,14 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
toMetricFindValue(rsp: DataQueryResponse): MetricFindValue[] { |
|
|
|
|
const data = rsp.data ?? []; |
|
|
|
|
// Create MetricFindValue object for all frames
|
|
|
|
|
const values = data.map((d) => frameToMetricFindValue(d)).flat(); |
|
|
|
|
// Filter out duplicate elements
|
|
|
|
|
return values.filter((elm, idx, self) => idx === self.findIndex((t) => t.text === elm.text)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// By implementing getTagKeys and getTagValues we add ad-hoc filters functionality
|
|
|
|
|
// Used in public/app/features/variables/adhoc/picker/AdHocFilterKey.tsx::fetchFilterKeys
|
|
|
|
|
getTagKeys(options?: DataSourceGetTagKeysOptions) { |
|
|
|
|