-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client: Add dial option to disable global dial options #6016
client: Add dial option to disable global dial options #6016
Conversation
} else { | ||
if !strings.Contains(err.Error(), "no transport security set") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: combine these lines. You can also combine both cases themselves by doing:
if _, err := Dial("fake", internal.Disable...); !strings.Contains(fmt.Sprint(err), "no transport security set") {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right nice thanks. Switched.
|
||
// newDisableGlobalDialOptions returns a DialOption that prevents the ClientConn | ||
// from applying the global DialOptions (set via AddGlobalDialOptions). | ||
func newDisableGlobalDialOptions() DialOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit/bikeshed: s/new//
? Then you'd have to rename disableGlobalDialOptions
to disableGlobalDialOptionsOption
. Maybe this is fine then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will leave as such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pass!
|
||
// newDisableGlobalDialOptions returns a DialOption that prevents the ClientConn | ||
// from applying the global DialOptions (set via AddGlobalDialOptions). | ||
func newDisableGlobalDialOptions() DialOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will leave as such.
} else { | ||
if !strings.Contains(err.Error(), "no transport security set") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right nice thanks. Switched.
This PR adds a dial option to disable global dial options. This will be used in the observability module only, thus it is kept internal. The intended use case is to replace the observability modules instrumentation components registered globally (binary logger, in future: interceptor, and stats handler) to new components (just the interceptor and stats handler) for certain Client Conns (disableGlobalDialOptions + opencensus.DialOption(disableTrace = true). This is to avoid a loop where exporters using grpc.ClientConns create their own telemetry data due to the global registration of instrumentation components.
RELEASE NOTES: N/A