Skip to content

refactor: remove unused new relic instrumentation - #1876

Open
AmanGIT07 wants to merge 1 commit into
mainfrom
remove-newrelic-agent
Open

refactor: remove unused new relic instrumentation#1876
AmanGIT07 wants to merge 1 commit 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 12, 2026 12:36pm

@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: c2295eba-502c-4dfa-8a42-3afef59f2832

📥 Commits

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

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • config/config.go
  • config/sample.config.yaml
  • go.mod
  • internal/store/spicedb/relation_repository.go
  • pkg/db/db.go
💤 Files with no reviewable changes (4)
  • go.mod
  • config/sample.config.yaml
  • pkg/db/db.go
  • internal/store/spicedb/relation_repository.go

📝 Walkthrough

Summary by CodeRabbit

  • Removed Features
    • Removed New Relic monitoring and tracing configuration.
    • Removed New Relic application name, license, and enablement settings from sample configuration.
    • Database and relationship operations no longer report telemetry to New Relic.
  • 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
New Relic datastore segments were removed from WithTimeout. Prometheus latency metrics, timeout handling, and operation execution remain.

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

Suggested reviewers: shreyag02

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The issue requires migrating New Relic v2 instrumentation to v3, but this PR removes the instrumentation, configuration, and dependency instead. Migrate the instrumentation call sites to the v3 import path and APIs, and retain the required New Relic dependency.
✅ Passed checks (1 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All reviewed changes concern New Relic configuration, dependency management, or instrumentation removal, so no unrelated code changes are evident.

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

Copy link
Copy Markdown

Coverage Report for CI Build 31597245221

Coverage increased (+0.06%) to 48.263%

Details

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

Uncovered Changes

No uncovered changes found.

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
internal/store/spicedb/relation_repository.go 2 0.0%

Coverage Stats

Coverage Status
Relevant Lines: 39755
Covered Lines: 19187
Line Coverage: 48.26%
Coverage Strength: 15.43 hits per line

💛 - Coveralls

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

2 participants