Skip to content

Allow switching inputs to the otel runtime manager#7328

Merged
swiatekm merged 8 commits intomainfrom
feat/otel-runtime-input-config
Mar 19, 2025
Merged

Allow switching inputs to the otel runtime manager#7328
swiatekm merged 8 commits intomainfrom
feat/otel-runtime-input-config

Conversation

@swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Mar 11, 2025

What does this PR do?

Allows switching individual inputs to the Otel runtime manager. This is done by introducing a new configuration field: _runtime_experimental with possible values of process (the default) and otel. It is no longer necessary to modify agent code and build a local binary to run inputs as beats receivers in an otel collector.

This change is only intended for testing, and the configuration is not stable. See https://github.com/elastic/ingest-dev/issues/5117 for more details. Its only effect on users not opting in to using the otel runtime is that diagnostics now unconditionally emit an additional file containing the final otel collector configuration.

In terms of implementation, we add a new field to Components in the component model, and ensure inputs with a different runtime manager setting end up in different Components.

Why is it important?

It will make testing beats receivers in agent a lot easier. The component model machinery is also easy to repurpose even if we ultimately decide this needs to be configured differently.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an integration test or an E2E test

How to test this PR locally

Build the agent binary and use the following configuration:

outputs:
  default:
    type: elasticsearch
    hosts: [localhost:9200]
    username: elastic
    password: ""
    preset: "balanced"

inputs:
  # Collecting log files
  - type: filestream
    # Input ID allowing Elastic Agent to track the state of this input. Must be unique.
    id: your-input-id
    use_output: default
    _runtime_experimental: otel
    streams:
      - id: input2
        data_stream:
          dataset: myfile
        paths:
          - /tmp/input.txt
        prospector.scanner.fingerprint.enabled: false
        file_identity.native: ~

Related issues

Implements the agent part of https://github.com/elastic/ingest-dev/issues/5117. It's possible the actual config key and values will change, but the changes to the component model should be universal.

@swiatekm swiatekm added enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-8.x Automated backport to the 8.x branch with mergify labels Mar 11, 2025
@swiatekm swiatekm force-pushed the feat/otel-runtime-input-config branch 3 times, most recently from b60be2f to d238651 Compare March 12, 2025 11:11
@swiatekm swiatekm marked this pull request as ready for review March 12, 2025 12:58
@swiatekm swiatekm requested a review from a team as a code owner March 12, 2025 12:58
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@pkoutsovasilis pkoutsovasilis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the following is the case

This change is only intended for testing, and the configuration is not stable. See https://github.com/elastic/ingest-dev/issues/5117 for more details. Its only effect on users not opting in to using the otel runtime is that diagnostics now unconditionally emit an additional file containing the final otel collector configuration.

any reason we aren't guarding this behind a Feature Flag? cc @cmacknz

@swiatekm
Copy link
Contributor Author

since the following is the case

This change is only intended for testing, and the configuration is not stable. See elastic/ingest-dev#5117 for more details. Its only effect on users not opting in to using the otel runtime is that diagnostics now unconditionally emit an additional file containing the final otel collector configuration.

any reason we aren't guarding this behind a Feature Flag? cc @cmacknz

I'm not against adding an undocumented feature flag for it. I was trying to minimize the set of changes I'd potentially need to redo in the future, but a flag isn't that much work.

@swiatekm swiatekm force-pushed the feat/otel-runtime-input-config branch 2 times, most recently from a9650a9 to 88fa83b Compare March 17, 2025 16:38
@swiatekm
Copy link
Contributor Author

swiatekm commented Mar 17, 2025

since the following is the case

This change is only intended for testing, and the configuration is not stable. See elastic/ingest-dev#5117 for more details. Its only effect on users not opting in to using the otel runtime is that diagnostics now unconditionally emit an additional file containing the final otel collector configuration.

any reason we aren't guarding this behind a Feature Flag? cc @cmacknz

