Skip to content

Commit 1ce974a

Browse files
author
Divjot Arora
authored
GODRIVER-1405 Remove topology.WithConnectionAppName (#377)
1 parent 162453d commit 1ce974a

File tree

5 files changed

+2
-19
lines changed

5 files changed

+2
-19
lines changed

mongo/client.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,6 @@ func (c *Client) configure(opts *options.ClientOptions) error {
337337
serverOpts = append(serverOpts, topology.WithServerAppName(func(string) string {
338338
return appName
339339
}))
340-
connOpts = append(connOpts, topology.WithConnectionAppName(func(string) string {
341-
return appName
342-
}))
343340
}
344341
// Compressors & ZlibLevel
345342
var comps []string

mongo/integration/client_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ func TestClient(t *testing.T) {
351351
SetAppName(testAppName)
352352
appNameMtOpts := mtest.NewOptions().
353353
ClientOptions(appNameDialerOpts).
354-
Topologies(mtest.Single)
354+
Topologies(mtest.Single).
355+
Auth(false) // Can't run with auth because the proxy dialer won't work with TLS enabled.
355356
mt.RunOpts("app name is always sent", appNameMtOpts, func(mt *mtest.T) {
356357
err := mt.Client.Ping(mtest.Background, mtest.PrimaryRp)
357358
assert.Nil(mt, err, "Ping error: %v", err)

x/mongo/driver/examples/server_monitoring/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ func main() {
2020
address.Address("localhost:27017"),
2121
nil,
2222
topology.WithHeartbeatInterval(func(time.Duration) time.Duration { return 2 * time.Second }),
23-
topology.WithConnectionOptions(
24-
func(opts ...topology.ConnectionOption) []topology.ConnectionOption {
25-
return append(opts, topology.WithConnectionAppName(func(string) string { return "server monitoring test" }))
26-
},
27-
),
2823
)
2924
if err != nil {
3025
log.Fatalf("could not start server: %v", err)

x/mongo/driver/topology/connection_options.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ func withServerDescriptionCallback(callback func(description.Server), opts ...Co
8686
// ConnectionOption is used to configure a connection.
8787
type ConnectionOption func(*connectionConfig) error
8888

89-
// WithConnectionAppName sets the application name which gets sent to MongoDB when it
90-
// first connects.
91-
func WithConnectionAppName(fn func(string) string) ConnectionOption {
92-
return func(c *connectionConfig) error {
93-
c.appName = fn(c.appName)
94-
return nil
95-
}
96-
}
97-
9889
// WithCompressors sets the compressors that can be used for communication.
9990
func WithCompressors(fn func([]string) []string) ConnectionOption {
10091
return func(c *connectionConfig) error {

x/mongo/driver/topology/topology_options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func WithConnString(fn func(connstring.ConnString) connstring.ConnString) Option
6565
var connOpts []ConnectionOption
6666

6767
if cs.AppName != "" {
68-
connOpts = append(connOpts, WithConnectionAppName(func(string) string { return cs.AppName }))
6968
c.serverOpts = append(c.serverOpts, WithServerAppName(func(string) string { return cs.AppName }))
7069
}
7170

0 commit comments

Comments
 (0)