Skip to content

Commit

Permalink
Fix consistent query metric (#5170)
Browse files Browse the repository at this point in the history
* add shardid tag to log

* remove counter for overall scope

* fix lint
  • Loading branch information
ketsiambaku authored Apr 12, 2023
1 parent eade936 commit c5678dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,16 +1158,15 @@ func (e *historyEngineImpl) QueryWorkflow(
) (retResp *types.HistoryQueryWorkflowResponse, retErr error) {

scope := e.metricsClient.Scope(metrics.HistoryQueryWorkflowScope).Tagged(metrics.DomainTag(request.GetRequest().GetDomain()))
shardMetricScope := e.metricsClient.Scope(metrics.HistoryQueryWorkflowScope).Tagged(metrics.ShardIDTag(strconv.Itoa(e.shard.GetShardID())))
shardMetricScope := e.metricsClient.Scope(metrics.HistoryQueryWorkflowScope, metrics.ShardIDTag(strconv.Itoa(e.shard.GetShardID())))

consistentQueryEnabled := e.config.EnableConsistentQuery() && e.config.EnableConsistentQueryByDomain(request.GetRequest().GetDomain())
if request.GetRequest().GetQueryConsistencyLevel() == types.QueryConsistencyLevelStrong {
if !consistentQueryEnabled {
return nil, workflow.ErrConsistentQueryNotEnabled
}
scope.IncCounter(metrics.ConsistentQueryPerShard)
shardMetricScope.IncCounter(metrics.ConsistentQueryPerShard)
e.logger.SampleInfo("History QueryWorkflow called with QueryConsistencyLevelStrong", e.config.SampleLoggingRate(), tag.WorkflowID(request.GetRequest().Execution.WorkflowID), tag.WorkflowDomainName(request.GetRequest().Domain))
e.logger.SampleInfo("History QueryWorkflow called with QueryConsistencyLevelStrong", e.config.SampleLoggingRate(), tag.ShardID(e.shard.GetShardID()), tag.WorkflowID(request.GetRequest().Execution.WorkflowID), tag.WorkflowDomainName(request.GetRequest().Domain))
}

execution := *request.GetRequest().GetExecution()
Expand Down

0 comments on commit c5678dd

Please # to comment.