Skip to content

feat: add noop client implementation - #1365

Open
giortzisg wants to merge 1 commit into
masterfrom
scopes/noop-client
Open

feat: add noop client implementation#1365
giortzisg wants to merge 1 commit into
masterfrom
scopes/noop-client

Conversation

@giortzisg

@giortzisg giortzisg commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

This adds the Client interface and noop and default client implementations for the SDK. This better aligns the behavior with the current client spec and removes the need to always nil check any client.

Issues

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

@giortzisg
giortzisg changed the base branch from feat/scopes to master July 20, 2026 08:33
@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

GO-153

@giortzisg
giortzisg marked this pull request as ready for review July 20, 2026 11:24
Comment thread httpclient/sentryhttpclient.go Outdated
@giortzisg
giortzisg changed the base branch from master to feat/scopes July 21, 2026 12:36
@giortzisg
giortzisg force-pushed the scopes/noop-client branch from 4337b6c to 415d82c Compare July 23, 2026 08:45
Comment thread client.go Outdated
@giortzisg
giortzisg force-pushed the scopes/noop-client branch from 415d82c to 18b7a4a Compare July 30, 2026 20:45
Comment thread client_api.go Outdated
@giortzisg
giortzisg changed the base branch from feat/scopes to master August 10, 2026 11:30
@giortzisg
giortzisg force-pushed the scopes/noop-client branch 2 times, most recently from 59c6bdc to 095e3a7 Compare August 10, 2026 11:57
Comment thread client_api.go Outdated
Comment thread hub.go

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8fc2ecf. Configure here.

Comment thread client.go
Comment thread client.go
func (client *Client) Recover(err any, hint *EventHint, scope EventModifier) *EventID {
if !client.IsEnabled() {
return nil
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Disabled Recover skips panic recovery

Medium Severity

Recover returns immediately when the client is disabled, before calling recover(). Direct use as a panic handler with a noop client therefore leaves the original panic unrecovered. RecoverWithContext does not have this early return, so the two APIs now behave inconsistently for disabled clients.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8fc2ecf. Configure here.

This PR changes the client boundaries so that we always return a non nil
client.
Comment thread hub.go
Comment on lines 51 to +54
func (l *layer) Client() *Client {
l.mu.RLock()
defer l.mu.RUnlock()
return l.client
return normalizeClient(l.client)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The logrus integration's check customHub.Client() != nil always passes now, as Client() returns a NoopClient instead of nil, causing logs to be silently discarded instead of falling back to the default hub.
Severity: HIGH

Suggested Fix

Update the check in logrus/logrusentry.go:161 to use the IsEnabled() method instead of a != nil check on the client. The condition should be changed from customHub.Client() != nil to customHub.Client().IsEnabled(). This will correctly determine if the client is a real, functioning client or a NoopClient, restoring the intended fallback behavior.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: hub.go#L51-L54

Potential issue: The `hub.Client()` method was changed to always return a non-nil
client, specifically a `NoopClient` when no real client is configured. However, the
`logrus` integration at `logrus/logrusentry.go:161` was not updated. It still uses
`customHub.Client() != nil` to decide whether to use a custom hub. This check now always
evaluates to true. Consequently, if a custom hub lacks a real client, the system no
longer falls back to the default hub. Instead, it uses the custom hub with its
`NoopClient`, which silently discards all logs, leading to telemetry loss in certain
configurations like multi-tenant setups.

Also affects:

  • logrus/logrusentry.go:161

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.

Finalize noop client prerequisite

2 participants