Skip to content

Commit

Permalink
also lookup scopedef by common if not found by service (#2959)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreiding committed Jun 7, 2022
1 parent 48cc8d1 commit b4f2ff5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions common/metrics/events_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,20 @@ var (
)

func newEventsScope(provider MetricProvider, idx ServiceIdx, id int) eventsScope {
def, ok := ScopeDefs[idx][id]
if !ok {
def, ok = ScopeDefs[Common][id]
if !ok {
panic(fmt.Errorf("failed to lookup scope by id %v and service %v", id, idx))
}
}

return eventsScope{
provider: provider,
serviceIdx: idx,
scopeId: id,
scopeTags: scopeDefToTags(ScopeDefs[idx][id]),
scopeDef: ScopeDefs[idx][id],
scopeTags: scopeDefToTags(def),
scopeDef: def,
}
}

Expand Down

0 comments on commit b4f2ff5

Please sign in to comment.