-
Notifications
You must be signed in to change notification settings - Fork 343
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 TO Go cdns/health and cdns/{name}/health #2305
Conversation
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
8b9adb6
to
7ec9108
Compare
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
lib/go-tc/enum.go
Outdated
@@ -53,6 +53,8 @@ type DeliveryServiceName string | |||
// CacheType is the type (or tier) of a CDN cache. | |||
type CacheType string | |||
|
|||
const MonitorTypeName = "RASCAL" |
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.
Do we think this should be a config? I have seen several times now where the type "RASCAL" was hard-coded and we had to change our TM type. IMO you should be able to make the type whatever you want and it should work.
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 it should definitely be a config, once we've moved everything to Go. But right now, it's still hard-coded all over Perl.
I don't think we should make a config yet, which would make people think they could change it, when it'd still break to be anything but "RASCAL".
But definitely +100 when it's all Go, and we can set one variable. I've wanted to change our db "RASCAL" type to something like "monitor" for ages.
I would expect a heathtest.go to be a part of this PR is there a reason it is not included? |
Not sure what you mean. What would be in healthtest.go? |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
3f7eae2
to
9308805
Compare
Refer to this link for build results (access rights to CI server needed): |
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.
One minor comment - also should we be adding tests?
return monitors, nil | ||
} | ||
|
||
func GetCRStates(monitorFQDN string, client *http.Client) (tc.CRStates, error) { |
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.
Given this looks like duplicate logic from https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/cdn/capacity.go as well as https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/cachesstats/cachesstats.go#L202 should you go ahead and replace the other functions with this utility function?
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.
Yes, they were copy-pasted, because the PRs were open at the same time, with the intention of combining them after one was merged to master. Good catch. I'll do that now.
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.
Done. Also with GetCRConfig
.
This endpoint calls out to Traffic Monitor. The "API Test" framework doesn't currently support Monitors. It's also not really possible to unit test; we could mock everything, but it wouldn't be testing much of anything at that point (which is why we've been doing "API Tests" for TO). We should definitely test this (and other Monitor endpoints) when the API Tests support it. But it'll be a nontrivial amount of work to add that support. I just made #3924 - we had one for Riak, but not Monitors. |
Yes it will have the same problem |
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'd like to look into #3927 first. Not sure when I'll have time. It shouldn't be necessary, HTTP/2 is backwards-compatible by design. If a client tries to use H2, and a server doesn't support it, it automatically falls back to H1. If it doesn't, the Server is violating HTTP/1.1. So, it shouldn't ever be necessary to forcibly disable it. I'd like to at least understand why it's necessary. |
9308805
to
1b2474e
Compare
Refer to this link for build results (access rights to CI server needed): |
Ok, I investigated, determined Go 1.13 http.Transport fundamentally doesn't support H2 Proxies. I added the code from #3927 and a comment to that effect. See golang/go#26479 "We only support http1 proxies currently." Rebased; manually tested again, still works as expected, still matches Perl. |
1b2474e
to
e91e64f
Compare
e91e64f
to
3e8cdb6
Compare
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
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.
code looks good and tests locally good
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.
appears to work as the Perl did.
Rewrites
/cdns/health
and/cdns/{{name}}/health
to Go. Closes #3778 and closes #3779 .