Skip to content

Commit ba1218f

Browse files
committed
Add task category tag to history tasks metrics
1 parent ffee895 commit ba1218f

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

common/metrics/tags.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ func NamespaceTag(namespace string) Tag {
347347
return metricWithUnknown("namespace", namespace)
348348
}
349349

350+
func TaskCategoryTag(category string) Tag {
351+
return metricWithUnknown("task_category", category)
352+
}
353+
350354
// ReasonTag returns a new reason tag
351355
func ReasonTag(reason string) Tag {
352356
return metricWithUnknown("reason", reason)

common/persistence/data_manager_interfaces.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ const (
178178
type HistoryTaskCategory struct {
179179
categoryType int
180180
categoryID int
181+
categoryName string
181182
}
182183

183184
func (c *HistoryTaskCategory) Type() int {
@@ -188,6 +189,10 @@ func (c *HistoryTaskCategory) ID() int {
188189
return c.categoryID
189190
}
190191

192+
func (c *HistoryTaskCategory) Name() string {
193+
return c.categoryName
194+
}
195+
191196
const (
192197
HistoryTaskCategoryTypeImmediate = iota + 1
193198
HistoryTaskCategoryTypeScheduled
@@ -203,14 +208,17 @@ var (
203208
HistoryTaskCategoryTransfer = HistoryTaskCategory{
204209
categoryType: HistoryTaskCategoryTypeImmediate,
205210
categoryID: HistoryTaskCategoryIDTransfer,
211+
categoryName: "transfer",
206212
}
207213
HistoryTaskCategoryTimer = HistoryTaskCategory{
208214
categoryType: HistoryTaskCategoryTypeScheduled,
209215
categoryID: HistoryTaskCategoryIDTimer,
216+
categoryName: "timer",
210217
}
211218
HistoryTaskCategoryReplication = HistoryTaskCategory{
212219
categoryType: HistoryTaskCategoryTypeImmediate,
213220
categoryID: HistoryTaskCategoryIDReplication,
221+
categoryName: "replication",
214222
}
215223
)
216224

common/persistence/metered.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,3 +438,7 @@ func (r GetCurrentExecutionRequest) GetDomainName() string {
438438
func (r GetCurrentExecutionRequest) GetExtraLogTags() []tag.Tag {
439439
return []tag.Tag{tag.WorkflowID(r.WorkflowID)}
440440
}
441+
442+
func (r GetHistoryTasksRequest) MetricTags() []metrics.Tag {
443+
return []metrics.Tag{metrics.TaskCategoryTag(r.TaskCategory.Name())}
444+
}

0 commit comments

Comments
 (0)