Skip to content

Commit

Permalink
Fix prometheus frontend label inconsistencies (uber#5087)
Browse files Browse the repository at this point in the history
Fix prometheus frontend label inconsistencies (uber#5087)
  • Loading branch information
charlese-instaclustr committed Mar 9, 2023
1 parent d04521d commit 9643242
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ const (
const (
// AdminDescribeHistoryHostScope is the metric scope for admin.AdminDescribeHistoryHostScope
AdminDescribeHistoryHostScope = iota + NumCommonScopes
// AdminDescribeClusterScope is the metric scope for admin.AdminDescribeClusterScope
AdminDescribeClusterScope
// AdminAddSearchAttributeScope is the metric scope for admin.AdminAddSearchAttributeScope
AdminAddSearchAttributeScope
// AdminDescribeWorkflowExecutionScope is the metric scope for admin.AdminDescribeWorkflowExecutionScope
Expand Down Expand Up @@ -1552,6 +1554,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{
AdminMergeDLQMessagesScope: {operation: "AdminMergeDLQMessages"},
AdminDescribeHistoryHostScope: {operation: "DescribeHistoryHost"},
AdminDescribeShardDistributionScope: {operation: "AdminShardList"},
AdminDescribeClusterScope: {operation: "DescribeCluster"},
AdminAddSearchAttributeScope: {operation: "AddSearchAttribute"},
AdminDescribeWorkflowExecutionScope: {operation: "DescribeWorkflowExecution"},
AdminGetWorkflowExecutionRawHistoryScope: {operation: "GetWorkflowExecutionRawHistory"},
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/accessControlledHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (a *AccessControlledWorkflowHandler) ListDomains(
request *types.ListDomainsRequest,
) (*types.ListDomainsResponse, error) {

scope := a.GetMetricsClient().Scope(metrics.FrontendListDomainsScope)
scope := a.GetMetricsClient().Scope(metrics.FrontendListDomainsScope).Tagged(metrics.DomainUnknownTag())

attr := &authorization.Attributes{
APIName: "ListDomains",
Expand Down
4 changes: 2 additions & 2 deletions service/frontend/adminHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ func (adh *adminHandlerImpl) DescribeCluster(
) (resp *types.DescribeClusterResponse, retError error) {

defer func() { log.CapturePanic(recover(), adh.GetLogger(), &retError) }()
scope, sw := adh.startRequestProfile(ctx, metrics.AdminGetWorkflowExecutionRawHistoryV2Scope)
scope, sw := adh.startRequestProfile(ctx, metrics.AdminDescribeClusterScope)
defer sw.Stop()

// expose visibility store backend and if advanced options are available
Expand Down Expand Up @@ -1544,7 +1544,7 @@ func (adh *adminHandlerImpl) validatePaginationToken(

// startRequestProfile initiates recording of request metrics
func (adh *adminHandlerImpl) startRequestProfile(ctx context.Context, scope int) (metrics.Scope, metrics.Stopwatch) {
metricsScope := adh.GetMetricsClient().Scope(scope).Tagged(metrics.GetContextTags(ctx)...)
metricsScope := adh.GetMetricsClient().Scope(scope).Tagged(metrics.DomainUnknownTag()).Tagged(metrics.GetContextTags(ctx)...)
sw := metricsScope.StartTimer(metrics.CadenceLatency)
metricsScope.IncCounter(metrics.CadenceRequests)
return metricsScope, sw
Expand Down

0 comments on commit 9643242

Please sign in to comment.