@@ -22,7 +22,7 @@ import (
22
22
"time"
23
23
24
24
"github.com/go-logr/logr"
25
- "github.com/oklog/ulid/v2 "
25
+ "github.com/google/uuid "
26
26
"github.com/open-telemetry/opamp-go/client"
27
27
"github.com/open-telemetry/opamp-go/client/types"
28
28
"github.com/open-telemetry/opamp-go/protobufs"
@@ -44,7 +44,7 @@ type Agent struct {
44
44
startTime uint64
45
45
lastHash []byte
46
46
47
- instanceId ulid. ULID
47
+ instanceId uuid. UUID
48
48
agentDescription * protobufs.AgentDescription
49
49
remoteConfigStatus * protobufs.RemoteConfigStatus
50
50
@@ -211,7 +211,7 @@ func (agent *Agent) Start() error {
211
211
settings := types.StartSettings {
212
212
OpAMPServerURL : agent .config .Endpoint ,
213
213
Header : agent .config .Headers .ToHTTPHeader (),
214
- InstanceUid : agent .instanceId . String ( ),
214
+ InstanceUid : types . InstanceUid ( agent .instanceId ),
215
215
Callbacks : types.CallbacksStruct {
216
216
OnConnectFunc : agent .onConnect ,
217
217
OnConnectFailedFunc : agent .onConnectFailed ,
@@ -274,7 +274,7 @@ func (agent *Agent) runHeartbeat() {
274
274
275
275
// updateAgentIdentity receives a new instanced Id from the remote server and updates the agent's instanceID field.
276
276
// The meter will be reinitialized by the onMessage function.
277
- func (agent * Agent ) updateAgentIdentity (instanceId ulid. ULID ) {
277
+ func (agent * Agent ) updateAgentIdentity (instanceId uuid. UUID ) {
278
278
agent .logger .V (3 ).Info ("Agent identity is being changed" ,
279
279
"old instanceId" , agent .instanceId .String (),
280
280
"new instanceid" , instanceId .String ())
@@ -416,12 +416,12 @@ func (agent *Agent) onMessage(ctx context.Context, msg *types.MessageData) {
416
416
// The instance id is updated prior to the meter initialization so that the new meter will report using the updated
417
417
// instanceId.
418
418
if msg .AgentIdentification != nil {
419
- newInstanceId , err := ulid . Parse (msg .AgentIdentification .NewInstanceUid )
419
+ uid , err := uuid . FromBytes (msg .AgentIdentification .NewInstanceUid )
420
420
if err != nil {
421
421
agent .logger .Error (err , "couldn't parse instance UID" )
422
422
return
423
423
}
424
- agent .updateAgentIdentity (newInstanceId )
424
+ agent .updateAgentIdentity (uid )
425
425
}
426
426
427
427
if msg .OwnMetricsConnSettings != nil {
0 commit comments