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

Internal monitoring to collector metrics-elastic_agent.elastic_agent-* indices pointlessly collects metrics from all components #7139

Open
cmacknz opened this issue Mar 3, 2025 · 1 comment · May be fixed by #7149
Assignees
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@cmacknz
Copy link
Member

cmacknz commented Mar 3, 2025

We want to fetch only the metrics from elastic agent’s /stats endpoint and write them to metrics-elastic_agent.elastic_agent-* but the input created to do this is in a for loop that iterates over every running agent component with no guarding if condition:

streams = append(streams, map[string]interface{}{
idKey: fmt.Sprintf("%s-%s-1", monitoringMetricsUnitID, name),
"data_stream": map[string]interface{}{
"type": "metrics",
"dataset": fmt.Sprintf("elastic_agent.%s", fixedAgentName),
"namespace": monitoringNamespace,
},
"metricsets": []interface{}{"json"},
"hosts": endpoints,
"path": "/stats",

Compare this the one just above that is specific to Beats, it has an if on the binary name

if isSupportedBeatsBinary(binaryName) {

If you look at the components/http-metrics-monitoring/beat-rendered-config.yaml file in diagnostics you can see all the duplicated http/metrics streams pointing at each Beat for the metrics-elastic_agent.elastic_agent-default data stream that should contain only metrics from the Elastic Agent process itself.

Definition of Done:

  • A test exists proving we only create the minimal set of inputs to collect the monitoring data we need.
  • There is only a single http/metrics input for collecting data from Elastic Agent's /stats input.
@cmacknz cmacknz added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Mar 3, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@khushijain21 khushijain21 self-assigned this Mar 4, 2025
@khushijain21 khushijain21 linked a pull request Mar 4, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants