-
Notifications
You must be signed in to change notification settings - Fork 29
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
[ADDED] Import/Export.AllowTrace and Account.TraceDest #216
Conversation
This is needed for the NATS Server distributed message tracing feature. This PR updates validation of a Subject to check for `.` at the first or last position and consecutive ones. The validation of the Account.TraceDest also checks that the destination does not have wildcards since this is supposed to be a publish subject. The Import/Export validation ensures that AllowTrace is used by the correct type (service or stream) Signed-off-by: Ivan Kozlovic <[email protected]>
I have a server branch that references this branch to validate that the changes would work on the server: nats-io/nats-server@3608bcf |
Pull Request Test Coverage Report for Build 7919127075Details
💛 - Coveralls |
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.
LGTM!
@aricart Could you review when you get a chance? And after review/updates, once it is merged, would it be possible to have a release (I guess v0.26.0 since fields were added)? I will then update the NATS Server branch that I have with proper go.mod dependency. Thanks! |
v2/account_claims.go
Outdated
@@ -229,6 +230,7 @@ type Account struct { | |||
DefaultPermissions Permissions `json:"default_permissions,omitempty"` | |||
Mappings Mapping `json:"mappings,omitempty"` | |||
Authorization ExternalAuthorization `json:"authorization,omitempty"` | |||
TraceDest Subject `json:"trace_dest,omitempty"` |
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.
LGTM - but I wonder if we should have a container for this option in case there are other possible trace options. If it won't change, then possibly fine.
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.
At the moment there is nothing more, but I could see that we need to add things related to tracing indeed. What would you propose? Something like:
Trace *MsgTrace `json:"trace,omitempty"`
...
type MsgTrace struct {
Destination Subject `json:"dest,omitempty"`
}
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.
Yes that would be perfect!
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.
Done. Please review changes, and as I mentioned previously, if you merge, could you please (or whoever is in charge) do a release so I can reference it in the NATS Server PR that I am working on? Thanks!
Signed-off-by: Ivan Kozlovic <[email protected]>
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.
LGTM
@kozlovic I released the library but since there were no incompatible changes, I just bumped micro. |
Thanks @aricart! |
This is needed for the NATS Server distributed message tracing feature.
This PR updates validation of a Subject to check for
.
at the first or last position and consecutive ones.The validation of the Account.TraceDest also checks that the destination does not have wildcards since this is supposed to be a publish subject.
The Import/Export validation ensures that AllowTrace is used by the correct type (service or stream)
Signed-off-by: Ivan Kozlovic [email protected]