open-policy-agent / open-policy-agent/java-opa-sdk

Expose Metrics to builtins via BuiltinContext

Open
#57 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

evaluator metrics
Dominant language
Java
Stars
16
Forks
24
Avg merge
8h 17m
Merged PRs (30d)
15

Description

BuiltinContext (opa-evaluator/.../ast/builtin/BuiltinContext.java) has a TODO to add metrics and tracers. Without this, builtins like regex.match and http.send can't contribute timings, leaving a gap vs. OPA Go decision logs.

  • Add a Metrics field on BuiltinContext, defaulting to NoOpMetrics.Instance().
  • Wire it through from EvaluationContext.metrics.
  • Have at least one builtin (e.g., a regex builtin) record a timer to validate the flow end-to-end.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with opa-evaluator/.../ast/builtin/BuiltinContext.java and trace how metrics are available through EvaluationContext.metrics. Follow the regex builtin entry point to validate the flow, then confirm that the context defaults to NoOpMetrics.Instance(), receives the evaluation metrics, and records a timer end to end.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.