UNPKG

@spalger/kibana

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

58 lines (52 loc) 1.61 kB
define(function (require) { var _ = require('lodash'); var reqRespStatsHTML = require('plugins/spyModes/reqRespStatsSpyMode.html'); var linkReqRespStats = function ($scope, config) { $scope.$bind('req', 'searchSource.history[searchSource.history.length - 1]'); $scope.$watchMulti([ 'req', 'req.started', 'req.stopped', 'searchSource' ], function () { if (!$scope.searchSource || !$scope.req) return; var req = $scope.req; var resp = $scope.req.resp; var stats = $scope.stats = []; if (resp && resp.took != null) stats.push(['Query Duration', resp.took + 'ms']); if (req && req.ms != null) stats.push(['Request Duration', req.ms + 'ms']); if (resp && resp.hits) stats.push(['Hits', resp.hits.total]); if (req.fetchParams.index) stats.push(['Index', req.fetchParams.index]); if (req.fetchParams.type) stats.push(['Type', req.fetchParams.type]); if (req.fetchParams.id) stats.push(['Id', req.fetchParams.id]); }); }; require('ui/registry/spy_modes') .register(function () { return { name: 'request', display: 'Request', order: 2, template: reqRespStatsHTML, link: linkReqRespStats }; }) .register(function () { return { name: 'response', display: 'Response', order: 3, template: reqRespStatsHTML, link: linkReqRespStats }; }) .register(function () { return { name: 'stats', display: 'Statistics', order: 4, template: reqRespStatsHTML, link: linkReqRespStats }; }); });