-
Notifications
You must be signed in to change notification settings - Fork 67
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 metrics to hystrix #768
Conversation
t := time.Now() | ||
elapsed := t.Sub(start) |
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.
nit: can be refactored to time.Now().Sub(start)
. Having t as a var doesn't add extra clarity here.
@@ -266,7 +267,15 @@ type {{$clientName}} struct { | |||
} else { | |||
// We want hystrix ckt-breaker to count errors only for system issues | |||
var clientErr error | |||
scope := c.defaultDeps.Scope.Tagged(map[string]string{ | |||
"client" : "{{$svc.Name}}", |
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.
we should add the methodName too
err = hystrix.DoC(ctx, "{{$clientID}}", func(ctx context.Context) error { | ||
t := time.Now() | ||
elapsed := t.Sub(start) | ||
size := scope.Timer("hystrix-timer") |
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.
size
doesn't suit here, probably timer. You may even just do scope.Timer("hystrix-timer").Record(elapsed)
without requiring a new var.
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 good, thanks for adding the new test cases!
Goal: Time the hystrics.Doc function called in all the client template codegen file. This is to check that hystrix.Doc isn't slow and isn't taking time from the actual request. This problem was stated in this ticket: https://t3.uberinternal.com/browse/EDGE-7509 . A dashboard will be created to graph time taken by hystrix for each client in Grafana.
From baz_metrics_test.go (client: baz, method: call) :