Skip to content

Complete OTel configuration pipelines with an exporter#233090

Merged
jsoriano merged 32 commits intoelastic:mainfrom
jsoriano:otel-exporters
Sep 17, 2025
Merged

Complete OTel configuration pipelines with an exporter#233090
jsoriano merged 32 commits intoelastic:mainfrom
jsoriano:otel-exporters

Conversation

@jsoriano
Copy link
Member

@jsoriano jsoriano commented Aug 27, 2025

Summary

Complete composition of OTel configuration pipelines:

  • Merge configuration of multiple inputs in a single configuration.
  • Add a forward connector as exporter for each input pipeline.
  • Generate an exporter configuration based on the assigned data output.
  • Add a pipeline with all the forward connectors as receivers and the generated exporter as exporter.
  • Add a transform processor to each pipeline with the attributes for dynamic routing.

Closes https://github.com/elastic/ingest-dev/issues/5712.

How to test?

Follow instructions in elastic/fleet-server#5469, this branch is also needed.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

Low risk, changes are for an unreleased feature behind a feature flag.

@jsoriano jsoriano self-assigned this Aug 27, 2025
return attachExporter(config, dataOutput);
}

function addSuffixToOtelcolComponentsConfig(type: string, components: {[key:string]:any}, suffix: string) {
Copy link
Member

Choose a reason for hiding this comment

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

TypeScript has a Record<string, any> utility type for objects like this

@jsoriano jsoriano marked this pull request as ready for review September 8, 2025 18:29
@jsoriano jsoriano requested a review from a team as a code owner September 8, 2025 18:29
@jsoriano
Copy link
Member Author

jsoriano commented Sep 8, 2025

Opening for review, from here we need to update fleet-server to inject credentials for the outputs.

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Sep 8, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jsoriano
Copy link
Member Author

jsoriano commented Sep 8, 2025

Fleet Server changes in elastic/fleet-server#5469.

Moving back to draft as we also need to add the dataset fields for routing, as described in https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/elasticsearchexporter/README.md#elasticsearch-document-routing.

@jsoriano jsoriano marked this pull request as draft September 8, 2025 21:05
@jsoriano jsoriano added backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes labels Sep 8, 2025
@jsoriano jsoriano marked this pull request as ready for review September 9, 2025 08:07
@jsoriano
Copy link
Member Author

jsoriano commented Sep 9, 2025

Open again for review.

…icies/otel_collector.ts

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
@jsoriano
Copy link
Member Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

elasticmachine commented Sep 15, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #60 / core plugins rendering service exposes plugin config settings to authenticated users
  • [job] [logs] FTR Configs #60 / core plugins rendering service exposes plugin config settings to authenticated users
  • [job] [logs] FTR Configs #60 / core plugins rendering service exposes plugin config settings to authenticated users
  • [job] [logs] FTR Configs #45 / InfraOps App Metrics UI Home page with metrics present renders the kubernetes tour component and allows user to dismiss it without seeing it again

Metrics [docs]

✅ unchanged

History

cc @jsoriano

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

Code LGTM

context = 'span';
break;
default:
throw new Error(`unexpected data stream type ${type}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe you can use FleetError here

let patchedYaml = yamlFromCompiledTemplate;
if (
experimentalFeature.enableOtelIntegrations &&
inputType === OTEL_COLLECTOR_INPUT_TYPE &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why this check was removed? Was it moved somewhere else?

Copy link
Member Author

@jsoriano jsoriano Sep 16, 2025

Choose a reason for hiding this comment

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

I moved all the logic for processing inputs to generateOtelcolConfig, that is now on its own file.

In part it was because while supporting policies with multiple packages I found that the policy id was not enough as identifier, as there could be several streams of the same kind in the same policy. So the suffix used here later needed to be appended to other ids in generateOtelcolConfig. I found it easier to have everything in the same place, and specially easier to test.

Now generateOtelcolConfig receives the unmodified inputs and takes care of generating the unique ids, merging the configs and attaching the connectors and exporters. We don't need to propagate the ids so much, or modify the compilation step, and everything is encapsulated in the same place.

I wasn't sure about moving this out of the compilation step, not sure if we will be missing something later by doing this.

Regarding the feature flag, in principle it is still checked in https://github.com/elastic/kibana/pull/233090/files#diff-f23ad8d1dbe97e73058031bebb5482e9c4272780c63d5d601a60c867d208a99bL164.

const experimentalFeature = appContextService.getExperimentalFeatures();

return inputs.map((input) => {
if (experimentalFeature.enableOtelIntegrations && input.type === OTEL_COLLECTOR_INPUT_TYPE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Member Author

Choose a reason for hiding this comment

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

Same thing, as I was moving all the id generation to generateOtelcolConfig I removed all the code that was using the otelcolSuffixId in the compile steps.

Though looking here maybe I removed too much, should we ensure that compiled_input is empty for otelcol inputs?

Copy link
Contributor

Choose a reason for hiding this comment

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

I checked with the httpcheck integration and compiled_input is still empty, it shouldn't be an issue regardless.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for checking!

@criamico
Copy link
Contributor

Tested the code locally, the config seems good to me:

Screenshot 2025-09-17 at 09 53 01 Screenshot 2025-09-17 at 09 53 38
Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

LGTM

@jsoriano jsoriano merged commit dbe76e8 into elastic:main Sep 17, 2025
13 checks passed
@jsoriano jsoriano deleted the otel-exporters branch September 17, 2025 08:51
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
- Merge configuration of multiple inputs in a single configuration.
- Add a forward connector as exporter for each input pipeline.
- Generate an exporter configuration based on the assigned data output.
- Add a pipeline with all the forward connectors as receivers and the
  generated exporter as exporter.
- Add a transform processor to each pipeline with the attributes for
  dynamic routing.
niros1 pushed a commit that referenced this pull request Sep 30, 2025
- Merge configuration of multiple inputs in a single configuration.
- Add a forward connector as exporter for each input pipeline.
- Generate an exporter configuration based on the assigned data output.
- Add a pipeline with all the forward connectors as receivers and the
  generated exporter as exporter.
- Add a transform processor to each pipeline with the attributes for
  dynamic routing.
rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
- Merge configuration of multiple inputs in a single configuration.
- Add a forward connector as exporter for each input pipeline.
- Generate an exporter configuration based on the assigned data output.
- Add a pipeline with all the forward connectors as receivers and the
  generated exporter as exporter.
- Add a transform processor to each pipeline with the attributes for
  dynamic routing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:Fleet Team label for Observability Data Collection Fleet team v9.2.0

6 participants