Adds the possibility to vary the template of tablet debug urls.#3842
Adds the possibility to vary the template of tablet debug urls.#3842michael-berlin merged 4 commits intovitessio:masterfrom
Conversation
e32b7ef to
5c32594
Compare
michael-berlin
left a comment
There was a problem hiding this comment.
Change looks good to me after my comment is addressed.
Do you actually need to customize the whole path? A prefix would not be good enough?
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
This is not good because you would crash the vtgate at runtime.
Instead, you could make the template a global variable and set it during init().
Also, please use Exitf instead of Fatalf: https://godoc.org/github.com/golang/glog#Exitf
There was a problem hiding this comment.
Yeah thanks for the tip. It's been fixed I think. I'm clearly still green behind the ears.
5c32594 to
7fd2143
Compare
|
@michael-berlin I think all that I'm customizing is the prefix, or that the prefix is all that is included in the link. If you have any recommended improvements with that context then I'd happily do them. |
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
We (at Slack) have a similar issue and have never put the time into addressing it so thanks for this feature.
However I'd like to be able to format an URL based on just the hostname without the port. From my brief understanding of the code it seems like I could do this with "http://{{.GetHostNameLevel 0}}.some.domain" -- if so that would be perfect, but if not then it'd be great to enable this as part of this change.
There was a problem hiding this comment.
GetHostNameLevel is there to help divide up the hostname into it's components. If you want the whole thing I think http://{{.Tablet.Hostname}} should work.
There was a problem hiding this comment.
I actually just tested this out and it indeed works.
There was a problem hiding this comment.
I feel like this is a non-trivial feature. How about leaving a pointer in this help text for interested users?
e.g. add: "See the Go code for getTabletDebugURL() how to customize this."
And then you can document the feature and tricks like {{.Tablet.Hostname}} there.
michael-berlin
left a comment
There was a problem hiding this comment.
Having a full fledged template here seems to be preferred over adding a simple prefix. That works for me.
Can you please address my comments? After that I can merge it. Thank you :)
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
This is currently unused. I assume you want to use it in your custom templates?
Please document how to use this and why it must be kept in the code.
Also, please add a test for this method. This will better demonstrate the intended use and also make sure that this functionality won't be broken.
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
I feel like this is a non-trivial feature. How about leaving a pointer in this help text for interested users?
e.g. add: "See the Go code for getTabletDebugURL() how to customize this."
And then you can document the feature and tricks like {{.Tablet.Hostname}} there.
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
nit: missing period
See: https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
nit: missing period
See: https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences
go/vt/discovery/healthcheck.go
Outdated
There was a problem hiding this comment.
Can you please move this to the first group of imports?
7fd2143 to
7206854
Compare
|
@michael-berlin I think I've addressed all of your comments now. |
7206854 to
02e7657
Compare
Signed-off-by: Michael Pawliszyn <mpawliszyn@gmail.com>
Signed-off-by: Michael Berlin <mberlin@google.com>
It is only used for tests in the same package. Signed-off-by: Michael Berlin <mberlin@google.com>
This way we avoid that a partial match would be a success as well. Signed-off-by: Michael Berlin <mberlin@google.com>
02e7657 to
9dd560d
Compare
|
Thank you for addressing all the comments and the test :) The documentation of the feature looks very good now :) I've rebased the code and fixed some minor nitpicks from my side (see the additional commits). I'll merge this as soon as tests have passed. |
Sometimes the way you get to a tablet from a webpage is different from how a machine does it from within the same part of the network fabric.