Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1672)

Issue 44540043: apiserver/logger: adding command for debug log

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 4 months ago by mue
Modified:
10 years, 2 months ago
Reviewers:
mp+199799, william.reade, fwereade
Visibility:
Public.

Description

apiserver/logger: adding command for debug log The command providing a filtered watching of the all-machines.log is handled by the new component logTailer based on the Tailer. N.B. While the logTailer and the here used channelWriter are already tested the tests for the API itself are still missing. This finishing will be pushed extra in the same CL. N.B. The CL also contains a small detected fix for the Tailer. https://code.launchpad.net/~themue/juju-core/058-debug-log-api/+merge/199799 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 27

Patch Set 2 : apiserver/logger: adding command for debug log #

Patch Set 3 : apiserver/logger: adding command for debug log #

Patch Set 4 : apiserver/logger: adding command for debug log #

Total comments: 12

Patch Set 5 : apiserver/logger: adding command for debug log #

Patch Set 6 : apiserver/logger: adding command for debug log #

Patch Set 7 : apiserver/logger: adding command for debug log #

Patch Set 8 : apiserver/logger: adding command for debug log #

Patch Set 9 : apiserver/logger: adding command for debug log #

Patch Set 10 : apiserver/logger: adding command for debug log #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+1033 lines, -15 lines) Patch
A [revision details] View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M state/api/client.go View 1 2 3 4 5 6 7 2 chunks +24 lines, -0 lines 0 comments Download
M state/api/params/params.go View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download
A state/apiserver/debugger/debugger.go View 1 2 3 4 5 6 7 8 9 1 chunk +97 lines, -0 lines 6 comments Download
A state/apiserver/debugger/debugger_test.go View 1 2 3 4 5 6 7 8 9 1 chunk +210 lines, -0 lines 2 comments Download
A state/apiserver/debugger/export_test.go View 1 1 chunk +25 lines, -0 lines 0 comments Download
A state/apiserver/debugger/logtailer.go View 1 2 3 4 5 6 7 8 9 1 chunk +196 lines, -0 lines 2 comments Download
A state/apiserver/debugger/logtailer_test.go View 1 2 3 4 1 chunk +347 lines, -0 lines 0 comments Download
A state/apiserver/debugger/package_test.go View 1 2 3 4 1 chunk +75 lines, -0 lines 0 comments Download
M state/apiserver/logger/logger.go View 1 1 chunk +1 line, -1 line 0 comments Download
M state/apiserver/root.go View 1 2 3 4 5 6 7 8 9 3 chunks +10 lines, -3 lines 2 comments Download
M utils/tailer/tailer.go View 1 2 3 4 5 6 7 8 9 6 chunks +20 lines, -9 lines 0 comments Download
M utils/tailer/tailer_test.go View 1 2 3 4 chunks +13 lines, -2 lines 0 comments Download

Messages

