Stop implicitly validating generic.otel for otelcol input packages#3433
Stop implicitly validating generic.otel for otelcol input packages#3433teresaromero wants to merge 14 commits intoelastic:mainfrom
Conversation
Fleet changed (April 2026) to use "generic.otel" as the stream path/dataset for input packages with dynamic_signal_types: true, instead of the previous <pkgName>.<policyTemplateName> default. Align BuildInputPackagePolicy to send the matching stream key and data_stream.dataset variable in simplified API requests. The test validator's expectedDatasets() was deriving expected document datasets from the policy variable (now "generic.otel"), but indexed documents retain the OTel scope-based dataset (e.g. sqlserverreceiver.otel). For dynamic_signal_types packages, derive the expected dataset from policyTemplate.Name + ".otel" instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add policy test config and expected output for sql_server_input_otel (dynamic_signal_types: true), generated against a live stack. Update zipkin_input_otel expected files to reflect Fleet no longer setting data_stream.dataset in OTel trace routing transforms. Add sample event files for both packages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jsoriano
left a comment
There was a problem hiding this comment.
LGTM as it seems to mimic current Fleet implementation, but I am still concerned about being able to distinguish generic and non-generic cases for dynamic_signal_types.
| // Input packages whose input is `otelcol` must add the `.otel` suffix | ||
| // Example: httpcheck.metrics.otel | ||
| expectedDataset += "." + otelSuffixDataset | ||
| if scenario.policyTemplate.DynamicSignalTypes { |
There was a problem hiding this comment.
Is it still possible to override the dataset? For example in the case of mysql_input_otel it has dynamic_signal_types: true, but its data should not go to generic data streams.
There was a problem hiding this comment.
i've added the case to the test fixtures and used the variable override to prove dataset can be overriden, but i dont see this is happening... i dont see the overriden value as dataset
| title: Dataset name | ||
| description: | | ||
| Dataset to write data to. Changing the dataset will send the data to a different index. You can't use `-` in the name of a dataset and only valid characters for [Elasticsearch index names](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html). | ||
| default: mysql_input_otel.generic |
There was a problem hiding this comment.
added the default value here, so expected the dataset to be this value. When installing the package and sending events (system test with defer cleanup) i dont see dataset is this value, mysqlreceiver.otel, is this correct?
| - opentelemetry | ||
| conditions: | ||
| kibana: | ||
| version: "^9.4.0" |
There was a problem hiding this comment.
This package requires to run a specific kibana/stack version.
It should be created a new file like the one for zipkin:
https://github.com/elastic/elastic-package/blob/main/test/packages/parallel/zipkin_input_otel.stack_version
There was a problem hiding this comment.
We would need to review these stack version overrides in case it is needed to bump the minimum kibana version , or remove it if 9.4.0 supports these kind of packages.
| service_notify_signal: SIGHUP | ||
| vars: | ||
| endpoint: "{{Hostname}}:{{Port}}" | ||
| username: "root" |
There was a problem hiding this comment.
Tested to add here an override for data_stream.dataset and it is not shown in the sample events:
$ cat test/packages/parallel/mysql_input_otel/_dev/test/system/test-default-config.yml
service: mysql_input_otel
service_notify_signal: SIGHUP
vars:
endpoint: "{{Hostname}}:{{Port}}"
username: "root"
data_stream.dataset: 'mysql.other'
assert:
min_count: 10
It is still shown mysqlreceiver.otel as dataset.
| - context: span | ||
| statements: | ||
| - set(attributes["data_stream.type"], "traces") | ||
| - set(attributes["data_stream.dataset"], "zipkin.custom") |
There was a problem hiding this comment.
It looks like these changes are also related to the failures reported in https://buildkite.com/elastic/elastic-package-test-serverless/builds/783
…ion for dynamic packages BuildDataStreamName and expectedDatasets now apply the .otel suffix conditionally, preventing generic.otel from becoming generic.otel.otel when Fleet stores the real dataset value. The DynamicSignalTypes special case that derived the expected dataset from policyTemplate.Name is removed; scenario.dataStreamDataset is the source of truth for all otelcol input packages. Update policy test fixtures and sample events for mysql_input_otel, sql_server_input_otel, and zipkin_input_otel to reflect Fleet restoring data_stream.dataset in OTel transforms. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| } | ||
| }, | ||
| "data_stream": { | ||
| "dataset": "generic.otel", |
There was a problem hiding this comment.
Are those sample event files re-generated after these changes ?
Should this dataset be generic.otel or zipkinreceiver.otel?
There was a problem hiding this comment.
the sample_event_logs is coming from the system test with custom dataset. as i used generic as dataset, this is why we get those
| // The suffix is conditional to avoid double-appending when the stored dataset | ||
| // already ends in `.otel` (user-configured via data_stream.dataset). | ||
| if !strings.HasSuffix(expectedDataset, "."+otelSuffixDataset) { | ||
| expectedDataset += "." + otelSuffixDataset |
There was a problem hiding this comment.
IIUC, if needed the dataset generic.otel (as it was before), it would be already present in the scenario.datatreamDataset`, is that right?
There was a problem hiding this comment.
the agent is setting the suffix. what elastic-package needs is to add the suffix itself to be able to compare results. code changed after last commits
| dataset = fmt.Sprintf("%s.%s", dataset, otelSuffixDataset) | ||
| if !strings.HasSuffix(dataset, "."+otelSuffixDataset) { | ||
| dataset = dataset + "." + otelSuffixDataset | ||
| } |
There was a problem hiding this comment.
Why do we need to double-check if the otel suffix is already there? In what case the suffix would have been already added?
There was a problem hiding this comment.
when the custom datastet is set using the otel suffix
after testing and learning the feature, this wont be possible. the dataset value should be the base name. .otel suffix is added by the agent so anything used as override will have an extra .otel suffix.
i wonder if we should validate this package-spec wise to warn the user when using overrides?
…neric-otel-dynamic-signal-types
…r and simplify logic.
…neric-otel-dynamic-signal-types
…NTS.md to clarify that `data_stream.dataset` should not include a `.otel` suffix, as Elastic Agent appends it during ingestion. Modified packagepolicy.go and tester.go to ensure consistent handling of dataset names, preventing double suffixes in Elasticsearch. Updated system tests to reflect these changes and improve clarity in test case titles.
…hanged default dataset names to 'custom.default' in MySQL input manifest and sample events. Updated timestamps and port numbers in sample event logs and metrics for both MySQL and SQL Server. Adjusted expected dataset names in test policies for consistency. Removed outdated skip reasons from test configurations.
…neric-otel-dynamic-signal-types
|
Pipeline errors are expected for the 3 test fixtures (otel inputs) as this change depends on elastic/kibana#262000 being available at 9.4.0 snapshot |
⏳ Build in-progress, with failures
Failed CI Steps
History
|
What does this PR do?
elastic-package no longer treats
generic.otelas a special Fleet stream key or as an extra dataset that system tests must always accept forotelcolinput packages. Stream keys follow{package}.{policy_template};data_stream.datasetcomes from user variables, manifest defaults, or the policy template name. Users who need a shared or generic OTel dataset set it explicitly viadata_stream.datasetas the base name (see above).Dataset override: use the base name (important)
For
otelcolinput packages,data_stream.datasetin Fleet must be the base dataset only—do not include the.otelsuffix. Elastic Agent adds.otelat ingest for routing. Fleet and elastic-package’s policy builder do not append it in the package policy payload.If you set an override that already ends in
.otel(for examplegeneric.otel), the agent still appends.otel, and Elasticsearch ends up with a double suffix (generic.otel.otel). System tests in elastic-package mirror the agent by always appending.otelwhen resolving expected data stream names and document datasets for input packages, so overrides should stay base-only (e.g.generic,zipkinreceiver).Why policy test goldens look different from sample events: Policy tests snapshot the agent policy YAML Kibana returns (transform
set(attributes["data_stream.dataset"], …)lines). Those literals reflect the Fleet variable value—the base name—so they typically do not show.otel. Sample events (and real documents in Elasticsearch) reflect after agent routing, sodata_stream.datasetand related fields show the.otelsuffix (e.g.zipkinreceiver.otelinsample_event_traces.json). That split is expected, not a bug.Dependencies
elastic/kibana#262000 should be available at 9.4.0 snapshot; tested manually with local stack using the above Kibana commit.
Background
Related upstream work (Kibana Fleet, ingest-dev) adjusted how OTel
dynamic_signal_typesand traces packages routedata_stream.dataset. elastic-package aligns its policy construction and test expectations with variable-driven datasets rather than hardcodinggeneric.otel.What this PR changes in elastic-package
internal/kibana/packagepolicy.goBuildInputPackagePolicybuilds the simplified API streams map with keyfmt.Sprintf("%s.%s", manifest.Name, policyTemplate.Name).ensureDatasetVarsetsdata_stream.datasetfrom (in order): uservarValues, existing manifest-backed vars, explicit template var defaults, or the policy template name. There is no branch that forcesgeneric.otelforDynamicSignalTypes. Comments document that forotelcol, the stored value is the base dataset; Elastic Agent applies.otel.internal/testrunner/runners/system/tester.goBuildDataStreamName— for input-packageotelcol, always append.otelto the Fleetdata_stream.datasetvalue when building the Elasticsearch data stream name, matching Elastic Agent routing (Fleet does not add this suffix in the policy payload).expectedDatasets— forotelcolinput packages (pkgManifest.Type == "input"), append.otelthe same way for document validation. A policy value that already ends in.otelyields an expected*.otel.otelingested dataset (misconfiguration).AGENTS.mdFleet API notes include a bullet on
otelcolinput packages: basedata_stream.dataset, agent.otelappend, and how system tests mirror that.Tests and in-repo fixtures
internal/testrunner/runners/system/tester_test.go—TestBuildDataStreamNameandTestExpectedDatasetscover the agent-aligned append and policy values that already include.otel.internal/kibana/packagepolicy_test.go—TestEnsureDatasetVarexpectsdynamic_signal_typesto fall back to the policy template name like other templates;TestBuildInputPackagePolicyincludesotel_dynamic_signal_types_default_datasetagainsttestdata/packages/otel_dynamic_input.internal/kibana/testdata/—otel_input_dynamic_signals.json,otel_input_dynamic_signals_legacy.json, andpackages/otel_dynamic_input/manifest.ymldescribe the{package}.{policy_template}/sqlreceiverdefault pattern instead ofgeneric.otel..expectedfiles show transforms without.otelon that literal; sample events show*.otelas ingested.References