We discussed this during a meeting today, and decided on the following:

  • We don't need a flag specifically to enable the new setting at all, but we decided to make it less accessible. It's now called _runtime_experimental to discourage accidental use.
  • We do want to have a feature flag controlling the default runtime, but that can come in a separate PR.

Are you ok with this approach @pkoutsovasilis ?

@pkoutsovasilis
Copy link
Contributor

We discussed this during a meeting today, and decided on the following:

  • We don't need a flag specifically to enable the new setting at all, but we decided to make it less accessible. It's now called _runtime_experimental to discourage accidental use.
  • We do want to have a feature flag controlling the default runtime, but that can come in a separate PR.

Are you ok with this approach @pkoutsovasilis ?

ok @swiatekm since this was discussed and agreed to be in this way, no argument on my end. Waiting for the CI to be green 🙂

@swiatekm swiatekm force-pushed the feat/otel-runtime-input-config branch from ca54854 to 173efa6 Compare March 18, 2025 13:23
@swiatekm swiatekm force-pushed the feat/otel-runtime-input-config branch from 173efa6 to 6259aec Compare March 18, 2025 16:20
Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
@elastic-sonarqube
Copy link

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

cc @swiatekm

@swiatekm swiatekm requested a review from pkoutsovasilis March 18, 2025 20:53
@swiatekm swiatekm merged commit 18d8dff into main Mar 19, 2025
12 checks passed
@swiatekm swiatekm deleted the feat/otel-runtime-input-config branch March 19, 2025 10:35
mergify bot pushed a commit that referenced this pull request Mar 19, 2025
* Add runtime manager field to component model

* Store runtime manager value on the Component level

* Support component runtime manager in coordinator

* Change `runtime` to `_runtime_experimental`

* Log component ids using the otel runtime

* Fix integration test

* Make component ordering consistent

* Fix slice allocation

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 18d8dff)
swiatekm added a commit that referenced this pull request Mar 19, 2025
* Add runtime manager field to component model

* Store runtime manager value on the Component level

* Support component runtime manager in coordinator

* Change `runtime` to `_runtime_experimental`

* Log component ids using the otel runtime

* Fix integration test

* Make component ordering consistent

* Fix slice allocation

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 18d8dff)

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
@swiatekm swiatekm added backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch labels Apr 24, 2025
mergify bot pushed a commit that referenced this pull request Apr 24, 2025
* Add runtime manager field to component model

* Store runtime manager value on the Component level

* Support component runtime manager in coordinator

* Change `runtime` to `_runtime_experimental`

* Log component ids using the otel runtime

* Fix integration test

* Make component ordering consistent

* Fix slice allocation

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 18d8dff)

# Conflicts:
#	internal/pkg/agent/application/coordinator/coordinator.go
#	internal/pkg/agent/application/coordinator/coordinator_unit_test.go
#	testing/integration/otel_test.go
mergify bot pushed a commit that referenced this pull request Apr 24, 2025
* Add runtime manager field to component model

* Store runtime manager value on the Component level

* Support component runtime manager in coordinator

* Change `runtime` to `_runtime_experimental`

* Log component ids using the otel runtime

* Fix integration test

* Make component ordering consistent

* Fix slice allocation

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 18d8dff)
swiatekm added a commit that referenced this pull request Apr 25, 2025
* Add runtime manager field to component model

* Store runtime manager value on the Component level

* Support component runtime manager in coordinator

* Change `runtime` to `_runtime_experimental`

* Log component ids using the otel runtime

* Fix integration test

* Make component ordering consistent

* Fix slice allocation

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 18d8dff)
swiatekm added a commit that referenced this pull request Apr 25, 2025
* Add runtime manager field to component model

* Store runtime manager value on the Component level

* Support component runtime manager in coordinator

* Change `runtime` to `_runtime_experimental`

* Log component ids using the otel runtime

* Fix integration test

* Make component ordering consistent

* Fix slice allocation

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>

---------

Co-authored-by: Panos Koutsovasilis <panos.koutsovasilis@elastic.co>
(cherry picked from commit 18d8dff)

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.x Automated backport to the 8.x branch with mergify backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch enhancement New feature or request skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants