mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[server/stats] add server.getKibanaStats() for programatic access (#13411)
This commit is contained in:
parent
db4eb64aef
commit
12142da71b
1 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,21 @@
|
|||
import { getStats } from './stats';
|
||||
|
||||
export function statsMixin(kbnServer, server) {
|
||||
|
||||
/**
|
||||
* Get a summary about the number of objects in the kibana index
|
||||
* @name server.getKibanaStats
|
||||
* @param {Object} options
|
||||
* @property {Function} options.callCluster method for calling the elasticsearch cluster
|
||||
*/
|
||||
server.decorate('server', 'getKibanaStats', async ({ callCluster }) => {
|
||||
const savedObjectsClient = server.savedObjectsClientFactory({ callCluster });
|
||||
return await getStats(
|
||||
server.config().get('kibana.index'),
|
||||
savedObjectsClient
|
||||
);
|
||||
});
|
||||
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: '/api/stats',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue