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

Annotate CPU and goroutine profiles #4204

Merged
merged 1 commit into from Jun 20, 2023
Merged

Annotate CPU and goroutine profiles #4204

merged 1 commit into from Jun 20, 2023

Conversation

neilalexander
Copy link
Member

@neilalexander neilalexander commented Jun 2, 2023

This allows the CPU and goroutine profiles to be annotated with information that allows us to break down load based on accounts, streams and consumers. We could probably add more labels elsewhere for other purposes too. It makes it easier to spot whether there are certain assets that are responsible for heavy CPU usage, i.e. snapshotting certain stream states.

Signed-off-by: Neil Twigg neil@nats.io

@derekcollison
Copy link
Member

Lots of tests failures that should be adressed.

@neilalexander
Copy link
Member Author

Yep, PR is still marked as draft as I haven't looked at those failures yet, but I've gone back to the consumer defaults for now.

@neilalexander neilalexander marked this pull request as ready for review June 5, 2023 14:24
@neilalexander neilalexander requested a review from a team as a code owner June 5, 2023 14:24
server/jetstream_cluster.go Outdated Show resolved Hide resolved
server/opts.go Outdated
@@ -986,6 +987,8 @@ func (o *Options) processConfigFileLine(k string, v interface{}, errors *[]error
o.PortsFileDir = v.(string)
case "prof_port":
o.ProfPort = int(v.(int64))
case "prof_tags":
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed, if you turn on profiling we will add in the tags.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you sure it's OK to always tag? It will mean for the first time that the profiles contain potentially sensitive information (account/stream/consumer names) with no way to toggle, whereas before they did not contain anything that really uniquely identifies a specific environment.

Copy link
Member

Choose a reason for hiding this comment

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

I can see an argument for both. If someone was sharing with us let's say would want all the information so that we could tie together any NATS cli triage, e.g. nats stream info with any profiling they may share.

server/server.go Outdated Show resolved Hide resolved
server/server.go Outdated Show resolved Hide resolved
server/server.go Outdated Show resolved Hide resolved
@neilalexander neilalexander changed the title Add prof_tags for annotating CPU and goroutine profiles Annotate CPU and goroutine profiles Jun 9, 2023
@neilalexander
Copy link
Member Author

This was modified to just include the tags in all cases and removed the configuration option.

@derekcollison derekcollison self-requested a review June 19, 2023 20:07
js.srv.startGoRoutine(js.monitorCluster)
js.srv.startGoRoutine(
js.monitorCluster,
map[string]string{
Copy link
Member

Choose a reason for hiding this comment

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

Hmm yea this seems worse. Maybe back to strings but concat the key and value?

js.srv.startGoRoutine( js.monitorCluster, "type: metaleader", ..)

Copy link
Member Author

Choose a reason for hiding this comment

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

Only thing with this approach is that it might end up ugly for other reasons, i.e. fmt.Sprintf littered everywhere, but I'll happily go with that if that is what you prefer:

js.srv.startGoRoutine( js.monitorCluster, "type:metaleader", fmt.Sprintf("stream:%s", streamName), ...)

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, true.

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 eba833e into dev Jun 20, 2023
2 checks passed
@derekcollison derekcollison deleted the neil/pproflabels branch June 20, 2023 20:00
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

2 participants