Total messages: 15
mue
Please take a look.
10 years, 4 months ago (2013-12-20 12:48:03 UTC) #1
fwereade
Mostly solid, but I have a few significant concerns. Let me know your thoughts. https://codereview.appspot.com/44540043/diff/1/state/api/logger/logger.go ...
10 years, 4 months ago (2014-01-02 09:35:08 UTC) #2
mue
Please take a look. https://codereview.appspot.com/44540043/diff/1/state/api/logger/logger.go File state/api/logger/logger.go (right): https://codereview.appspot.com/44540043/diff/1/state/api/logger/logger.go#newcode73 state/api/logger/logger.go:73: // WatchDebugLog starts a StringsWatcher ...
10 years, 4 months ago (2014-01-09 13:07:58 UTC) #3
mue
Please take a look.
10 years, 3 months ago (2014-01-10 11:34:40 UTC) #4
mue
Please take a look.
10 years, 3 months ago (2014-01-10 12:33:01 UTC) #5
william.reade
preliminary responses pre-full-review https://codereview.appspot.com/44540043/diff/1/state/api/logger/logger.go File state/api/logger/logger.go (right): https://codereview.appspot.com/44540043/diff/1/state/api/logger/logger.go#newcode78 state/api/logger/logger.go:78: Watchings: []params.DebugLogWatching{ On 2014/01/09 13:07:59, mue ...
10 years, 3 months ago (2014-01-13 09:31:01 UTC) #6
william.reade
Nearly there, I think. https://codereview.appspot.com/44540043/diff/60001/state/api/logger/logger.go File state/api/logger/logger.go (right): https://codereview.appspot.com/44540043/diff/60001/state/api/logger/logger.go#newcode75 state/api/logger/logger.go:75: func (st *State) WatchDebugLog(lines int, ...
10 years, 3 months ago (2014-01-14 14:41:41 UTC) #7
mue
Please take a look. https://codereview.appspot.com/44540043/diff/60001/state/api/logger/logger.go File state/api/logger/logger.go (right): https://codereview.appspot.com/44540043/diff/60001/state/api/logger/logger.go#newcode75 state/api/logger/logger.go:75: func (st *State) WatchDebugLog(lines int, ...
10 years, 3 months ago (2014-01-15 13:14:16 UTC) #8
mue
Please take a look.
10 years, 3 months ago (2014-01-17 13:23:42 UTC) #9
mue
Please take a look.
10 years, 3 months ago (2014-01-17 17:12:48 UTC) #10
mue
Please take a look.
10 years, 3 months ago (2014-01-21 08:48:47 UTC) #11
mue
Please take a look.
10 years, 3 months ago (2014-01-21 16:03:09 UTC) #12
mue
Please take a look.
10 years, 3 months ago (2014-01-23 14:16:54 UTC) #13
fwereade
Looking good, but I think we need to know a bit more about how it ...
10 years, 3 months ago (2014-01-23 16:22:58 UTC) #14
mue
10 years, 3 months ago (2014-01-23 16:41:51 UTC) #15
Thank you for your hints, will change the code.

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
File state/apiserver/debugger/debugger.go (right):

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
state/apiserver/debugger/debugger.go:25: const maxLogLines = 256
On 2014/01/23 16:22:58, fwereade wrote:
> How long does it take for this to be filled in a moderately busy environment?
> Say 20 units, all running hooks? I think this number should probably be quite
a
> lot larger...

Yeah, no problem, has been a first shot. 2^16 too high? Funnily still using
binary numbers, but also could be 10 000, 50 000 or 100 000.

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
state/apiserver/debugger/debugger.go:78: if entity.Tag != environ.Tag() {
On 2014/01/23 16:22:58, fwereade wrote:
> I think we should filter out tags that aren't machine/unit ones. It's fine if
> they don't exist, I think (historical information feels to me like it could be
> valid), but not fine if they're not well-formed or for sensible entities.

Would reduce the amount of data too, good. But in case of the environment tag
still everything?

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
state/apiserver/debugger/debugger.go:90: if changes, ok :=
<-logTailer.Changes(); ok {
On 2014/01/23 16:22:58, fwereade wrote:
> Is this guaranteed to return an empty []string if there aren't any to send
yet?
> The expectation for stringswatchers is that the initial request will return
> soon.

See tests. Also testing on EC2 showed a fine behavior. :)

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
File state/apiserver/debugger/debugger_test.go (right):

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
state/apiserver/debugger/debugger_test.go:68: initialCollected: []string{},
On 2014/01/23 16:22:58, fwereade wrote:
> looks like it is, nice :)

\o/

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
File state/apiserver/debugger/logtailer.go (right):

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/debugger/...
state/apiserver/debugger/logtailer.go:193: lines =
lines[len(lines)-cw.maxLines:]
On 2014/01/23 16:22:58, fwereade wrote:
> I don't think this is correct -- silently skipping changes STM to be far worse
> than straight-up failing.

So if the (increased) limit is reached return with an error? Would be at least a
well defined behavior, yes. Will change.

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/root.go
File state/apiserver/root.go (right):

https://codereview.appspot.com/44540043/diff/180001/state/apiserver/root.go#n...
state/apiserver/root.go:165: func (r *srvRoot) Debugger(id string)
(*debugger.DebuggerAPI, error) {
On 2014/01/23 16:22:58, fwereade wrote:
> This should probably be requiring a client, right?

See api/client.go line 533ff. But maybe I'm getting the mechanisms of the API
wrong. I also would have preferred a different package structure:

juju-core/api
        .../common
        .../client
        .../server
juju-core/state

Sometimes I've been lost in the dependencies and namings.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b