Use int64 for fields in bind plugin (#6063)
This commit is contained in:
parent
9af39bbb7d
commit
ad5d5844c7
|
@ -7,7 +7,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf/testutil"
|
"github.com/influxdata/telegraf/testutil"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -127,20 +126,19 @@ func TestBindJsonStats(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
"block_size": 13893632,
|
"block_size": int64(13893632),
|
||||||
"context_size": 3685480,
|
"context_size": int64(3685480),
|
||||||
"in_use": 3064368,
|
"in_use": int64(3064368),
|
||||||
"lost": 0,
|
"lost": int64(0),
|
||||||
"total_use": 18206566,
|
"total_use": int64(18206566),
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.AssertContainsTaggedFields(t, "bind_memory", fields, tags)
|
acc.AssertContainsTaggedFields(t, "bind_memory", fields, tags)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Subtest for per-context memory stats
|
// Subtest for per-context memory stats
|
||||||
t.Run("memory_context", func(t *testing.T) {
|
t.Run("memory_context", func(t *testing.T) {
|
||||||
assert.True(t, acc.HasIntField("bind_memory_context", "total"))
|
assert.True(t, acc.HasInt64Field("bind_memory_context", "total"))
|
||||||
assert.True(t, acc.HasIntField("bind_memory_context", "in_use"))
|
assert.True(t, acc.HasInt64Field("bind_memory_context", "in_use"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,11 +327,11 @@ func TestBindXmlStatsV2(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
"block_size": 77070336,
|
"block_size": int64(77070336),
|
||||||
"context_size": 6663840,
|
"context_size": int64(6663840),
|
||||||
"in_use": 20772579,
|
"in_use": int64(20772579),
|
||||||
"lost": 0,
|
"lost": int64(0),
|
||||||
"total_use": 81804609,
|
"total_use": int64(81804609),
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.AssertContainsTaggedFields(t, "bind_memory", fields, tags)
|
acc.AssertContainsTaggedFields(t, "bind_memory", fields, tags)
|
||||||
|
@ -341,8 +339,8 @@ func TestBindXmlStatsV2(t *testing.T) {
|
||||||
|
|
||||||
// Subtest for per-context memory stats
|
// Subtest for per-context memory stats
|
||||||
t.Run("memory_context", func(t *testing.T) {
|
t.Run("memory_context", func(t *testing.T) {
|
||||||
assert.True(t, acc.HasIntField("bind_memory_context", "total"))
|
assert.True(t, acc.HasInt64Field("bind_memory_context", "total"))
|
||||||
assert.True(t, acc.HasIntField("bind_memory_context", "in_use"))
|
assert.True(t, acc.HasInt64Field("bind_memory_context", "in_use"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,11 +551,11 @@ func TestBindXmlStatsV3(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
"block_size": 45875200,
|
"block_size": int64(45875200),
|
||||||
"context_size": 10037400,
|
"context_size": int64(10037400),
|
||||||
"in_use": 6000232,
|
"in_use": int64(6000232),
|
||||||
"lost": 0,
|
"lost": int64(0),
|
||||||
"total_use": 777821909,
|
"total_use": int64(777821909),
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.AssertContainsTaggedFields(t, "bind_memory", fields, tags)
|
acc.AssertContainsTaggedFields(t, "bind_memory", fields, tags)
|
||||||
|
@ -565,8 +563,8 @@ func TestBindXmlStatsV3(t *testing.T) {
|
||||||
|
|
||||||
// Subtest for per-context memory stats
|
// Subtest for per-context memory stats
|
||||||
t.Run("memory_context", func(t *testing.T) {
|
t.Run("memory_context", func(t *testing.T) {
|
||||||
assert.True(t, acc.HasIntField("bind_memory_context", "total"))
|
assert.True(t, acc.HasInt64Field("bind_memory_context", "total"))
|
||||||
assert.True(t, acc.HasIntField("bind_memory_context", "in_use"))
|
assert.True(t, acc.HasInt64Field("bind_memory_context", "in_use"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,16 @@ type jsonStats struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type jsonMemory struct {
|
type jsonMemory struct {
|
||||||
TotalUse int
|
TotalUse int64
|
||||||
InUse int
|
InUse int64
|
||||||
BlockSize int
|
BlockSize int64
|
||||||
ContextSize int
|
ContextSize int64
|
||||||
Lost int
|
Lost int64
|
||||||
Contexts []struct {
|
Contexts []struct {
|
||||||
Id string
|
Id string
|
||||||
Name string
|
Name string
|
||||||
Total int
|
Total int64
|
||||||
InUse int
|
InUse int64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,15 +44,15 @@ type v2Statistics struct {
|
||||||
// Omitted nodes: references, maxinuse, blocksize, pools, hiwater, lowater
|
// Omitted nodes: references, maxinuse, blocksize, pools, hiwater, lowater
|
||||||
Id string `xml:"id"`
|
Id string `xml:"id"`
|
||||||
Name string `xml:"name"`
|
Name string `xml:"name"`
|
||||||
Total int `xml:"total"`
|
Total int64 `xml:"total"`
|
||||||
InUse int `xml:"inuse"`
|
InUse int64 `xml:"inuse"`
|
||||||
} `xml:"contexts>context"`
|
} `xml:"contexts>context"`
|
||||||
Summary struct {
|
Summary struct {
|
||||||
TotalUse int
|
TotalUse int64
|
||||||
InUse int
|
InUse int64
|
||||||
BlockSize int
|
BlockSize int64
|
||||||
ContextSize int
|
ContextSize int64
|
||||||
Lost int
|
Lost int64
|
||||||
} `xml:"summary"`
|
} `xml:"summary"`
|
||||||
} `xml:"memory"`
|
} `xml:"memory"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,15 +27,15 @@ type v3Memory struct {
|
||||||
// Omitted nodes: references, maxinuse, blocksize, pools, hiwater, lowater
|
// Omitted nodes: references, maxinuse, blocksize, pools, hiwater, lowater
|
||||||
Id string `xml:"id"`
|
Id string `xml:"id"`
|
||||||
Name string `xml:"name"`
|
Name string `xml:"name"`
|
||||||
Total int `xml:"total"`
|
Total int64 `xml:"total"`
|
||||||
InUse int `xml:"inuse"`
|
InUse int64 `xml:"inuse"`
|
||||||
} `xml:"contexts>context"`
|
} `xml:"contexts>context"`
|
||||||
Summary struct {
|
Summary struct {
|
||||||
TotalUse int
|
TotalUse int64
|
||||||
InUse int
|
InUse int64
|
||||||
BlockSize int
|
BlockSize int64
|
||||||
ContextSize int
|
ContextSize int64
|
||||||
Lost int
|
Lost int64
|
||||||
} `xml:"summary"`
|
} `xml:"summary"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ type v3View struct {
|
||||||
Name string `xml:"name,attr"`
|
Name string `xml:"name,attr"`
|
||||||
RRSets []struct {
|
RRSets []struct {
|
||||||
Name string `xml:"name"`
|
Name string `xml:"name"`
|
||||||
Value int `xml:"counter"`
|
Value int64 `xml:"counter"`
|
||||||
} `xml:"rrset"`
|
} `xml:"rrset"`
|
||||||
} `xml:"cache"`
|
} `xml:"cache"`
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ type v3CounterGroup struct {
|
||||||
Type string `xml:"type,attr"`
|
Type string `xml:"type,attr"`
|
||||||
Counters []struct {
|
Counters []struct {
|
||||||
Name string `xml:"name,attr"`
|
Name string `xml:"name,attr"`
|
||||||
Value int `xml:",chardata"`
|
Value int64 `xml:",chardata"`
|
||||||
} `xml:"counter"`
|
} `xml:"counter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue