Skip to content

Commit

Permalink
GODRIVER-1405 Remove topology.WithConnectionAppName (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
Divjot Arora authored Apr 20, 2020
1 parent 162453d commit 1ce974a
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 19 deletions.
3 changes: 0 additions & 3 deletions mongo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,6 @@ func (c *Client) configure(opts *options.ClientOptions) error {
serverOpts = append(serverOpts, topology.WithServerAppName(func(string) string {
return appName
}))
connOpts = append(connOpts, topology.WithConnectionAppName(func(string) string {
return appName
}))
}
// Compressors & ZlibLevel
var comps []string
Expand Down
3 changes: 2 additions & 1 deletion mongo/integration/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ func TestClient(t *testing.T) {
SetAppName(testAppName)
appNameMtOpts := mtest.NewOptions().
ClientOptions(appNameDialerOpts).
Topologies(mtest.Single)
Topologies(mtest.Single).
Auth(false) // Can't run with auth because the proxy dialer won't work with TLS enabled.
mt.RunOpts("app name is always sent", appNameMtOpts, func(mt *mtest.T) {
err := mt.Client.Ping(mtest.Background, mtest.PrimaryRp)
assert.Nil(mt, err, "Ping error: %v", err)
Expand Down
5 changes: 0 additions & 5 deletions x/mongo/driver/examples/server_monitoring/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ func main() {
address.Address("localhost:27017"),
nil,
topology.WithHeartbeatInterval(func(time.Duration) time.Duration { return 2 * time.Second }),
topology.WithConnectionOptions(
func(opts ...topology.ConnectionOption) []topology.ConnectionOption {
return append(opts, topology.WithConnectionAppName(func(string) string { return "server monitoring test" }))
},
),
)
if err != nil {
log.Fatalf("could not start server: %v", err)
Expand Down
9 changes: 0 additions & 9 deletions x/mongo/driver/topology/connection_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,6 @@ func withServerDescriptionCallback(callback func(description.Server), opts ...Co
// ConnectionOption is used to configure a connection.
type ConnectionOption func(*connectionConfig) error

// WithConnectionAppName sets the application name which gets sent to MongoDB when it
// first connects.
func WithConnectionAppName(fn func(string) string) ConnectionOption {
return func(c *connectionConfig) error {
c.appName = fn(c.appName)
return nil
}
}

// WithCompressors sets the compressors that can be used for communication.
func WithCompressors(fn func([]string) []string) ConnectionOption {
return func(c *connectionConfig) error {
Expand Down
1 change: 0 additions & 1 deletion x/mongo/driver/topology/topology_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func WithConnString(fn func(connstring.ConnString) connstring.ConnString) Option
var connOpts []ConnectionOption

if cs.AppName != "" {
connOpts = append(connOpts, WithConnectionAppName(func(string) string { return cs.AppName }))
c.serverOpts = append(c.serverOpts, WithServerAppName(func(string) string { return cs.AppName }))
}

Expand Down

0 comments on commit 1ce974a

Please sign in to comment.