Skip to content

Conversation

@mrodm
Copy link
Contributor

@mrodm mrodm commented Sep 10, 2025

Relates #2835
Depends on elastic/kibana#233090
Depends on elastic/kibana#235226
Depends on elastic/kibana#236333
Depends on elastic/fleet-server#5469

This PR enables to run system tests also in input packages using otelcol input.

In order to achieve that the validation process for fields and mappings is currently disabled because we need to determine the specific requirements for validation when the OTEL collector input is configured.

How to test this PR locally

Testing this requires:

  • running Elastic stack 9.2.0-SNAPSHOT.
  • enabling Kibana feature flag enableOtelIntegrations (already managed by elastic-package).

Steps:

elastic-package stack up -v -d --version 9.2.0-SNAPSHOT

elastic-package -C test/packages/parallel/httpcheck test system -v

elastic-package stack down -v

@mrodm
Copy link
Contributor Author

mrodm commented Sep 10, 2025

@jsoriano it looks like there is no "Index Template" created when these input packages using otelcol input are installed:
httpcheck no index template

As a reference, for instance sql_input input package creates this Index Template:
sql_input index template

This makes the system test fail with this error:

[0] failed to load mappings from index template preview (metrics-httpcheck.check.otel): error getting mapping: [400 Bad Request] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"unable to simulate template [metrics-httpcheck.check.otel] that does not exist"}],"type":"illegal_argument_exception","reason":"unable to simulate template [metrics-httpcheck.check.otel] that does not exist"},"status":400}

This is used to get the mappings that were installed to compare them with those that are available after being ingested the documents.

@mrodm
Copy link
Contributor Author

mrodm commented Sep 10, 2025

Ok, it seems that it is pending as mentioned in elastic/kibana#232628

In addition they should contain @package and @custom templates included in current packages, so package developers and users can still customize mappings or pipelines.

Do you think there is going to be an Index Template installed for that as in the other packages?

if err := r.kibanaClient.AddPackageDataStreamToPolicy(ctx, ds); err != nil {
return nil, fmt.Errorf("could not add data stream config to policy: %w", err)
}
}
Copy link
Contributor Author

@mrodm mrodm Sep 12, 2025

Choose a reason for hiding this comment

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

It looks like that it does not need to update the datasets the Integration Policies created by elastic-package via:

ds := createPackageDatastream(*policyToTest, *r.pkgManifest, policyTemplate, *r.dataStreamManifest, *config, policyToTest.Namespace)

Comment on lines 1613 to 1617
if scenario.policyTemplateInput == otelCollectorInputName {
// Input packages whose input is `otelcol` must add the `.otel` suffix
// Example: httpcheck.metrics.otel
expectedDataset += "." + otelSuffixDataset
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Documents ingested contain the dataset with suffix otel:

    "data_stream": {
      "dataset": "httpcheck.check.otel",
      "namespace": "83653",
      "type": "metrics"
    },

Packages using OTEL collector input will perform the validation based on
the mappings found before and after ingesting documents.
@mrodm
Copy link
Contributor Author

mrodm commented Sep 23, 2025

/test

2 similar comments
@mrodm
Copy link
Contributor Author

mrodm commented Sep 23, 2025

/test

@mrodm
Copy link
Contributor Author

mrodm commented Sep 24, 2025

/test

Comment on lines +2220 to +2221
// When using the OTEL collector input, just a subset of validations are performed (e.g. check expected datasets)
fields.WithOTELValidation(r.isTestUsingOTELCollectorInput(policyTemplateInput)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could input packages contain transforms ?
I think they cannot, so probably this validation based on fields for transforms could be kept as it is without disabling anything. WDYT ?

Copy link
Member

Choose a reason for hiding this comment

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

They cannot contain transforms. So yeah, I guess that transform tests will be a noop even if not explicitly disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, for input package there would not be any issue.
I was thinking if it should be kept that fields.WithOTELValidation option, if at some point integrations packages start using OTEL collector inputs.

WDYT ? Would it be better to keep it or remove it ? @jsoriano

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking if it should be kept that fields.WithOTELValidation option, if at some point integrations packages start using OTEL collector inputs.

Yes, please, keep it. When we support integrations with OTel inputs there is no reason to think that they won't support transforms.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm marked this pull request as ready for review September 30, 2025 09:47
@mrodm mrodm requested a review from a team September 30, 2025 09:48
Comment on lines +2220 to +2221
// When using the OTEL collector input, just a subset of validations are performed (e.g. check expected datasets)
fields.WithOTELValidation(r.isTestUsingOTELCollectorInput(policyTemplateInput)),
Copy link
Member

Choose a reason for hiding this comment

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

They cannot contain transforms. So yeah, I guess that transform tests will be a noop even if not explicitly disabled.

@@ -1,8 +1,7 @@
skip:
reason: Not supported system tests with input type otelcol.
link: https://github.com/elastic/elastic-package/issues/2835
Copy link
Member

Choose a reason for hiding this comment

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

👍

@mrodm mrodm merged commit 3c02bcd into elastic:main Oct 1, 2025
3 checks passed
@mrodm mrodm deleted the support-system-tests-otel-input branch October 1, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants