在Grafana中,我从我的InfluxDB数据库中添加了数据源。按下按钮测试时:数据源正在工作。当我在grafana中创建图表并进行查询时,我什么也看不见。该图显示:没有数据点。有什么东西我忘记了吗?我用这个查询创建了我自己的数据库mydb一个帖子数据:{
readmeSearch.controller('ReadMeSearchController', ['RepoSearch', 'ReadMeSearch', '$q', function(RepoSearch, ReadMeSearch, $q) {
var self = this;
var gitRepoNameDefer;
var noReadMesDefer;
self.gitRepoNames = [];
self.readMes = [];
self.noReadMes = [];
self.doSearch = function() {
RepoSearch.query(self.username)
.then(function(repoResponse) {
gitRepoNameDefer = $q.defer();
noReadMesDefer = $q.defer();
addRepoNames(repoResponse);
for(var i = 0; i< self.gitRepoNames.length; i++) {
(function(i) {
ReadMeSearch.query(self.username, self.gitRepoNames[i])
.then(function(readMeResponse) {
addToReposWithReadMes(readMeResponse, i);
}).catch(function(e){
addToReposWithoutReadMes(repoResponse, i);
}).finally(function () {
finishDefers(i, self.gitRepoNames.length - 1);
});
})(i);
}
$q.all([gitRepoNameDefer, noReadMesDefer ]).then(fucntion () {
percentageOfReposWithReadMes();
});
});
};
addRepoNames = function(response) {
self.searchResult = response.data;
for(var i = 0; i < self.searchResult.length; i++) {
var name = self.searchResult[i]['name']
self.gitRepoNames.push(name);
};
};
addToReposWithReadMes = function(response, i) {
self.readMes.push(
{
name: self.gitRepoNames[i],
size: parseInt(response.data["size"]),
url: response.data["html_url"]
}
);
};
addToReposWithoutReadMes = function(response, i) {
self.noReadMes.push(
{
name: self.gitRepoNames[i]
}
);
};
function finishDefers (index, limit) {
if (index === limit) {
gitRepoNameDefer.resolve(self.readMes);
noReadMesDefer.resolve(self.noReadMes);
}
}
function percentageOfReposWithReadMes () {
var percentage;
percentage = (self.noReadMes.length / self.gitRepoNames.length) * 100
self.readMePercentage = percentage.toFixed(1);
};
}]);
在grafana中,我使用此查询: "database": "mydb",
"points": [
{
"name": "cpu",
"fields":{
"value": 100
}
}
]
}
我在今天添加时间范围。当我用鼠标移动时,我会看到一个工具提示,其中包含最后添加到数据库的数据。