Skip to content

Commit

Permalink
Merge pull request #1032 from xmidt-org/denopink/patch/device-respons…
Browse files Browse the repository at this point in the history
…e-missing-metadata-map

patch: device response missing metadata map
  • Loading branch information
denopink authored Dec 8, 2023
2 parents 280110f + e85d275 commit eefe4c6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion device/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (m *manager) Connect(response http.ResponseWriter, request *http.Request, r
go m.readPump(d, InstrumentReader(c, d.statistics), closeOnce)
go m.writePump(d, InstrumentWriter(c, d.statistics), pinger, closeOnce)

d.logger.Debug("Connection metadata", zap.String("deviceID", string(d.ID())), zap.String("conveyCompliance", convey.GetCompliance(cvyErr).String()), zap.Strings("conveyHeaderKeys", maps.Keys(cvy)), zap.Any("conveyHeader", cvy))
d.logger.Debug("Connection metadata", zap.String("conveyCompliance", convey.GetCompliance(cvyErr).String()), zap.Strings("conveyHeaderKeys", maps.Keys(cvy)), zap.Any("conveyHeader", cvy))

return d, nil
}
Expand Down Expand Up @@ -351,6 +351,10 @@ func (m *manager) wrpSourceIsValid(message *wrp.Message, d *device) bool {

// nolint: typecheck
func addDeviceMetadataContext(message *wrp.Message, deviceMetadata *Metadata) {
if message.Metadata == nil {
message.Metadata = make(map[string]string)
}

message.Metadata[WRPTimestampMetadataKey] = time.Now().Format(time.RFC3339Nano)
message.PartnerIDs = []string{deviceMetadata.PartnerIDClaim()}

Expand Down

0 comments on commit eefe4c6

Please sign in to comment.