Skip to content

fix: record OFREP evaluation metrics - #2016

Merged
toddbaert merged 1 commit into
open-feature:mainfrom
Boulea7:fix/ofrep-evaluation-metrics
Aug 14, 2026
Merged

toddbaert merged 1 commit into
open-feature:mainfrom
Boulea7:fix/ofrep-evaluation-metrics

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This PR

  • Records evaluation metrics for each flag resolved through the OFREP single and bulk endpoints.
  • Uses each bulk result's own error, reason, variant, and key so per-flag metrics remain accurate.

Related Issues

Fixes #2015

Notes

The full flagd lint command reports four existing staticcheck findings in flag_evaluator_v1.go and ofrep_service.go; the same findings reproduce on origin/main. The changed code introduces no new lint findings.

How to test

  • go test -race -count=1 ./flagd/pkg/service/flag-evaluation/ofrep
  • make test
  • make build-flagd
  • go run github.com/golangci/golangci-lint/v2/cmd/[email protected] run --new-from-rev=origin/main ./flagd/...

@Boulea7
Boulea7 requested review from a team as code owners August 12, 2026 19:49
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 12, 2026
@netlify

netlify Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 1651c76
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/6a7cce55f2c8fd00089c868b

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2143dd87-9208-4f55-8e7a-7b13f3c89a40

📥 Commits

Reviewing files that changed from the base of the PR and between 5c74b83 and 1651c76.

📒 Files selected for processing (2)
  • flagd/pkg/service/flag-evaluation/ofrep/handler.go
  • flagd/pkg/service/flag-evaluation/ofrep/handler_test.go

📝 Walkthrough

Walkthrough

The OFREP handler now stores an optional metrics recorder and records results for single and bulk evaluations. Tests validate recorded errors, reasons, variants, and flag keys.

Changes

OFREP metrics recording

Layer / File(s) Summary
Handler metrics recording
flagd/pkg/service/flag-evaluation/ofrep/handler.go
The handler stores the configured metrics recorder. Single evaluations record one result. Bulk evaluations record each result.
Metrics recording validation
flagd/pkg/service/flag-evaluation/ofrep/handler_test.go
Tests capture evaluation fields and verify recording for successful, failed, generic-error, and flag-not-found results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: aepfli, bacherfl, james-milligan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: recording OFREP evaluation metrics.
Description check ✅ Passed The description directly explains the OFREP metrics change, per-flag bulk behavior, linked issue, and validation steps.
Linked Issues check ✅ Passed The changes store the recorder and record each single and bulk evaluation with its own error, reason, variant, and flag key, satisfying issue #2015.
Out of Scope Changes check ✅ Passed The changes are limited to OFREP metrics recording and focused tests, with no unrelated code changes identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@toddbaert
toddbaert self-requested a review August 13, 2026 17:15

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean simple fix. Thanks @Boulea7 !

@toddbaert
toddbaert merged commit 8dd34dc into open-feature:main Aug 14, 2026
17 of 18 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 14, 2026
toddbaert pushed a commit that referenced this pull request Aug 14, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.16.2</summary>

##
[0.16.2](flagd/v0.16.1...flagd/v0.16.2)
(2026-08-14)


### 🐛 Bug Fixes

* **eventing:** prevent send on closed channel in EmitToAll
([#1993](#1993))
([8d7d41f](8d7d41f))
* possible race on eventstream connection
([#2025](#2025))
([e38ecb7](e38ecb7))
* record OFREP evaluation metrics
([#2016](#2016))
([8dd34dc](8dd34dc))
</details>

<details><summary>flagd-proxy: 0.9.8</summary>

##
[0.9.8](flagd-proxy/v0.9.7...flagd-proxy/v0.9.8)
(2026-08-14)


### 🐛 Bug Fixes

* **flagd-proxy:** set gRPC keepalive enforcement policy on the sync
server ([#2022](#2022))
([5591fa8](5591fa8))


### 🧹 Chore

* resolve open dependabot security alerts
([#2008](#2008))
([bbb05d4](bbb05d4))
</details>

<details><summary>core: 0.16.2</summary>

##
[0.16.2](core/v0.16.1...core/v0.16.2)
(2026-08-14)


### 🐛 Bug Fixes

* **core:** register the OFO scheme at package init, not inside
Sync.Init ([#2024](#2024))
([cf2db36](cf2db36))
* **flagd-proxy:** set gRPC keepalive enforcement policy on the sync
server ([#2022](#2022))
([5591fa8](5591fa8))
* possible race on eventstream connection
([#2025](#2025))
([e38ecb7](e38ecb7))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OFREP endpoints never record flag evaluation metrics (feature_flag.flagd.impression / .result.reason)

2 participants