[policy tests] Replace also OTEL ids under service.pipelines#2886
Merged
mrodm merged 2 commits intoelastic:mainfrom Sep 11, 2025
Merged
[policy tests] Replace also OTEL ids under service.pipelines#2886mrodm merged 2 commits intoelastic:mainfrom
mrodm merged 2 commits intoelastic:mainfrom
Conversation
mrodm
commented
Sep 10, 2025
Contributor
Author
There was a problem hiding this comment.
Once these PRs are merged:
- Complete OTel configuration pipelines with an exporter kibana#233090
- Prepare OTel Elasticsearch exporter with the credentials of the output fleet-server#5469
this file should be updated in order to be valid.
Testing with the current changes of those branches, this file should be like (it could change):
connectors:
forward: {}
exporters:
elasticsearch/componentid-0:
endpoints:
- http://localhost:9200
inputs: []
output_permissions:
default:
_elastic_agent_checks:
cluster:
- monitor
_elastic_agent_monitoring:
indices: []
uuid-for-permissions-on-related-indices:
indices:
- names:
- metrics-*-*
privileges:
- auto_configure
- create_doc
processors:
transform/componentid-0:
metric_statements:
- context: datapoint
statements:
- set(attributes["data_stream.type"], "metrics")
- set(attributes["data_stream.dataset"], "httpcheck.check")
- set(attributes["data_stream.namespace"], "ep")
receivers:
httpcheck/componentid-0:
collection_interval: 1m
targets:
- endpoints:
- https://epr.elastic.co
method: GET
secret_references: []
service:
pipelines:
metrics:
exporters:
- elasticsearch/componentid-0
receivers:
- forward
metrics/componentid-0:
exporters:
- forward
processors:
- transform/componentid-0
receivers:
- httpcheck/componentid-0
mrodm
commented
Sep 10, 2025
Comment on lines
+549
to
+550
| - >- | ||
| httpcheck/otelcol-check-12bd7179-ea83-494b-9f2c-5bf818cd6a77-otelcol-httpcheck-check-12bd7179-ea83-494b-9f2c-5bf818cd6a77 |
Contributor
Author
There was a problem hiding this comment.
Added example with the syntax - >- to set an array element.
mrodm
commented
Sep 10, 2025
| extensions: | ||
| - health_check/4391d954-1ffe-4014-a256-5eda78a71828 | ||
| pipelines: | ||
| metrics/otelcol-check-12bd7179-ea83-494b-9f2c-5bf818cd6a77-otelcol-httpcheck-check-12bd7179-ea83-494b-9f2c-5bf818cd6a77: |
Contributor
Author
There was a problem hiding this comment.
Added example with a service pipeline containing a suffix in order to be able to define several pipelines of the same signal.
mrodm
commented
Sep 10, 2025
| // - httpcheck/b0f518d6-4e2d-4c5d-bda7-f9808df537b7 | ||
| // | ||
| // The regex captures the whole section, so it can be processed line by line to replace the IDs. | ||
| var otelComponentIDsRegexp = regexp.MustCompile(`(?m)^(?:extensions|receivers|processors|connectors|exporters|service):(?:\s\{\}\n|\n(?:\s{2,}.+\n)+)`) |
Contributor
Author
There was a problem hiding this comment.
Included the service map into this regex in order to take into account these kind of definitions too to find pipelines IDs like (metrics/<some_id>):
service:
pipelines:
logs:
receivers/6b7f1379-dcb9-4ac7-b253-4df6d088b3ff:
- httpcheck/b0f518d6-4e2d-4c5d-bda7-f9808df537b7
Collaborator
💚 Build Succeeded
History
cc @mrodm |
Contributor
Author
|
test integrations |
|
Created or updated PR in integrations repository to test this version. Check elastic/integrations#15277 |
jsoriano
approved these changes
Sep 11, 2025
| replacedArrayItem := fmt.Sprintf("- %s", replacement) | ||
|
|
||
| policy = bytes.ReplaceAll(policy, []byte(originalArrayItem), []byte(replacedArrayItem)) | ||
| policy = bytes.ReplaceAll(policy, []byte(original), []byte(replacement)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #2873
Relates #2835
This PR also adds support in policy tests for definitions in policies like:
It is needed check that components defined under
service.pipelinescould contain also IDs, and they need to be replaced.How to test this PR locally
elastic-package stack up -v -d --version 9.2.0-SNAPSHOT elastic-package -C test/packages/parallel/httpcheck test policy -v elastic-package stack down -v