Skip to content

Conversation

@swiatekm
Copy link
Contributor

@swiatekm swiatekm commented Nov 3, 2025

What does this PR do?

Allows otel component configurations generated from output configuration to be overridden. In the output configuration, we have a new optional otel section:

outputs:
  default:
    type: elasticsearch
    hosts: [127.0.0.1:9200]
    api_key: "example-key"
    otel:
      extensions:
        beatsauth:
          timeout: "60s"
      exporter:
        include_source_on_error: true

otel.extensions.<extension_name> contains configuration for the generated extension, while otel.exporter, for the exporter.

These configurations are merged into the generated configuration and take precedence over it. There aren't any validity checks here, so the feature should be used with care. It's only intended as a stopgap measure to mitigate unforeseen problems.

Why is it important?

If it turns out there's an issue with the configuration translation, we want to have an escape hatch to mitigate it for affected customers.

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 package, then run it with the following configuration:

agent:
  logging:
    to_stderr: true
    level: debug
  monitoring:
    enabled: false
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: placeholder
    hosts:
    - 127.0.0.1:9200
    type: elasticsearch
    otel:
      exporter:
        sending_queue:
          queue_size: 50
      extensions:
        beatsauth:
          timeout: "60s"

Then collect diagnostics and look at the final otel configuration. It should contain the output overrides.

Related issues

@swiatekm swiatekm changed the title Feat/override exporter config Allow overriding otel exporter and extension configuration for outputs Nov 3, 2025
@mergify
Copy link
Contributor

mergify bot commented Nov 3, 2025

This pull request does not have a backport label. Could you fix it @swiatekm? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label that automatically backports to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@swiatekm swiatekm added skip-changelog backport-9.2 Automated backport to the 9.2 branch backport-8.19 Automated backport to the 8.19 branch enhancement New feature or request labels Nov 3, 2025
@swiatekm swiatekm marked this pull request as ready for review November 3, 2025 14:39
@swiatekm swiatekm requested a review from a team as a code owner November 3, 2025 14:39
@swiatekm swiatekm added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Nov 3, 2025
@elasticmachine
Copy link
Contributor

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

@swiatekm swiatekm requested review from cmacknz and leehinman November 3, 2025 15:13
leehinman
leehinman previously approved these changes Nov 3, 2025
Copy link
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

Thank You. I really like how straight forward this is.

@cmacknz
Copy link
Member

cmacknz commented Nov 3, 2025

You can Unskip the test below now after enabling telemetry::log_failed_doc_input using this override feature and it should pass.

// TestSensitiveLogsESExporter tests sensitive logs from ex-exporter are not sent to fleet
func TestSensitiveLogsESExporter(t *testing.T) {
// The ES exporter logs the original document on indexing failure only if
// the "telemetry::log_failed_docs_input" setting is enabled and the log level is set to debug.
info := define.Require(t, define.Requirements{
Group: integration.Default,
Local: true,
Sudo: true,
OS: []define.OS{
{Type: define.Windows},
{Type: define.Linux},
{Type: define.Darwin},
},
Stack: &define.Stack{},
})
t.Skip("Enable this test after https://github.com/elastic/elastic-agent/issues/10423 is implemented with appropriate config")

@swiatekm swiatekm force-pushed the feat/override-exporter-config branch from ddaf99f to 42658df Compare November 3, 2025 16:07
@swiatekm swiatekm requested a review from leehinman November 3, 2025 17:45
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @swiatekm

Copy link
Member

@cmacknz cmacknz left a comment

Choose a reason for hiding this comment

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

Tested locally, works as expected. Thanks!

@cmacknz cmacknz merged commit c392f7e into main Nov 3, 2025
21 checks passed
@cmacknz cmacknz deleted the feat/override-exporter-config branch November 3, 2025 21:13
mergify bot pushed a commit that referenced this pull request Nov 3, 2025
#10992)

* Allow overriding otel exporter config

* Allow overriding otel output extension config

* Unskip integration test with override

(cherry picked from commit c392f7e)
mergify bot pushed a commit that referenced this pull request Nov 3, 2025
#10992)

* Allow overriding otel exporter config

* Allow overriding otel output extension config

* Unskip integration test with override

(cherry picked from commit c392f7e)
cmacknz pushed a commit that referenced this pull request Nov 4, 2025
#10992) (#11003)

* Allow overriding otel exporter config

* Allow overriding otel output extension config

* Unskip integration test with override

(cherry picked from commit c392f7e)

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
swiatekm added a commit that referenced this pull request Nov 4, 2025
#10992) (#11002)

* Allow overriding otel exporter config

* Allow overriding otel output extension config

* Unskip integration test with override

(cherry picked from commit c392f7e)

Co-authored-by: Mikołaj Świątek <mail@mikolajswiatek.com>
hayotbisonai pushed a commit to hayotbisonai/elastic-agent that referenced this pull request Nov 23, 2025
elastic#10992)

* Allow overriding otel exporter config

* Allow overriding otel output extension config

* Unskip integration test with override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.2 Automated backport to the 9.2 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.

[beats receivers] Allow specifying and preserving exporter configuration in Elastic Agent outputs that is preserved through configuration translation

5 participants