-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Nomad Monitor #6499
Nomad Monitor #6499
Conversation
0b5b068
to
41b053f
Compare
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.
Yay! Very excited about this. The framing might be obnoxious, but that can be done in a followup PR. I'm not quite through yet but will pick this up in the morning.
4f0befc
to
cac0a6d
Compare
77c7a04
to
43ea91b
Compare
e385bc9
to
b0a0cf0
Compare
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.
a few questions about locking in Monitor
, but i'll leave it up to your judgement and check again if you have questions.
} | ||
} | ||
|
||
func TestMonitor_Monitor_ACL(t *testing.T) { |
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.
👍 💯 🏆
command/agent/monitor/monitor.go
Outdated
break LOOP | ||
case <-time.After(d.droppedDuration): | ||
d.Lock() | ||
defer d.Unlock() |
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.
i'm thinking that this shouldn't be a defer, but instead an inline call to unlock after the if
block
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.
I think we want to hold onto the lock until after all the selects to ensure that a write doesn't steal the space we create to add the dropped message
command/agent/monitor/monitor.go
Outdated
} | ||
case <-stopCh: | ||
d.Lock() | ||
defer d.Unlock() |
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.
not sure whether this lock/unlock is needed, but it doesn't hurt anything.
not sure whether this is still true based on our personal conversation and other changes in flight
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.
I think its unnecessary as well, will remove
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.
if we are closing d.logCh
here, then we need the lock to protect from other goroutines using this channel. if we aren't closing this channel, then i think we can drop the lock here.
This version of gziphandler includes a fix that fixes GzipResponseWriter to implement CloseNotifier nytimes/gziphandler#63
AgentMonitor is an endpoint to stream logs for a given agent. It allows callers to pass in a supplied log level, which may be different than the agents config allowing for temporary debugging with lower log levels. Pass in logWriter when setting up Agent
Queries /v1/agent/monitor and receives streaming logs from client
Adds nomad monitor command. Like consul monitor, this command allows you to stream logs from a nomad agent in real time with a a specified log level add endpoint tests Upgrade go-hclog to latest version The current version of go-hclog pads log prefixes to equal lengths so info becomes [INFO ] and debug becomes [DEBUG]. This breaks hashicorp/logutils/level.go Check function. Upgrading to the latest version removes this padding and fixes log filtering that uses logutils Check
multisink logger remove usage of logwriter
prefix output with proper spacing update gzip handler, adjust first byte flow to allow gzip handler bypass wip, first stab at wiring up rpc endpoint
Adds new package that can be used by client and server RPC endpoints to facilitate monitoring based off of a logger clean up old code small comment about write rm old comment about minsize rename to Monitor Removes connection logic from monitor command Keep connection logic in endpoints, use a channel to send results from monitoring use new multisink logger and interfaces small test for dropped messages update go-hclogger and update sink/intercept logger interfaces
underscores instead of dashes for query params
Addresses feedback around monitor implementation subselect on stopCh to prevent blocking forever. Set up a separate goroutine to check every 3 seconds for dropped messages. rename returned ch to avoid confusion
rm redundant lock wip to use framing wip switch to stream frames
rm extra new line fix lint errors return after close fix, simplify test
remove unused struct
fix typo command/agent/monitor/monitor.go Co-Authored-By: Chris Baker <1675087+cgbaker@users.noreply.github.com> Update command/agent/monitor/monitor.go Co-Authored-By: Chris Baker <1675087+cgbaker@users.noreply.github.com> address feedback, lock to prevent send on closed channel fix lock/unlock for dropped messages
995a23b
to
620fba5
Compare
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.
looks correct, i think there's some opportunity for simplification
command/agent/monitor/monitor.go
Outdated
} | ||
case <-stopCh: | ||
d.Lock() | ||
defer d.Unlock() |
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.
if we are closing d.logCh
here, then we need the lock to protect from other goroutines using this channel. if we aren't closing this channel, then i think we can drop the lock here.
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.
need to unlock before quitting the dropped-goroutine
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.
👍 🚀
comment, trigger build return length written
65036cb
to
03f0aff
Compare
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
This PR adds a new top level command
nomad monitor
.This command is similar to
consul monitor
in that it is used to stream logs using a configurable log level without needing to change the server/client log levels.#6365