Add uptime_ns field to mongodb input (#6669)

This commit is contained in:
pertu 2019-12-02 19:16:00 +00:00 committed by Daniel Nelson
parent 906027c39b
commit 6175d17969
4 changed files with 9 additions and 1 deletions

View File

@ -74,7 +74,7 @@ by running Telegraf with the `--debug` argument.
- flushes (integer)
- flushes_total_time_ns (integer)
- getmores (integer)
- inserts (integer
- inserts (integer)
- jumbo_chunks (integer)
- member_status (string)
- net_in_bytes_count (integer)
@ -102,6 +102,7 @@ by running Telegraf with the `--debug` argument.
- ttl_deletes (integer)
- ttl_passes (integer)
- updates (integer)
- uptime_ns (integer)
- vsize_megabytes (integer)
- wtcache_app_threads_page_read_count (integer)
- wtcache_app_threads_page_read_time (integer)

View File

@ -38,6 +38,7 @@ func NewMongodbData(statLine *StatLine, tags map[string]string) *MongodbData {
}
var DefaultStats = map[string]string{
"uptime_ns": "UptimeNanos",
"inserts": "InsertCnt",
"inserts_per_sec": "Insert",
"queries": "QueryCnt",

View File

@ -16,6 +16,7 @@ func TestAddNonReplStats(t *testing.T) {
&StatLine{
StorageEngine: "",
Time: time.Now(),
UptimeNanos: 0,
Insert: 0,
Query: 0,
Update: 0,
@ -235,6 +236,7 @@ func TestStateTag(t *testing.T) {
"resident_megabytes": int64(0),
"updates": int64(0),
"updates_per_sec": int64(0),
"uptime_ns": int64(0),
"vsize_megabytes": int64(0),
"ttl_deletes": int64(0),
"ttl_deletes_per_sec": int64(0),

View File

@ -477,6 +477,8 @@ type StatLine struct {
IsMongos bool
Host string
UptimeNanos int64
// The time at which this StatLine was generated.
Time time.Time
@ -659,6 +661,8 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec
Faults: -1,
}
returnVal.UptimeNanos = 1000 * 1000 * newStat.UptimeMillis
// set connection info
returnVal.CurrentC = newStat.Connections.Current
returnVal.AvailableC = newStat.Connections.Available