diff --git a/filters/openpolicyagent/opaserveresponse/opaserveresponse.go b/filters/openpolicyagent/opaserveresponse/opaserveresponse.go index 64ad14d1f9..e95104dfbe 100644 --- a/filters/openpolicyagent/opaserveresponse/opaserveresponse.go +++ b/filters/openpolicyagent/opaserveresponse/opaserveresponse.go @@ -126,9 +126,21 @@ func (f *opaServeResponseFilter) Request(fc filters.FilterContext) { fc.Metrics().MeasureSince(f.opa.MetricsKey("eval_time"), start) if err != nil { f.opa.ServeInvalidDecisionError(fc, span, result, err) + return + } + allowed, err := result.IsAllowed() + if err != nil { + f.opa.ServeInvalidDecisionError(fc, span, result, err) return } + span.SetTag("opa.decision.allowed", allowed) + + if allowed { + fc.Metrics().IncCounter(f.opa.MetricsKey("decision.allow")) + } else { + fc.Metrics().IncCounter(f.opa.MetricsKey("decision.deny")) + } f.opa.ServeResponse(fc, span, result) }