-
Notifications
You must be signed in to change notification settings - Fork 800
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 AccessControlledHandler #3145
Conversation
@@ -121,11 +121,15 @@ func (a *AccessControlledWorkflowHandler) DeprecateDomain( | |||
request *shared.DeprecateDomainRequest, | |||
) error { | |||
|
|||
scope := a.GetResource().GetMetricsClient(). |
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.
Can we use getMetricsScopeWithDomain
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.
Request in XXXDomain APIs are not domainGetter, so hard to reuse. But I make it a function to some some lines.
} | ||
|
||
// getMetricsScopeWithDomain return metrics scope with domain tag | ||
func (a *AccessControlledWorkflowHandler) getMetricsScopeWithDomain( |
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.
How about just making the following method a utility method that takes in a metrics client instead of duplicating the code
// startRequestProfileWithDomain initiates recording of request metrics and returns a domain tagged scope
func (wh *WorkflowHandler) startRequestProfileWithDomain(scope int, d domainGetter) (metrics.Scope, metrics.Stopwatch) {
var metricsScope metrics.Scope
if d != nil {
metricsScope = wh.GetMetricsClient().Scope(scope).Tagged(metrics.DomainTag(d.GetDomain()))
} else {
metricsScope = wh.GetMetricsClient().Scope(scope).Tagged(metrics.DomainUnknownTag())
}
sw := metricsScope.StartTimer(metrics.CadenceLatency)
metricsScope.IncCounter(metrics.CadenceRequests)
return metricsScope, sw
}
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.
updated.
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.
Some nits but feel free to ignore.
What changed?
Add metrics to AccessControlledHandler
Why?
For monitoring authorization status
How did you test it?
Unit test
Potential risks
No risk