@@ -334,6 +334,16 @@ func (p *Amqp10Publisher) Stop(reason string) {
334
334
}
335
335
}
336
336
337
+ // maybeConvertToInt converts string values to integers if they look like integers
338
+ func maybeConvertToInt (value string ) any {
339
+ // Try to parse as int64 first
340
+ if intVal , err := strconv .ParseInt (value , 10 , 64 ); err == nil {
341
+ return intVal
342
+ }
343
+ // If it's not an integer, return as string
344
+ return value
345
+ }
346
+
337
347
func (p * Amqp10Publisher ) prepareMessage () * amqp.Message {
338
348
utils .UpdatePayload (p .Config .UseMillis , & p .msg )
339
349
msg := amqp .NewMessage (p .msg )
@@ -342,7 +352,8 @@ func (p *Amqp10Publisher) prepareMessage() *amqp.Message {
342
352
if len (p .Config .Amqp .AppProperties ) > 0 {
343
353
msg .ApplicationProperties = make (map [string ]any )
344
354
for key , val := range p .Config .Amqp .AppProperties {
345
- msg .ApplicationProperties [key ] = val [metrics .MessagesPublished .Get ()% uint64 (len (val ))]
355
+ stringValue := val [metrics .MessagesPublished .Get ()% uint64 (len (val ))]
356
+ msg .ApplicationProperties [key ] = maybeConvertToInt (stringValue )
346
357
}
347
358
}
348
359
@@ -351,7 +362,8 @@ func (p *Amqp10Publisher) prepareMessage() *amqp.Message {
351
362
msg .Annotations = make (map [interface {}]interface {})
352
363
}
353
364
for key , val := range p .Config .Amqp .MsgAnnotations {
354
- msg .Annotations [key ] = val [metrics .MessagesPublished .Get ()% uint64 (len (val ))]
365
+ stringValue := val [metrics .MessagesPublished .Get ()% uint64 (len (val ))]
366
+ msg .Annotations [key ] = maybeConvertToInt (stringValue )
355
367
}
356
368
}
357
369
0 commit comments