Skip to content

Commit

Permalink
OPA: Add decision outcome to span in opaServeResponse filter
Browse files Browse the repository at this point in the history
Signed-off-by: Farasath Ahamed <[email protected]>
  • Loading branch information
Farasath Ahamed committed Aug 15, 2024
1 parent 05bd5f8 commit 5d981e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions filters/openpolicyagent/opaserveresponse/opaserveresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,15 @@ 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)

f.opa.ServeResponse(fc, span, result)
}
Expand Down

0 comments on commit 5d981e3

Please sign in to comment.