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

Add account name tag to monitoring endpoints #6310

Merged
merged 5 commits into from
Jan 6, 2025
Merged

Conversation

bruth
Copy link
Member

@bruth bruth commented Dec 30, 2024

This supersedes #5173 since it introduced a redundant field LogicalName on Account with the existing field nameTag.

The endpoints that are currently covered include:

  • /accountz
  • /accstatz
  • /connz
  • /subsz
  • /jsz

The following endpoints also contain account metadata, but have not been implemented yet.

  • /routez
  • /gatewayz
  • /leafz

This supersedes #5173 since it introduced a redundant field
`LogicalName` on `Account` with the existing field `nameTag`.

The endpoints that are currently covered include:

- /accountz
- /accstatz
- /connz
- /subsz
- /jsz

The endpoints:

- /routez
- /gatewayz
- /leafz

also contain account metadata, but has not been implemented yet.

Signed-off-by: Byron Ruth <byron@nats.io>
Signed-off-by: Byron Ruth <byron@nats.io>
Signed-off-by: Byron Ruth <byron@nats.io>
Signed-off-by: Byron Ruth <byron@nats.io>
server/accounts.go Outdated Show resolved Hide resolved
}
a.mu.RLock()
name := a.Name
a.mu.RUnlock()
return name
}

// getNameTag will return the name tag or the account name if not set.
func (a *Account) getNameTag() string {
Copy link
Member Author

Choose a reason for hiding this comment

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

In the context of monitoring and operator mode, this PR makes the assumption that if an explicit JWT name (not the subject) is not set, the name tag will default to the JWT which equates to the account name.

This may seem redundant, but the purpose is that its a consistent way to report on a standard value regardless if the name is set.

server/monitor.go Show resolved Hide resolved
server/monitor.go Show resolved Hide resolved
server/monitor_test.go Show resolved Hide resolved
server/monitor_test.go Outdated Show resolved Hide resolved
server/monitor_test.go Show resolved Hide resolved
server/monitor_test.go Show resolved Hide resolved
@bruth bruth marked this pull request as ready for review January 2, 2025 13:57
@bruth bruth requested a review from a team as a code owner January 2, 2025 13:57
server/accounts.go Outdated Show resolved Hide resolved
server/accounts.go Outdated Show resolved Hide resolved
server/accounts.go Outdated Show resolved Hide resolved
server/accounts.go Show resolved Hide resolved
server/monitor.go Outdated Show resolved Hide resolved
server/monitor.go Show resolved Hide resolved
server/monitor.go Show resolved Hide resolved
server/monitor.go Show resolved Hide resolved
Signed-off-by: Byron Ruth <byron@nats.io>
@derekcollison derekcollison self-requested a review January 6, 2025 14:24
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

@derekcollison derekcollison merged commit c558b24 into main Jan 6, 2025
5 checks passed
@derekcollison derekcollison deleted the monitor-account-tag branch January 6, 2025 14:25
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.

2 participants