mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' of github.com:grafana/grafana
This commit is contained in:
commit
2ed3cd7f1a
@ -15,6 +15,7 @@ function (angular, _, dateMath) {
|
||||
this.withCredentials = instanceSettings.withCredentials;
|
||||
this.basicAuth = instanceSettings.basicAuth;
|
||||
this.supportMetrics = true;
|
||||
this.tagKeys = {};
|
||||
|
||||
// Called once per panel (graph)
|
||||
this.query = function(options) {
|
||||
@ -50,10 +51,13 @@ function (angular, _, dateMath) {
|
||||
if (index === -1) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
this._saveTagKeys(metricData);
|
||||
|
||||
return transformMetricData(metricData, groupByTags, options.targets[index], options);
|
||||
});
|
||||
}.bind(this));
|
||||
return { data: result };
|
||||
});
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
this.performTimeSeriesQuery = function(queries, start, end) {
|
||||
@ -87,6 +91,19 @@ function (angular, _, dateMath) {
|
||||
return backendSrv.datasourceRequest(options);
|
||||
};
|
||||
|
||||
this.suggestTagKeys = function(metric) {
|
||||
return $q.when(this.tagKeys[metric] || []);
|
||||
};
|
||||
|
||||
this._saveTagKeys = function(metricData) {
|
||||
var tagKeys = Object.keys(metricData.tags);
|
||||
_.each(metricData.aggregateTags, function(tag) {
|
||||
tagKeys.push(tag);
|
||||
});
|
||||
|
||||
this.tagKeys[metricData.metric] = tagKeys;
|
||||
};
|
||||
|
||||
this._performSuggestQuery = function(query, type) {
|
||||
return this._get('/api/suggest', {type: type, q: query, max: 1000}).then(function(result) {
|
||||
return result.data;
|
||||
|
@ -50,9 +50,7 @@ export class OpenTsQueryCtrl extends QueryCtrl {
|
||||
};
|
||||
|
||||
this.suggestTagKeys = (query, callback) => {
|
||||
this.datasource.metricFindQuery('suggest_tagk(' + query + ')')
|
||||
.then(this.getTextValues)
|
||||
.then(callback);
|
||||
this.datasource.suggestTagKeys(this.target.metric).then(callback);
|
||||
};
|
||||
|
||||
this.suggestTagValues = (query, callback) => {
|
||||
|
Loading…
Reference in New Issue
Block a user