-
Notifications
You must be signed in to change notification settings - Fork 129
[policy tests] Replace also OTEL ids under service.pipelines #2886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Replace all occurrences found
- Loading branch information
commit 5d46bddd1d13fdc3b63b34fe84752571ee6600cc
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,6 +190,13 @@ var uniqueOtelComponentIDReplace = policyEntryReplace{ | |
| // - endpoints: | ||
| // - https://epr.elastic.co | ||
| // method: GET | ||
| // service: | ||
| // pipelines: | ||
| // logs: | ||
| // receivers/6b7f1379-dcb9-4ac7-b253-4df6d088b3ff: | ||
| // - 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)+)`) | ||
|
|
||
| // cleanPolicy prepares a policy YAML as returned by the download API to be compared with other | ||
|
|
@@ -248,10 +255,7 @@ func replaceOtelComponentIDs(policy []byte) []byte { | |
| // service.extensions | ||
| // service.pipelines.<signal>.(receivers|processors|exporters) | ||
| for original, replacement := range replacementsDone { | ||
| originalArrayItem := fmt.Sprintf("- %s", original) | ||
| replacedArrayItem := fmt.Sprintf("- %s", replacement) | ||
|
|
||
| policy = bytes.ReplaceAll(policy, []byte(originalArrayItem), []byte(replacedArrayItem)) | ||
| policy = bytes.ReplaceAll(policy, []byte(original), []byte(replacement)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| } | ||
| return policy | ||
| } | ||
|
|
||
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
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once these PRs are merged:
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 |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included the
servicemap into this regex in order to take into account these kind of definitions too to find pipelines IDs like (metrics/<some_id>):