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

/subs monitoring endpoint does not work when accounts are enabled. #1357

Closed
1 of 2 tasks
matthiashanel opened this issue Apr 27, 2020 · 2 comments
Closed
1 of 2 tasks
Assignees

Comments

@matthiashanel
Copy link
Contributor

  • Defect
  • Feature Request or Change Proposal

Defects

Below example shows starting the server without/with accounts.
Then subscribing on ">"
followed by querying /subsz.
When started with accounts the subscription does not appear.
(I tried /connz etc.. these worked. /connz?subs=1 worked as expected)

With accounts:

> cat X_BAD.cfg
listen: localhost:4222
http: localhost:8000
accounts: {
    USERS {
        users: [
            {user: "user", password: "pwd"}
        ]
    },
}
> nats-server -c X_BAD.cfg -D &
[1] 1865
[1865] 2020/04/27 11:51:54.350485 [INF] Starting nats-server version 2.1.6
...
[1865] 2020/04/27 11:51:54.352773 [INF] Server is ready
> nats -s nats://user:pwd@localhost:4222 sub ">"
[1865] 2020/04/27 11:52:00.470127 [DBG] 127.0.0.1:49657 - cid:1 - Client connection created
11:52:00 Subscribing on >
[1865] 2020/04/27 11:52:02.661034 [DBG] 127.0.0.1:49657 - cid:1 - Client Ping Timer
^Z
[2]  + 1874 suspended  nats -s nats://user:pwd@localhost:4222 sub ">"
> bg
[2]  - 1874 continued  nats -s nats://user:pwd@localhost:4222 sub ">"
> curl "http://localhost:8000/subsz"
{
  "num_subscriptions": 0,
  "num_cache": 0,
  "num_inserts": 0,
  "num_removes": 0,
  "num_matches": 0,
  "cache_hit_rate": 0,
  "max_fanout": 0,
  "avg_fanout": 0
}% 
>

Without accounts:

> cat X_GOOD.cfg
listen: localhost:4222
http: localhost:8000
> nats-server -c X_GOOD.cfg -D &
[1] 1921
[1921] 2020/04/27 11:52:35.951091 [INF] Starting nats-server version 2.1.6
...
[1921] 2020/04/27 11:52:35.953342 [INF] Server is ready
> nats -s nats://user:pwd@localhost:4222 sub ">" &
[2] 1930
[1921] 2020/04/27 11:52:45.226069 [DBG] 127.0.0.1:49671 - cid:1 - Client connection created
11:52:45 Subscribing on >
[1921] 2020/04/27 11:52:47.350221 [DBG] 127.0.0.1:49671 - cid:1 - Client Ping Timer
> curl "http://localhost:8000/subsz"
{
  "num_subscriptions": 1,
  "num_cache": 0,
  "num_inserts": 1,
  "num_removes": 0,
  "num_matches": 0,
  "cache_hit_rate": 0,
  "max_fanout": 0,
  "avg_fanout": 0
}%   
>
@derekcollison
Copy link
Member

IIRC subs may only do global account. Needs to be part of our update to monitoring to be more account aware. Need to spec out what we want and impl.

@matthiashanel matthiashanel self-assigned this May 4, 2020
matthiashanel added a commit that referenced this issue May 6, 2020
Fixes  #1371 and #1357 by adding up stats and collecting subscriptions
from all accounts.

Signed-off-by: Matthias Hanel <mh@synadia.com>
matthiashanel added a commit that referenced this issue May 6, 2020
Fixes  #1371 and #1357 by adding up stats and collecting subscriptions
from all accounts.

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

fixed by #1377

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

No branches or pull requests

2 participants