mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
6a3ba80309
commit
2ff1156891
4 changed files with 71 additions and 7 deletions
|
@ -6,7 +6,6 @@
|
|||
"src/plugins/kibana_react/",
|
||||
"src/plugins/testbed/",
|
||||
"src/plugins/kibana_utils/",
|
||||
"src/plugins/kibana_usage_collection/server/collectors/kibana/kibana_usage_collector.ts",
|
||||
"src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts",
|
||||
"src/plugins/kibana_usage_collection/server/collectors/ui_metric/telemetry_ui_metric_collector.ts",
|
||||
"src/plugins/telemetry/server/collectors/usage/telemetry_usage_collector.ts"
|
||||
|
|
|
@ -39,9 +39,12 @@ const TYPES = [
|
|||
];
|
||||
|
||||
export interface KibanaSavedObjectCounts {
|
||||
[pluginName: string]: {
|
||||
total: number;
|
||||
};
|
||||
dashboard: { total: number };
|
||||
visualization: { total: number };
|
||||
search: { total: number };
|
||||
index_pattern: { total: number };
|
||||
graph_workspace: { total: number };
|
||||
timelion_sheet: { total: number };
|
||||
}
|
||||
|
||||
export async function getSavedObjectsCounts(
|
||||
|
@ -71,7 +74,7 @@ export async function getSavedObjectsCounts(
|
|||
// Initialise the object with all zeros for all the types
|
||||
const allZeros: KibanaSavedObjectCounts = TYPES.reduce(
|
||||
(acc, type) => ({ ...acc, [snakeCase(type)]: { total: 0 } }),
|
||||
{}
|
||||
{} as KibanaSavedObjectCounts
|
||||
);
|
||||
|
||||
// Add the doc_count from each bucket
|
||||
|
|
|
@ -22,15 +22,28 @@ import { take } from 'rxjs/operators';
|
|||
import { SharedGlobalConfig } from 'kibana/server';
|
||||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
||||
import { KIBANA_STATS_TYPE } from '../../../common/constants';
|
||||
import { getSavedObjectsCounts } from './get_saved_object_counts';
|
||||
import { getSavedObjectsCounts, KibanaSavedObjectCounts } from './get_saved_object_counts';
|
||||
|
||||
interface KibanaUsage extends KibanaSavedObjectCounts {
|
||||
index: string;
|
||||
}
|
||||
|
||||
export function getKibanaUsageCollector(
|
||||
usageCollection: UsageCollectionSetup,
|
||||
legacyConfig$: Observable<SharedGlobalConfig>
|
||||
) {
|
||||
return usageCollection.makeUsageCollector({
|
||||
return usageCollection.makeUsageCollector<KibanaUsage, { usage: KibanaUsage }>({
|
||||
type: 'kibana',
|
||||
isReady: () => true,
|
||||
schema: {
|
||||
index: { type: 'keyword' },
|
||||
dashboard: { total: { type: 'long' } },
|
||||
visualization: { total: { type: 'long' } },
|
||||
search: { total: { type: 'long' } },
|
||||
index_pattern: { total: { type: 'long' } },
|
||||
graph_workspace: { total: { type: 'long' } },
|
||||
timelion_sheet: { total: { type: 'long' } },
|
||||
},
|
||||
async fetch(callCluster) {
|
||||
const {
|
||||
kibana: { index },
|
||||
|
|
|
@ -1297,6 +1297,55 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"kibana": {
|
||||
"properties": {
|
||||
"index": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"dashboard": {
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"visualization": {
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"index_pattern": {
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"graph_workspace": {
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timelion_sheet": {
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"telemetry": {
|
||||
"properties": {
|
||||
"opt_in_status": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue