Enable functionbeat telemetry (#54267)

* Adding placeholder for functionbeat telemetry in test fixture

* Adding placeholder for functionbeat telemetry expectation

* Adding placeholder for aggregating functionbeat telemetry per cluster

* Update test + fixture

* Updating code
This commit is contained in:
Shaunak Kashyap 2020-01-10 06:16:47 -08:00 committed by GitHub
parent a7a557babe
commit 402322c7a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 0 deletions

View file

@ -2,6 +2,36 @@
{
"hits": {
"hits": [
{
"_source" : {
"cluster_uuid": "W7hppdX7R229Oy3KQbZrTw",
"type": "beats_state",
"beats_state" : {
"state" : {
"functionbeat" : {
"functions": {
"count": 1
}
}
}
}
}
},
{
"_source" : {
"cluster_uuid": "W7hppdX7R229Oy3KQbZrTw",
"type": "beats_state",
"beats_state" : {
"state" : {
"functionbeat" : {
"functions": {
"count": 3
}
}
}
}
}
},
{
"_source" : {
"cluster_uuid": "W7hppdX7R229Oy3KQbZrTw",

View file

@ -168,6 +168,11 @@ describe('Get Beats Stats', () => {
},
monitors: 3,
},
functionbeat: {
functions: {
count: 4,
},
},
},
FlV4ckTxQ0a78hmBkzzc9A: {
count: 405,

View file

@ -138,6 +138,23 @@ export function processResults(
}
}
const functionbeatState = get(hit, '_source.beats_state.state.functionbeat');
if (functionbeatState !== undefined) {
if (!clusters[clusterUuid].hasOwnProperty('functionbeat')) {
clusters[clusterUuid].functionbeat = {
functions: {
count: 0,
},
};
}
clusters[clusterUuid].functionbeat.functions.count += get(
functionbeatState,
'functions.count',
0
);
}
const stateHost = get(hit, '_source.beats_state.state.host');
if (stateHost !== undefined) {
const hostMap = clusterArchitectureMaps[clusterUuid];