Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with incorrect policy response attachment. #113430

Merged
merged 6 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class TelemetryReceiver {
policy_responses: {
terms: {
size: this.max_records,
field: 'Endpoint.policy.applied.id',
field: 'agent.id',
},
aggs: {
latest_response: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,11 @@ export class TelemetryEndpointTask {
*
* As the policy id + policy version does not exist on the Endpoint Metrics document
* we need to fetch information about the Fleet Agent and sync the metrics document
* with the Fleet agent's policy data.
* with the Agent's policy data.
*
* 7.14 ~ An issue was created with the Endpoint agent team to add the policy id +
* policy version to the metrics document to circumvent and refactor away from
* this expensive join operation.
*/
const agentsResponse = endpointData.fleetAgentsResponse;

if (agentsResponse === undefined) {
this.logger.debug('no fleet agent information available');
return 0;
Expand Down Expand Up @@ -286,15 +284,14 @@ export class TelemetryEndpointTask {
policyConfig = endpointPolicyCache.get(policyInformation) || null;

if (policyConfig) {
failedPolicy = policyResponses.get(policyConfig?.id);
failedPolicy = policyResponses.get(endpointAgentId);
}
}

const { cpu, memory, uptime } = endpoint.endpoint_metrics.Endpoint.metrics;

return {
'@timestamp': executeTo,
agent_id: fleetAgentId,
endpoint_id: endpointAgentId,
endpoint_version: endpoint.endpoint_version,
endpoint_package_version: policyConfig?.package?.version || null,
Expand Down