Skip to content

Conversation

rahulpr22
Copy link
Contributor

@rahulpr22 rahulpr22 commented Oct 8, 2025

Reverts #33

Summary by CodeRabbit

  • Refactor

    • Telemetry/monitoring now initializes by default without a runtime toggle.
    • Removed the environment variable previously used to disable monitoring.
    • Simplified distributed tracing configuration.
  • Chores

    • Updated and pruned indirect dependencies to align with current tooling and libraries.

Copy link

coderabbitai bot commented Oct 8, 2025

Walkthrough

Removes the DisableNewRelic config flag, makes New Relic initialization unconditional, and drops the distributed tracer enablement option in SetupNewRelic. Updates go.mod with several indirect dependency additions and some removals. No public APIs added; one config field removed.

Changes

Cohort / File(s) Summary
Config: Remove DisableNewRelic flag
config/config.go
Deleted Config.DisableNewRelic bool field (env var DISABLE_NEW_RELIC).
Core: Unconditional New Relic init
core.go
Removed guard and error handling; always calls SetupNewRelic. Minor whitespace changes in OTEL path.
Initializer: Tracer option removed
initializers.go
Removed newrelic.ConfigDistributedTracerEnabled(tracing) from NewApplication config; tracing param no longer affects NR setup.
Dependencies: Indirect updates
go.mod
Added several indirect deps (e.g., Bugsnag, go-kit, gofrs/uuid, klauspost/compress, matttproud/golang_protobuf_extensions, OTLP retry internals, new genproto); removed some (e.g., newrelic/csec-go-agent, smarty/assertions).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Application
  participant NR as NewRelic Setup
  participant OTEL as OpenTelemetry Setup

  rect rgb(240, 248, 255)
    note over App: Startup
    App->>NR: SetupNewRelic()
    note over NR: Initialization attempted (errors not surfaced)
    App->>OTEL: SetupNROpenTelemetry() (if applicable)
  end
Loading
sequenceDiagram
  autonumber
  participant App as Application
  participant NR as NewRelic Setup

  opt Before (previous behavior)
    App->>NR: SetupNewRelic() [only if not disabled]
    NR-->>App: err handled/logged
  end

  opt After (current behavior)
    App->>NR: SetupNewRelic() (always)
    note over NR: No error handling here
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • ankurs
  • svetha-cvl

Poem

I hopped through configs, toggles undone,
Traces now flow under a single sun.
No switch to flip, no branching fear—
New Relic calls are always clear.
Dependencies bloom like clover in spring,
Thump-thump, I ship—what a tidy thing! 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly states that this pull request reverts the earlier change which adjusted NewRelic setup based on configuration, accurately reflecting the primary action of undoing that fix from PR #33.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-33-fix/nr-config

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 and usage tips.

@rahulpr22 rahulpr22 requested review from ankurs and svetha-cvl and removed request for svetha-cvl October 8, 2025 10:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
go.mod (1)

35-76: Remove unused indirect dependencies
go mod tidy -v flags the following as unused and they should be removed:
• github.com/bugsnag/bugsnag-go
• github.com/bugsnag/panicwrap
• github.com/cenkalti/backoff/v4
• github.com/go-kit/kit
• github.com/gofrs/uuid
• github.com/kardianos/osext
• github.com/klauspost/compress
• github.com/matttproud/golang_protobuf_extensions
• go.opentelemetry.io/otel/exporters/otlp/internal/retry
• google.golang.org/genproto
Also confirm whether imports for github.com/newrelic/csec-go-agent and github.com/smarty/assertions are required; if not, remove them so go mod tidy cleans up accordingly. Finally, rerun your vulnerability scan using valid module@version inputs.

🧹 Nitpick comments (1)
core.go (1)

137-137: Minor: Inconsistent indentation.

Extra leading space before err := on line 137. While this doesn't affect functionality, maintaining consistent indentation improves readability.

Apply this diff to fix the indentation:

-		 err := SetupNROpenTelemetry(
+		err := SetupNROpenTelemetry(
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4af0471 and ece1d8f.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • config/config.go (0 hunks)
  • core.go (2 hunks)
  • go.mod (2 hunks)
  • initializers.go (0 hunks)
💤 Files with no reviewable changes (2)
  • initializers.go
  • config/config.go
🧰 Additional context used
🧬 Code graph analysis (1)
core.go (1)
initializers.go (2)
  • SetupNewRelic (46-65)
  • SetupNROpenTelemetry (292-308)

log.Error(context.Background(), "Error setting up NewRelic tracing", "error", err)
}
}
SetupNewRelic(nrName, c.config.NewRelicLicenseKey, c.config.NewRelicDistributedTracing)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Capture and handle the error from SetupNewRelic.

The function returns an error, but it's being ignored. If New Relic initialization fails (e.g., invalid configuration, network issues), the error will be silently swallowed, making debugging difficult.

Apply this diff to handle the error:

-	SetupNewRelic(nrName, c.config.NewRelicLicenseKey, c.config.NewRelicDistributedTracing)
+	if err := SetupNewRelic(nrName, c.config.NewRelicLicenseKey, c.config.NewRelicDistributedTracing); err != nil {
+		log.Error(context.Background(), "msg", "Failed to setup New Relic", "err", err)
+	}
🤖 Prompt for AI Agents
In core.go around line 97, the call to SetupNewRelic(nrName,
c.config.NewRelicLicenseKey, c.config.NewRelicDistributedTracing) ignores its
returned error; capture the return value (err := SetupNewRelic(...)) and handle
it by checking if err != nil then wrap and return the error (e.g. return
fmt.Errorf("failed to initialize New Relic: %w", err)) or log it with contextual
details and propagate the failure up so initialization doesn't silently
continue; add required imports (fmt or your logger) as needed.

} else if c.config.NewRelicOpentelemetry {
// Fall back to New Relic OpenTelemetry if no custom OTLP is configured
err := SetupNROpenTelemetry(
err := SetupNROpenTelemetry(

Choose a reason for hiding this comment

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

nit: revert

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.

2 participants