Skip to content

Fix Kibana data_stream.dataset variable for input package policies#3285

Merged
teresaromero merged 7 commits intoelastic:mainfrom
teresaromero:3275-fix-dataset-name-otel
Feb 18, 2026
Merged

Fix Kibana data_stream.dataset variable for input package policies#3285
teresaromero merged 7 commits intoelastic:mainfrom
teresaromero:3275-fix-dataset-name-otel

Conversation

@teresaromero
Copy link
Contributor

@teresaromero teresaromero commented Feb 16, 2026

For input packages, createInputPackagePolicy now sets the stream-level variable data_stream.dataset to the policy template name (e.g. sql_query) instead of the full dataset string (e.g. sql_input.sql_query). Kibana expects this variable to hold the template name so it can correctly resolve the dataset; using the full string caused the dataset to be incorrect.

Add TestCreateInputPackagePolicy_DatasetVariable to assert:

  • The variable is set to the policy template name when not defined by the template or user
  • Template default and user override (packagePolicy.Vars) are preserved
  • An error is returned when DataStreamName is set for an input package

System tests already use the correct behavior and were not modified in this PR.

  • System test config is loaded from YAML with a top-level vars (and optional data_stream.vars). These are passed as cfgVars into the system runner (internal/testrunner/runners/system/tester.go).
  • For input packages, the system runner already resolves the dataset as:
    1. vars["data_stream.dataset"] from the test config if set
    2. Otherwise the default from the policy template’s var definition
    3. Otherwise policyTemplate.Name
  • So system tests already default to the policy template name and only override when the test config sets data_stream.dataset in vars. No code change was needed there; this PR only brings policy tests in line with that same behavior.

Resolves #3275

Made with Cursor

For input packages, createInputPackagePolicy now sets the stream-level
variable data_stream.dataset to the policy template name (e.g. sql_query)
instead of the full dataset string (e.g. sql_input.sql_query). Kibana
expects this variable to hold the template name so it can correctly
resolve the dataset; using the full string caused the dataset to be
incorrect.

Add TestCreateInputPackagePolicy_DatasetVariable to assert:
- The variable is set to the policy template name when not defined
  by the template or user
- Template default and user override (packagePolicy.Vars) are preserved
- An error is returned when DataStreamName is set for an input package

Co-authored-by: Cursor <cursoragent@cursor.com>
@teresaromero teresaromero requested a review from a team February 16, 2026 09:26
@teresaromero
Copy link
Contributor Author

When this fix is released, is expected to have some policy tests failing. New snapshots should be generated with the version bump

Updated the data_stream.dataset variable in the expected test files for httpcheck and sql_input packages to use simplified names. This change aligns with the recent adjustments made to ensure compatibility with Kibana's expectations for dataset naming conventions.
Changed the MongoDB version from 5.0 to 7.0 in the Dockerfiles and updated the installation command for netcat to use netcat-openbsd. This ensures compatibility with the latest MongoDB features and improves the health check mechanism.
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM the change for the policy tests, just some questions for the mongodb test package.

Introduced a new variants.yml file to manage MongoDB service versions (v6 and v7). Updated docker-compose.yml and Dockerfile to utilize the SERVICE_VERSION argument, ensuring flexibility in service version deployment. This change enhances the deployment process by allowing easy version management.
@teresaromero
Copy link
Contributor Author

Moved all mongodb changes into #3288

@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 18, 2026

💔 Build Failed

Failed CI Steps

History

@teresaromero
Copy link
Contributor Author

test integrations

@elastic-vault-github-plugin-prod

Created or updated PR in integrations repository to test this version. Check elastic/integrations#17453

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

👍

@teresaromero
Copy link
Contributor Author

Created or updated PR in integrations repository to test this version. Check elastic/integrations#17453

Errors are the expected ones, will be fixed when the ep version bump at integrations repository

@teresaromero teresaromero merged commit 4265a31 into elastic:main Feb 18, 2026
3 checks passed
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.

Package policy dataset mismatch for otelcol input packages

3 participants