Skip to content

Commit

Permalink
[Usage Collection] [schema] infra
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Sep 28, 2020
1 parent 88df93b commit eff68f5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
1 change: 0 additions & 1 deletion x-pack/.telemetryrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"plugins/alerts/server/usage/alerts_usage_collector.ts",
"plugins/apm/server/lib/apm_telemetry/index.ts",
"plugins/canvas/server/collectors/collector.ts",
"plugins/infra/server/usage/usage_collector.ts",
"plugins/reporting/server/usage/reporting_usage_collector.ts",
"plugins/maps/server/maps_telemetry/collectors/register.ts"
]
Expand Down
23 changes: 22 additions & 1 deletion x-pack/plugins/infra/server/usage/usage_collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,40 @@ interface InfraopsSum {
logs: number;
}

interface Usage {
last_24_hours: {
hits: {
infraops_hosts: number;
infraops_docker: number;
infraops_kubernetes: number;
logs: number;
};
};
}

export class UsageCollector {
public static registerUsageCollector(usageCollection: UsageCollectionSetup): void {
const collector = UsageCollector.getUsageCollector(usageCollection);
usageCollection.registerCollector(collector);
}

public static getUsageCollector(usageCollection: UsageCollectionSetup) {
return usageCollection.makeUsageCollector({
return usageCollection.makeUsageCollector<Usage>({
type: 'infraops',
isReady: () => true,
fetch: async () => {
return this.getReport();
},
schema: {
last_24_hours: {
hits: {
infraops_hosts: { type: 'long' },
infraops_docker: { type: 'long' },
infraops_kubernetes: { type: 'long' },
logs: { type: 'long' },
},
},
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@
}
}
},
"infraops": {
"properties": {
"last_24_hours": {
"properties": {
"hits": {
"properties": {
"infraops_hosts": {
"type": "long"
},
"infraops_docker": {
"type": "long"
},
"infraops_kubernetes": {
"type": "long"
},
"logs": {
"type": "long"
}
}
}
}
}
}
},
"ingest_manager": {
"properties": {
"fleet_enabled": {
Expand Down

0 comments on commit eff68f5

Please sign in to comment.