Skip to content

Commit

Permalink
fix integer size issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nr-swilloughby committed Oct 10, 2024
1 parent 364adbd commit 7a38380
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions v3/integrations/nrlogxi/nrlogxi.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
package nrlogxi

import (
"math"

log "github.com/mgutz/logxi/v1"
"github.com/newrelic/go-agent/v3/internal"
newrelic "github.com/newrelic/go-agent/v3/newrelic"
Expand Down Expand Up @@ -36,6 +38,10 @@ func (l *shim) DebugEnabled() bool {
}

func convert(c map[string]interface{}) []interface{} {
if len(c) >= math.MaxInt32/2 {
return []interface{}
}

output := make([]interface{}, 0, 2*len(c))
for k, v := range c {
output = append(output, k, v)
Expand Down
4 changes: 2 additions & 2 deletions v3/newrelic/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func stringLengthByteLimit(str string, byteLimit int) string {
}

func timeFromUnixMilliseconds(millis uint64) time.Time {
secs := int64(millis) / 1000
msecsRemaining := int64(millis) % 1000
secs := int64(millis / 1000)
msecsRemaining := int64(millis % 1000)
nsecsRemaining := msecsRemaining * (1000 * 1000)
return time.Unix(secs, nsecsRemaining)
}
Expand Down

0 comments on commit 7a38380

Please sign in to comment.