open-policy-agent / open-policy-agent/java-opa-sdk
Expose Metrics to builtins via BuiltinContext
Open
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
Metricsfield onBuiltinContext, defaulting toNoOpMetrics.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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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