Skip to content

Commit

Permalink
fix: add traffic-type label to distinguish pass type, fix alibaba#501
Browse files Browse the repository at this point in the history
  • Loading branch information
qshuai authored Jan 16, 2023
1 parent 0d804bb commit 8dbc6d7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/stat/stat_slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var (
handledCounter = metric_exporter.NewCounter(
"handled_total",
"Total handled count",
[]string{"resource", "result", "block_type"})
[]string{"resource", "result", "block_type", "traffic_type"})
)

func init() {
Expand All @@ -52,7 +52,7 @@ func (s *Slot) OnEntryPassed(ctx *base.EntryContext) {
s.recordPassFor(InboundNode(), ctx.Input.BatchCount)
}

handledCounter.Add(float64(ctx.Input.BatchCount), ctx.Resource.Name(), ResultPass, "")
handledCounter.Add(float64(ctx.Input.BatchCount), ctx.Resource.Name(), ResultPass, "", ctx.Resource.FlowType().String())
}

func (s *Slot) OnEntryBlocked(ctx *base.EntryContext, blockError *base.BlockError) {
Expand All @@ -61,7 +61,8 @@ func (s *Slot) OnEntryBlocked(ctx *base.EntryContext, blockError *base.BlockErro
s.recordBlockFor(InboundNode(), ctx.Input.BatchCount)
}

handledCounter.Add(float64(ctx.Input.BatchCount), ctx.Resource.Name(), ResultBlock, blockError.BlockType().String())
handledCounter.Add(float64(ctx.Input.BatchCount), ctx.Resource.Name(), ResultBlock,
blockError.BlockType().String(), ctx.Resource.FlowType().String())
}

func (s *Slot) OnCompleted(ctx *base.EntryContext) {
Expand Down

0 comments on commit 8dbc6d7

Please sign in to comment.