Skip to content
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] filter system requests by JS domain #2194

Merged
merged 1 commit into from May 7, 2021
Merged

Conversation

matthiashanel
Copy link
Contributor

@matthiashanel matthiashanel commented May 7, 2021

Signed-off-by: Matthias Hanel mh@synadia.com

> nats -s nats://admin:admin@localhost:4222 req '$SYS.REQ.SERVER.PING.JSZ' '{"domain":"leaf"}'
18:15:51 Sending request on "$SYS.REQ.SERVER.PING.JSZ"
18:15:51 Received on "_INBOX.VT8qToDYRhQEugeQoLnKqq.tN0mZqav" rtt 1.109964ms
{"data":{"server_id":"NAJPDFSKAT4QLMJHYPWYQZ3ENUNCNFEM2VUZQ2BHH4XG2XM3MVKQXVRD","now":"2021-05-07T22:15:51.795782Z","config":{"max_memory":51539607552,"max_storage":544531544064,"store_dir":"store_leaf_1/jetstream","domain":"leaf"},"memory":0,"storage":0,"api":{"total":0,"errors":0},"current_api_calls":0},"server":{"name":"leaf-server-1","host":"0.0.0.0","id":"NAJPDFSKAT4QLMJHYPWYQZ3ENUNCNFEM2VUZQ2BHH4XG2XM3MVKQXVRD","cluster":"leaf","ver":"2.2.3-beta.8","seq":17,"jetstream":true,"time":"2021-05-07T22:15:51.795797Z"}}

> nats -s nats://admin:admin@localhost:4222 req '$SYS.REQ.SERVER.PING.JSZ' '{"domain":"hub"}'
18:15:57 Sending request on "$SYS.REQ.SERVER.PING.JSZ"
18:15:57 Received on "_INBOX.V208I1kObjZ7zQ0oq02HfQ.Glg2kHFF" rtt 796.238µs
{"data":{"server_id":"NADESZWP7UUW3BIGPNHWBPSAEMH5U7ATVEI63E6GELZQGJPQQTNJGNWU","now":"2021-05-07T22:15:57.289507Z","config":{"max_memory":51539607552,"max_storage":544531544064,"store_dir":"store_server_1/jetstream","domain":"hub"},"memory":0,"storage":0,"api":{"total":0,"errors":0},"current_api_calls":0,"meta_cluster":{"name":"hub","leader":"hub-server-1","replicas":[{"name":"hub-server-2","current":true,"active":468253000},{"name":"hub-server-3","current":true,"active":468255000}]}},"server":{"name":"hub-server-1","host":"0.0.0.0","id":"NADESZWP7UUW3BIGPNHWBPSAEMH5U7ATVEI63E6GELZQGJPQQTNJGNWU","cluster":"hub","ver":"2.2.3-beta.8","seq":36,"jetstream":true,"time":"2021-05-07T22:15:57.289561Z"}}

server/events.go Outdated
@@ -1077,6 +1077,7 @@ type EventFilterOptions struct {
Cluster string `json:"cluster,omitempty"` // filter by cluster name
Host string `json:"host,omitempty"` // filter by host name
Tags []string `json:"tags,omitempty"` // filter by tags (must match all tags)
Domain string `json:domain,omitempty` // filter by JS domain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad syntax

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag syntax

server/events.go Outdated Show resolved Hide resolved
server/events.go Outdated
@@ -1164,6 +1165,11 @@ func (s *Server) filterRequest(fOpts *EventFilterOptions) bool {
}
}
}
if fOpts.Domain != _EMPTY_ {
if js := s.getJetStream(); js == nil || js.config.Domain != fOpts.Domain {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just do if s.getOpts().JetStreamDomain != _EMPTY

server/events.go Outdated Show resolved Hide resolved
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Matthias Hanel <mh@synadia.com>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison self-requested a review May 7, 2021 23:02
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matthiashanel matthiashanel merged commit 4355e39 into master May 7, 2021
@matthiashanel matthiashanel deleted the js-domains branch May 7, 2021 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants