-
Notifications
You must be signed in to change notification settings - Fork 352
Update general event guidance and policies to allow complex attributes on events only #2240
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0cc6c4d
Update general event guidance and policies to allow complex attribute…
58f6f4d
up
53edbbc
Apply suggestions from code review
41400a4
feedback
1b5d028
return some changes lost in merge
0af747c
Apply suggestions from code review
4a60dbf
Merge branch 'main' into events-complex-attrs
64936b0
up
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
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| change_type: enhancement | ||
| component: events | ||
| note: > | ||
| Update general event guidance to allow complex attributes on events and use them | ||
| instead of the body fields. | ||
|
|
||
| issues: [1651, 1669] |
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
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
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
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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package after_resolution | ||
| import rego.v1 | ||
|
|
||
| # checks that complex attributes are not used in any groups except events | ||
| deny contains group_stability_violation(description, group.id, attr.name) if { | ||
|
lmolkova marked this conversation as resolved.
|
||
| group := input.groups[_] | ||
| group.type != "event" | ||
| group.type != "attribute_group" | ||
|
|
||
| attr := group.attributes[_] | ||
| attr.type in ["any", "template[any]"] | ||
|
|
||
| description := sprintf("Attribute '%s' has type '%s' and is referenced on group '%s' of type '%s'. Complex attributes are only allowed on events.", [attr.name, attr.type, group.id, group.type]) | ||
| } | ||
|
|
||
| attribute_type_violation(description, group, attr) = violation if { | ||
| violation := { | ||
| "id": description, | ||
| "type": "semconv_attribute", | ||
| "category": "attribute_type_violation", | ||
| "attr": attr, | ||
| "group": group, | ||
| } | ||
| } | ||
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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package after_resolution | ||
| import future.keywords | ||
|
|
||
| test_fails_on_complex_attribute if { | ||
| attribute_types := ["any", "template[any]"] | ||
| group_types = ["span", "entity", "resource", "metric"] | ||
| every attribute_type in attribute_types { | ||
| every group_type in group_types { | ||
| count(deny) == 1 with input as {"groups": [{ "id": concat(".", [group_type, "attr"]), | ||
| "type": group_type, | ||
| "stability": "development", | ||
| "attributes": [{ | ||
| "name": "test.any", | ||
| "stability": "development", | ||
| "type": attribute_type | ||
| }]}]} | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| test_pass_on_complex_attribute if { | ||
| attribute_types := ["any", "template[any]"] | ||
| group_types = ["attribute_group", "event"] | ||
| every attribute_type in attribute_types { | ||
| every group_type in group_types { | ||
| count(deny) == 0 with input as {"groups": [{ "id": concat(".", [group_type, "attr"]), | ||
| "type": group_type, | ||
| "stability": "development", | ||
| "attributes": [{ | ||
| "name": "test.any", | ||
| "stability": "development", | ||
| "type": attribute_type | ||
| }]}]} | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.