Skip to content

Commit c7bd1ff

Browse files
authored
[chore] Update opamp-go to v0.12.0 (open-telemetry#30878)
**Description:** Supersedes open-telemetry#30872.
1 parent 9dedd99 commit c7bd1ff

File tree

10 files changed

+29
-28
lines changed

10 files changed

+29
-28
lines changed

cmd/opampsupervisor/e2e_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ func newOpAMPServer(t *testing.T, connectingCallback onConnectingFuncFactory, ca
8181
connectedChan := make(chan bool)
8282
s := server.New(testLogger{t: t})
8383
onConnectedFunc := callbacks.OnConnectedFunc
84-
callbacks.OnConnectedFunc = func(conn types.Connection) {
84+
callbacks.OnConnectedFunc = func(ctx context.Context, conn types.Connection) {
8585
agentConn.Store(conn)
8686
isAgentConnected.Store(true)
8787
connectedChan <- true
8888
if onConnectedFunc != nil {
89-
onConnectedFunc(conn)
89+
onConnectedFunc(ctx, conn)
9090
}
9191
}
9292
onConnectionCloseFunc := callbacks.OnConnectionCloseFunc
@@ -175,7 +175,7 @@ func TestSupervisorStartsCollectorWithRemoteConfig(t *testing.T) {
175175
t,
176176
defaultConnectingHandler,
177177
server.ConnectionCallbacksStruct{
178-
OnMessageFunc: func(_ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
178+
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
179179
if message.EffectiveConfig != nil {
180180
config := message.EffectiveConfig.ConfigMap.ConfigMap[""]
181181
if config != nil {
@@ -235,7 +235,7 @@ func TestSupervisorRestartsCollectorAfterBadConfig(t *testing.T) {
235235
t,
236236
defaultConnectingHandler,
237237
server.ConnectionCallbacksStruct{
238-
OnMessageFunc: func(_ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
238+
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
239239
if message.Health != nil {
240240
healthReport.Store(message.Health)
241241
}
@@ -319,7 +319,7 @@ func TestSupervisorConfiguresCapabilities(t *testing.T) {
319319
t,
320320
defaultConnectingHandler,
321321
server.ConnectionCallbacksStruct{
322-
OnMessageFunc: func(_ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
322+
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
323323
capabilities.Store(message.Capabilities)
324324

325325
return &protobufs.ServerToAgent{}
@@ -372,7 +372,7 @@ func TestSupervisorBootstrapsCollector(t *testing.T) {
372372
t,
373373
defaultConnectingHandler,
374374
server.ConnectionCallbacksStruct{
375-
OnMessageFunc: func(_ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
375+
OnMessageFunc: func(_ context.Context, _ types.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
376376
if message.AgentDescription != nil {
377377
agentDescription.Store(message.AgentDescription)
378378
}

cmd/opampsupervisor/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/knadh/koanf/providers/rawbytes v0.1.0
1010
github.com/knadh/koanf/v2 v2.0.1
1111
github.com/oklog/ulid/v2 v2.1.0
12-
github.com/open-telemetry/opamp-go v0.11.0
12+
github.com/open-telemetry/opamp-go v0.12.0
1313
github.com/stretchr/testify v1.8.4
1414
go.opentelemetry.io/collector/config/configtls v0.93.1-0.20240129215828-1ed45ec12569
1515
go.opentelemetry.io/collector/semconv v0.93.1-0.20240129215828-1ed45ec12569

cmd/opampsupervisor/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/opampsupervisor/supervisor/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package supervisor
55

66
import (
7+
"context"
78
"net/http"
89

910
"github.com/open-telemetry/opamp-go/protobufs"
@@ -28,7 +29,7 @@ func newServerSettings(fs flattenedSettings) server.StartSettings {
2829
return serverTypes.ConnectionResponse{
2930
Accept: true,
3031
ConnectionCallbacks: server.ConnectionCallbacksStruct{
31-
OnMessageFunc: func(conn serverTypes.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
32+
OnMessageFunc: func(_ context.Context, conn serverTypes.Connection, message *protobufs.AgentToServer) *protobufs.ServerToAgent {
3233
if fs.onMessageFunc != nil {
3334
fs.onMessageFunc(conn, message)
3435
}

cmd/opampsupervisor/supervisor/supervisor.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,37 +358,37 @@ func (s *Supervisor) startOpAMP() error {
358358
TLSConfig: tlsConfig,
359359
InstanceUid: s.instanceID.String(),
360360
Callbacks: types.CallbacksStruct{
361-
OnConnectFunc: func() {
361+
OnConnectFunc: func(_ context.Context) {
362362
s.logger.Debug("Connected to the server.")
363363
},
364-
OnConnectFailedFunc: func(err error) {
364+
OnConnectFailedFunc: func(_ context.Context, err error) {
365365
s.logger.Error("Failed to connect to the server", zap.Error(err))
366366
},
367-
OnErrorFunc: func(err *protobufs.ServerErrorResponse) {
367+
OnErrorFunc: func(_ context.Context, err *protobufs.ServerErrorResponse) {
368368
s.logger.Error("Server returned an error response", zap.String("message", err.ErrorMessage))
369369
},
370370
OnMessageFunc: s.onMessage,
371-
OnOpampConnectionSettingsFunc: func(ctx context.Context, settings *protobufs.OpAMPConnectionSettings) error {
371+
OnOpampConnectionSettingsFunc: func(_ context.Context, settings *protobufs.OpAMPConnectionSettings) error {
372372
// TODO: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21043
373373
s.logger.Debug("Received ConnectionSettings request")
374374
return nil
375375
},
376-
OnOpampConnectionSettingsAcceptedFunc: func(settings *protobufs.OpAMPConnectionSettings) {
376+
OnOpampConnectionSettingsAcceptedFunc: func(_ context.Context, settings *protobufs.OpAMPConnectionSettings) {
377377
// TODO: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21043
378378
s.logger.Debug("ConnectionSettings accepted")
379379
},
380-
OnCommandFunc: func(command *protobufs.ServerToAgentCommand) error {
380+
OnCommandFunc: func(_ context.Context, command *protobufs.ServerToAgentCommand) error {
381381
cmdType := command.GetType()
382382
if *cmdType.Enum() == protobufs.CommandType_CommandType_Restart {
383383
// TODO: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21077
384384
s.logger.Debug("Received restart command")
385385
}
386386
return nil
387387
},
388-
SaveRemoteConfigStatusFunc: func(ctx context.Context, status *protobufs.RemoteConfigStatus) {
388+
SaveRemoteConfigStatusFunc: func(_ context.Context, status *protobufs.RemoteConfigStatus) {
389389
// TODO: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/21079
390390
},
391-
GetEffectiveConfigFunc: func(ctx context.Context) (*protobufs.EffectiveConfig, error) {
391+
GetEffectiveConfigFunc: func(_ context.Context) (*protobufs.EffectiveConfig, error) {
392392
return s.createEffectiveConfigMsg(), nil
393393
},
394394
},

cmd/otelcontribcol/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ require (
527527
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
528528
github.com/nginxinc/nginx-prometheus-exporter v0.11.0 // indirect
529529
github.com/oklog/ulid/v2 v2.1.0 // indirect
530-
github.com/open-telemetry/opamp-go v0.11.0 // indirect
530+
github.com/open-telemetry/opamp-go v0.12.0 // indirect
531531
github.com/open-telemetry/opentelemetry-collector-contrib/extension/encoding v0.93.0 // indirect
532532
github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer v0.93.0 // indirect
533533
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.93.0 // indirect

cmd/otelcontribcol/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension/opampextension/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.20
55
require (
66
github.com/google/uuid v1.6.0
77
github.com/oklog/ulid/v2 v2.1.0
8-
github.com/open-telemetry/opamp-go v0.11.0
8+
github.com/open-telemetry/opamp-go v0.12.0
99
github.com/stretchr/testify v1.8.4
1010
go.opentelemetry.io/collector/component v0.93.1-0.20240129215828-1ed45ec12569
1111
go.opentelemetry.io/collector/config/configopaque v0.93.1-0.20240129215828-1ed45ec12569

extension/opampextension/go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension/opampextension/opamp_agent.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ func (o *opampAgent) Start(_ context.Context, _ component.Host) error {
6262
OpAMPServerURL: o.cfg.Server.WS.Endpoint,
6363
InstanceUid: o.instanceID.String(),
6464
Callbacks: types.CallbacksStruct{
65-
OnConnectFunc: func() {
65+
OnConnectFunc: func(_ context.Context) {
6666
o.logger.Debug("Connected to the OpAMP server")
6767
},
68-
OnConnectFailedFunc: func(err error) {
68+
OnConnectFailedFunc: func(_ context.Context, err error) {
6969
o.logger.Error("Failed to connect to the OpAMP server", zap.Error(err))
7070
},
71-
OnErrorFunc: func(err *protobufs.ServerErrorResponse) {
71+
OnErrorFunc: func(_ context.Context, err *protobufs.ServerErrorResponse) {
7272
o.logger.Error("OpAMP server returned an error response", zap.String("message", err.ErrorMessage))
7373
},
74-
GetEffectiveConfigFunc: func(ctx context.Context) (*protobufs.EffectiveConfig, error) {
74+
GetEffectiveConfigFunc: func(_ context.Context) (*protobufs.EffectiveConfig, error) {
7575
return o.composeEffectiveConfig(), nil
7676
},
7777
OnMessageFunc: o.onMessage,

0 commit comments

Comments
 (0)