Skip to content

Commit

Permalink
Add domain tag on workflow handler metrics (cadence-workflow#1648)
Browse files Browse the repository at this point in the history
* Move workflow handler metrics to new style metrics emission
* Add domain tag to scope once we have it available. Ensure timers are additionally emitted with domain tag `all`
* Method to create a noop scope for tests
  • Loading branch information
shreyassrivatsan authored Apr 11, 2019
1 parent 7f541f0 commit a5880aa
Show file tree
Hide file tree
Showing 5 changed files with 307 additions and 117 deletions.
5 changes: 5 additions & 0 deletions common/metrics/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func newMetricsScope(scope tally.Scope, defs map[int]metricDefinition) Scope {
return &metricsScope{scope, defs}
}

// NoopScope returns a noop scope of metrics
func NoopScope(serviceIdx ServiceIdx) Scope {
return &metricsScope{tally.NoopScope, getMetricDefs(serviceIdx)}
}

func (m *metricsScope) IncCounter(id int) {
name := string(m.defs[id].metricName)
m.scope.Counter(name).Inc(1)
Expand Down
10 changes: 2 additions & 8 deletions common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,8 @@ func CreateHistoryStartWorkflowRequest(domainID string, startRequest *workflow.S

// CheckEventBlobSizeLimit checks if a blob data exceeds limits. It logs a warning if it exceeds warnLimit,
// and return ErrBlobSizeExceedsLimit if it exceeds errorLimit.
func CheckEventBlobSizeLimit(actualSize, warnLimit, errorLimit int, domainID, workflowID, runID string, metricsClient metrics.Client, scope int, logger bark.Logger) error {
if metricsClient != nil {
metricsClient.RecordTimer(
scope,
metrics.EventBlobSize,
time.Duration(actualSize),
)
}
func CheckEventBlobSizeLimit(actualSize, warnLimit, errorLimit int, domainID, workflowID, runID string, scope metrics.Scope, logger bark.Logger) error {
scope.RecordTimer(metrics.EventBlobSize, time.Duration(actualSize))

if actualSize > warnLimit {
if logger != nil {
Expand Down
Loading

0 comments on commit a5880aa

Please sign in to comment.