allow observability operation error filter to choose error output destination(s)
Created by: Strum355
This PR allows for the observability operation error filter to elect to have certain errors only redirected to certain outputs e.g. only add the error to the trace and metric counter but not to logs. By returning a bitfield uint8, one can have any combination of output redirection:
-
observation.EmitForTraces | observation.EmitForMetrics
to have an error tracked in metrics and attached to the opentracing span but not printed to logs -
observation.EmitForAll
to emit to all 3 destinations (akin toreturn false
from previous behaviour) -
observation.EmitForNone
to not emit anywhere (akin toreturn true
from previous behaviour) - etc etc...
Use case arose from https://github.com/sourcegraph/sourcegraph/pull/23720 where I wanted the above behaviour.