Skip to content

refactor: remove unused new relic instrumentation - #1876

Merged
AmanGIT07 merged 2 commits into
mainfrom
remove-newrelic-agent
Aug 13, 2026
Merged

AmanGIT07 merged 2 commits into
mainfrom
remove-newrelic-agent

Conversation

@AmanGIT07

Copy link
Copy Markdown
Contributor

Summary

Removes the New Relic go-agent v2 dependency and all its call sites. This was dead code: the agent was never initialized — nothing reads the new_relic config and nothing starts a New Relic transaction — so newrelic.FromContext always returned nil and the segment blocks never ran. Query latency is already recorded by the Prometheus histograms in the same code paths.

Tracing will be added with OpenTelemetry instead; it is not wired up yet and is tracked separately in #1875.

Closes #1783. Part of #1782.

Changes

  • pkg/db/db.go: drop the datastore segment in WithTimeout
  • internal/store/spicedb/relation_repository.go: drop the segments in Add, Check, and Delete
  • config/config.go: drop the unused new_relic config block
  • config/sample.config.yaml: drop the sample entry
  • go.mod / go.sum: drop github.com/newrelic/go-agent

Technical Details

Config files that still contain a new_relic: block keep loading; the loader ignores unknown keys.

Test Plan

  • Manual testing completed
  • Build and type checking passes

go build ./..., golangci-lint run on the touched packages, and go test ./pkg/db/... ./config/... pass. Verified a config file containing the old new_relic: block still loads.

SQL Safety (if your PR touches *_repository.go or goqu.*)

  • Values flow through ? placeholders, goqu.Ex{}, or goqu.Record{} — never fmt.Sprintf or + building a query that gets executed.

🤖 Generated with Claude Code

The agent was never initialized: nothing reads the new_relic config and
no code starts a New Relic transaction, so the datastore segments never
ran. Query latency is already covered by the Prometheus histograms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview Aug 13, 2026 6:32am

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5bce8bb3-42ff-4335-96d6-4095db96a2d2

📥 Commits

Reviewing files that changed from the base of the PR and between 706303c and 2637e55.

📒 Files selected for processing (1)
  • internal/store/postgres/organization_repository.go
💤 Files with no reviewable changes (1)
  • internal/store/postgres/organization_repository.go

📝 Walkthrough

Summary by CodeRabbit

  • Removed Features
    • Removed New Relic monitoring and tracing support.
    • Removed New Relic application name, license, and enablement settings from the sample configuration.
    • Database and relationship operations no longer send telemetry to New Relic.
  • Configuration
    • New Relic settings are no longer accepted in application configuration.
  • Unchanged
    • Prometheus query latency metrics, operation timeouts, and existing error handling remain available.

Walkthrough

The change removes New Relic configuration, the Go dependency, and datastore instrumentation from SpiceDB relation operations and database timeout handling. Existing SpiceDB operations, Prometheus metrics, and timeout behavior remain.

Changes

New Relic removal

Layer / File(s) Summary
Remove New Relic configuration
config/config.go, config/sample.config.yaml, go.mod
The Frontier.NewRelic field and exported NewRelic type were removed. The sample configuration and direct New Relic dependency were also removed.
Remove SpiceDB instrumentation
internal/store/spicedb/relation_repository.go
New Relic imports, the product constant, and datastore tracing were removed from relation writes, permission checks, and deletes.
Remove database instrumentation
pkg/db/db.go, internal/store/postgres/organization_repository.go
New Relic datastore segments were removed from WithTimeout. Prometheus latency metrics, timeout handling, and operation execution remain. Obsolete instrumentation TODO comments were also removed.

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

Mergeability Score: ⚪ Minimal · up to 2637e

This change removes unused New Relic instrumentation and related configuration while preserving existing query latency metrics; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: rohilsurana

🚥 Pre-merge checks | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR removes New Relic instrumentation instead of migrating the v2 call sites to the v3 import path and APIs required by #1783. Migrate the call sites to github.com/newrelic/go-agent/v3 and update the transaction and segment APIs, or update #1783 to approve removal.
Out of Scope Changes check ⚠️ Warning The PR removes New Relic configuration and includes an unrelated TODO cleanup outside #1783's stated migration scope. Limit changes to the v2-to-v3 migration, or link issues that authorize configuration removal and unrelated TODO cleanup.

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.

@AmanGIT07
AmanGIT07 requested a review from rohilsurana August 12, 2026 12:40
@coveralls

coveralls commented Aug 12, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 31674162950

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.06%) to 48.266%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 31 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

31 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
pkg/server/server.go 29 64.2%
internal/store/spicedb/relation_repository.go 2 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 39761
Covered Lines: 19191
Line Coverage: 48.27%
Coverage Strength: 15.43 hits per line

💛 - Coveralls

@rohilsurana rohilsurana 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 removal of the unused New Relic instrumentation. Verified go build, go mod tidy (no changes), and config-loader compatibility. Also dropped the stale newrelic TODO comment in organization_repository.go. LGTM.

@AmanGIT07
AmanGIT07 merged commit 229ea89 into main Aug 13, 2026
8 checks passed
@AmanGIT07
AmanGIT07 deleted the remove-newrelic-agent branch August 13, 2026 06:41

This branch was successfully deployed

1 active deployment
Preview — 2637e550 Deployed Aug 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from New Relic go-agent v2 to v3

3 participants