Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Oct 24, 2025

What does this PR do?

Makes the prometheus metrics input we use to collect otel collector metrics always run inside said otel collector, even if the user configures self-monitoring to run in beats processes.

Why is it important?

This input can't run in a beats process because it requires an environment variable which we only set for the otel collector. Fixing this properly would require significant additional work, and we're planning to collect these metrics in a much more robust way in 9.3.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in ./changelog/fragments using the changelog tool
    - [ ] I have added an integration test or an E2E test

How to test this PR locally

Build the agent locally and run it with self-monitoring in process mode and an input in otel mode. For example:

agent:
  logging:
    to_stderr: true
    level: debug
  monitoring:
    _runtime_experimental: process
inputs:
- data_stream:
    namespace: default
  id: unique-system-metrics-input
  streams:
  - data_stream:
      dataset: system.cpu
    metricsets:
    - cpu
  type: system/metrics
  use_output: default
  _runtime_experimental: otel
outputs:
  default:
    username: elastic
    password: xxxxx
    hosts:
    - 127.0.0.1:9200
    type: elasticsearch

Then check status. There should be a prometheus/metrics-monitoring component running as a beat receiver:

{
    "id": "prometheus/metrics-monitoring",
    "name": "prometheus/metrics",
    "state": 2,
    "message": "HEALTHY",
    "units": [
        {
            "unit_id": "prometheus/metrics-monitoring",
            "unit_type": 1,
            "state": 2,
            "message": "Healthy"
        },
        {
            "unit_id": "prometheus/metrics-monitoring-metrics-monitoring-collector",
            "unit_type": 0,
            "state": 2,
            "message": "Healthy",
            "payload": {
                "streams": {
                    "metrics-monitoring-collector": {
                        "error": "",
                        "status": "HEALTHY"
                    }
                }
            }
        }
    ],
    "version_info": {
        "name": "beats-receiver",
        "meta": {
            "build_time": "2025-10-24 17:36:57 +0000 UTC",
            "commit": "66155e4093dcf38ab0e446f83f40ca449c73eb10"
        }
    }
}

Related issues


This is an automatic backport of pull request #10819 done by [Mergify](https://mergify.com).

@mergify mergify bot added the backport label Oct 24, 2025
@mergify mergify bot requested a review from a team as a code owner October 24, 2025 19:50
@mergify mergify bot requested review from blakerouse and pkoutsovasilis and removed request for a team October 24, 2025 19:50
@mergify mergify bot added the backport label Oct 24, 2025
@github-actions github-actions bot added bug Something isn't working skip-changelog labels Oct 24, 2025
@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

cc @swiatekm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants