Merge pull request #72 from libp2p/marco/record-block-resource-dir

Record which direction the resource was blocked
This commit is contained in:
Marco Munizaga 2022-07-27 16:01:06 +02:00 committed by GitHub
commit 712ddd3d0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,14 +317,22 @@ func (r StatsTraceReporter) ConsumeEvent(evt rcmgr.TraceEvt) {
// Drop the connection or stream id
scopeName = strings.SplitN(scopeName, "-", 2)[0]
// If something else gets added here, make sure to update the size hint
// below when we make `tagsWithDir`.
tags := []tag.Mutator{tag.Upsert(scopeTag, scopeName), tag.Upsert(resourceTag, resource)}
if evt.DeltaIn != 0 {
stats.RecordWithTags(ctx, tags, blockedResources.M(int64(1)))
tagsWithDir := make([]tag.Mutator, 3)
tagsWithDir = append(tagsWithDir, tag.Insert(directionTag, "inbound"))
tagsWithDir = append(tagsWithDir, tags...)
stats.RecordWithTags(ctx, tagsWithDir[0:], blockedResources.M(int64(1)))
}
if evt.DeltaOut != 0 {
stats.RecordWithTags(ctx, tags, blockedResources.M(int64(1)))
tagsWithDir := make([]tag.Mutator, 3)
tagsWithDir = append(tagsWithDir, tag.Insert(directionTag, "outbound"))
tagsWithDir = append(tagsWithDir, tags...)
stats.RecordWithTags(ctx, tagsWithDir, blockedResources.M(int64(1)))
}
if evt.Delta != 0 {