summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/logstash/node_stats.go
blob: 1687f333de1ad75423b9334585ee41f567236a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// SPDX-License-Identifier: GPL-3.0-or-later

package logstash

// https://www.elastic.co/guide/en/logstash/current/node-stats-api.html

type nodeStats struct {
	JVM       jvmStats                 `json:"jvm" stm:"jvm"`
	Process   processStats             `json:"process" stm:"process"`
	Event     eventsStats              `json:"event" stm:"event"`
	Pipelines map[string]pipelineStats `json:"pipelines" stm:"pipelines"`
}

type pipelineStats struct {
	Event eventsStats `json:"events" stm:"event"`
}

type eventsStats struct {
	In                        int `json:"in" stm:"in"`
	Filtered                  int `json:"filtered" stm:"filtered"`
	Out                       int `json:"out" stm:"out"`
	DurationInMillis          int `json:"duration_in_millis" stm:"duration_in_millis"`
	QueuePushDurationInMillis int `json:"queue_push_duration_in_millis" stm:"queue_push_duration_in_millis"`
}

type processStats struct {
	OpenFileDescriptors int `json:"open_file_descriptors" stm:"open_file_descriptors"`
}

type jvmStats struct {
	Threads struct {
		Count int `stm:"count"`
	} `stm:"threads"`
	Mem            jvmMemStats `stm:"mem"`
	GC             jvmGCStats  `stm:"gc"`
	UptimeInMillis int         `json:"uptime_in_millis" stm:"uptime_in_millis"`
}

type jvmMemStats struct {
	HeapUsedPercent      int `json:"heap_used_percent" stm:"heap_used_percent"`
	HeapCommittedInBytes int `json:"heap_committed_in_bytes" stm:"heap_committed_in_bytes"`
	HeapUsedInBytes      int `json:"heap_used_in_bytes" stm:"heap_used_in_bytes"`
	Pools                struct {
		Survivor jvmPoolStats `stm:"survivor"`
		Old      jvmPoolStats `stm:"old"`
		Young    jvmPoolStats `stm:"eden"`
	} `stm:"pools"`
}

type jvmPoolStats struct {
	UsedInBytes      int `json:"used_in_bytes" stm:"used_in_bytes"`
	CommittedInBytes int `json:"committed_in_bytes" stm:"committed_in_bytes"`
}

type jvmGCStats struct {
	Collectors struct {
		Old   gcCollectorStats `stm:"old"`
		Young gcCollectorStats `stm:"eden"`
	} `stm:"collectors"`
}

type gcCollectorStats struct {
	CollectionTimeInMillis int `json:"collection_time_in_millis" stm:"collection_time_in_millis"`
	CollectionCount        int `json:"collection_count" stm:"collection_count"`
}