databroker: add tracing for rego evaluation and databroker sync, fix bug in databroker config source (#1367)

This commit is contained in:
Caleb Doxsey 2020-09-03 08:11:34 -06:00 committed by GitHub
parent 5488e6d5fa
commit 49d1a71ff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View file

@ -8,6 +8,8 @@ import (
"github.com/open-policy-agent/opa/rego"
"github.com/open-policy-agent/opa/storage"
"github.com/pomerium/pomerium/internal/telemetry/trace"
)
// A CustomEvaluatorRequest is the data needed to evaluate a custom rego policy.
@ -42,6 +44,9 @@ func NewCustomEvaluator(store storage.Store) *CustomEvaluator {
// Evaluate evaluates the custom rego policy.
func (ce *CustomEvaluator) Evaluate(ctx context.Context, req *CustomEvaluatorRequest) (*CustomEvaluatorResponse, error) {
_, span := trace.StartSpan(ctx, "authorize.evaluator.custom.Evaluate")
defer span.End()
q, err := ce.getPreparedEvalQuery(ctx, req.RegoPolicy)
if err != nil {
return nil, err