1// Copyright 2012-present Oliver Eilhard. All rights reserved. 2// Use of this source code is governed by a MIT-license. 3// See http://olivere.mit-license.org/license.txt for details. 4 5package elastic 6 7import ( 8 "context" 9 "encoding/json" 10 "fmt" 11 "net/http" 12 "net/url" 13 "strings" 14 15 "github.com/olivere/elastic/v7/uritemplates" 16) 17 18// NodesStatsService returns node statistics. 19// See http://www.elastic.co/guide/en/elasticsearch/reference/7.0/cluster-nodes-stats.html 20// for details. 21type NodesStatsService struct { 22 client *Client 23 24 pretty *bool // pretty format the returned JSON response 25 human *bool // return human readable values for statistics 26 errorTrace *bool // include the stack trace of returned errors 27 filterPath []string // list of filters used to reduce the response 28 headers http.Header // custom request-level HTTP headers 29 30 metric []string 31 indexMetric []string 32 nodeId []string 33 completionFields []string 34 fielddataFields []string 35 fields []string 36 groups *bool 37 level string 38 timeout string 39 types []string 40} 41 42// NewNodesStatsService creates a new NodesStatsService. 43func NewNodesStatsService(client *Client) *NodesStatsService { 44 return &NodesStatsService{ 45 client: client, 46 } 47} 48 49// Pretty tells Elasticsearch whether to return a formatted JSON response. 50func (s *NodesStatsService) Pretty(pretty bool) *NodesStatsService { 51 s.pretty = &pretty 52 return s 53} 54 55// Human specifies whether human readable values should be returned in 56// the JSON response, e.g. "7.5mb". 57func (s *NodesStatsService) Human(human bool) *NodesStatsService { 58 s.human = &human 59 return s 60} 61 62// ErrorTrace specifies whether to include the stack trace of returned errors. 63func (s *NodesStatsService) ErrorTrace(errorTrace bool) *NodesStatsService { 64 s.errorTrace = &errorTrace 65 return s 66} 67 68// FilterPath specifies a list of filters used to reduce the response. 69func (s *NodesStatsService) FilterPath(filterPath ...string) *NodesStatsService { 70 s.filterPath = filterPath 71 return s 72} 73 74// Header adds a header to the request. 75func (s *NodesStatsService) Header(name string, value string) *NodesStatsService { 76 if s.headers == nil { 77 s.headers = http.Header{} 78 } 79 s.headers.Add(name, value) 80 return s 81} 82 83// Headers specifies the headers of the request. 84func (s *NodesStatsService) Headers(headers http.Header) *NodesStatsService { 85 s.headers = headers 86 return s 87} 88 89// Metric limits the information returned to the specified metrics. 90func (s *NodesStatsService) Metric(metric ...string) *NodesStatsService { 91 s.metric = append(s.metric, metric...) 92 return s 93} 94 95// IndexMetric limits the information returned for `indices` metric 96// to the specific index metrics. Isn't used if `indices` (or `all`) 97// metric isn't specified.. 98func (s *NodesStatsService) IndexMetric(indexMetric ...string) *NodesStatsService { 99 s.indexMetric = append(s.indexMetric, indexMetric...) 100 return s 101} 102 103// NodeId is a list of node IDs or names to limit the returned information; 104// use `_local` to return information from the node you're connecting to, 105// leave empty to get information from all nodes. 106func (s *NodesStatsService) NodeId(nodeId ...string) *NodesStatsService { 107 s.nodeId = append(s.nodeId, nodeId...) 108 return s 109} 110 111// CompletionFields is a list of fields for `fielddata` and `suggest` 112// index metric (supports wildcards). 113func (s *NodesStatsService) CompletionFields(completionFields ...string) *NodesStatsService { 114 s.completionFields = append(s.completionFields, completionFields...) 115 return s 116} 117 118// FielddataFields is a list of fields for `fielddata` index metric (supports wildcards). 119func (s *NodesStatsService) FielddataFields(fielddataFields ...string) *NodesStatsService { 120 s.fielddataFields = append(s.fielddataFields, fielddataFields...) 121 return s 122} 123 124// Fields is a list of fields for `fielddata` and `completion` index metric (supports wildcards). 125func (s *NodesStatsService) Fields(fields ...string) *NodesStatsService { 126 s.fields = append(s.fields, fields...) 127 return s 128} 129 130// Groups is a list of search groups for `search` index metric. 131func (s *NodesStatsService) Groups(groups bool) *NodesStatsService { 132 s.groups = &groups 133 return s 134} 135 136// Level specifies whether to return indices stats aggregated at node, index or shard level. 137func (s *NodesStatsService) Level(level string) *NodesStatsService { 138 s.level = level 139 return s 140} 141 142// Timeout specifies an explicit operation timeout. 143func (s *NodesStatsService) Timeout(timeout string) *NodesStatsService { 144 s.timeout = timeout 145 return s 146} 147 148// Types a list of document types for the `indexing` index metric. 149func (s *NodesStatsService) Types(types ...string) *NodesStatsService { 150 s.types = append(s.types, types...) 151 return s 152} 153 154// buildURL builds the URL for the operation. 155func (s *NodesStatsService) buildURL() (string, url.Values, error) { 156 var err error 157 var path string 158 159 if len(s.nodeId) > 0 && len(s.metric) > 0 && len(s.indexMetric) > 0 { 160 path, err = uritemplates.Expand("/_nodes/{node_id}/stats/{metric}/{index_metric}", map[string]string{ 161 "index_metric": strings.Join(s.indexMetric, ","), 162 "node_id": strings.Join(s.nodeId, ","), 163 "metric": strings.Join(s.metric, ","), 164 }) 165 } else if len(s.nodeId) > 0 && len(s.metric) > 0 && len(s.indexMetric) == 0 { 166 path, err = uritemplates.Expand("/_nodes/{node_id}/stats/{metric}", map[string]string{ 167 "node_id": strings.Join(s.nodeId, ","), 168 "metric": strings.Join(s.metric, ","), 169 }) 170 } else if len(s.nodeId) > 0 && len(s.metric) == 0 && len(s.indexMetric) > 0 { 171 path, err = uritemplates.Expand("/_nodes/{node_id}/stats/_all/{index_metric}", map[string]string{ 172 "index_metric": strings.Join(s.indexMetric, ","), 173 "node_id": strings.Join(s.nodeId, ","), 174 }) 175 } else if len(s.nodeId) > 0 && len(s.metric) == 0 && len(s.indexMetric) == 0 { 176 path, err = uritemplates.Expand("/_nodes/{node_id}/stats", map[string]string{ 177 "node_id": strings.Join(s.nodeId, ","), 178 }) 179 } else if len(s.nodeId) == 0 && len(s.metric) > 0 && len(s.indexMetric) > 0 { 180 path, err = uritemplates.Expand("/_nodes/stats/{metric}/{index_metric}", map[string]string{ 181 "index_metric": strings.Join(s.indexMetric, ","), 182 "metric": strings.Join(s.metric, ","), 183 }) 184 } else if len(s.nodeId) == 0 && len(s.metric) > 0 && len(s.indexMetric) == 0 { 185 path, err = uritemplates.Expand("/_nodes/stats/{metric}", map[string]string{ 186 "metric": strings.Join(s.metric, ","), 187 }) 188 } else if len(s.nodeId) == 0 && len(s.metric) == 0 && len(s.indexMetric) > 0 { 189 path, err = uritemplates.Expand("/_nodes/stats/_all/{index_metric}", map[string]string{ 190 "index_metric": strings.Join(s.indexMetric, ","), 191 }) 192 } else { // if len(s.nodeId) == 0 && len(s.metric) == 0 && len(s.indexMetric) == 0 { 193 path = "/_nodes/stats" 194 } 195 if err != nil { 196 return "", url.Values{}, err 197 } 198 199 // Add query string parameters 200 params := url.Values{} 201 if v := s.pretty; v != nil { 202 params.Set("pretty", fmt.Sprint(*v)) 203 } 204 if v := s.human; v != nil { 205 params.Set("human", fmt.Sprint(*v)) 206 } 207 if v := s.errorTrace; v != nil { 208 params.Set("error_trace", fmt.Sprint(*v)) 209 } 210 if len(s.filterPath) > 0 { 211 params.Set("filter_path", strings.Join(s.filterPath, ",")) 212 } 213 if len(s.completionFields) > 0 { 214 params.Set("completion_fields", strings.Join(s.completionFields, ",")) 215 } 216 if len(s.fielddataFields) > 0 { 217 params.Set("fielddata_fields", strings.Join(s.fielddataFields, ",")) 218 } 219 if len(s.fields) > 0 { 220 params.Set("fields", strings.Join(s.fields, ",")) 221 } 222 if s.groups != nil { 223 params.Set("groups", fmt.Sprintf("%v", *s.groups)) 224 } 225 if s.level != "" { 226 params.Set("level", s.level) 227 } 228 if s.timeout != "" { 229 params.Set("timeout", s.timeout) 230 } 231 if len(s.types) > 0 { 232 params.Set("types", strings.Join(s.types, ",")) 233 } 234 return path, params, nil 235} 236 237// Validate checks if the operation is valid. 238func (s *NodesStatsService) Validate() error { 239 return nil 240} 241 242// Do executes the operation. 243func (s *NodesStatsService) Do(ctx context.Context) (*NodesStatsResponse, error) { 244 // Check pre-conditions 245 if err := s.Validate(); err != nil { 246 return nil, err 247 } 248 249 // Get URL for request 250 path, params, err := s.buildURL() 251 if err != nil { 252 return nil, err 253 } 254 255 // Get HTTP response 256 res, err := s.client.PerformRequest(ctx, PerformRequestOptions{ 257 Method: "GET", 258 Path: path, 259 Params: params, 260 Headers: s.headers, 261 }) 262 if err != nil { 263 return nil, err 264 } 265 266 // Return operation response 267 ret := new(NodesStatsResponse) 268 if err := json.Unmarshal(res.Body, ret); err != nil { 269 return nil, err 270 } 271 return ret, nil 272} 273 274// NodesStatsResponse is the response of NodesStatsService.Do. 275type NodesStatsResponse struct { 276 ClusterName string `json:"cluster_name"` 277 Nodes map[string]*NodesStatsNode `json:"nodes"` 278} 279 280type NodesStatsNode struct { 281 // Timestamp when these stats we're gathered. 282 Timestamp int64 `json:"timestamp"` 283 // Name of the node, e.g. "Mister Fear" 284 Name string `json:"name"` 285 // TransportAddress, e.g. "127.0.0.1:9300" 286 TransportAddress string `json:"transport_address"` 287 // Host is the host name, e.g. "macbookair" 288 Host string `json:"host"` 289 // IP is an IP address, e.g. "192.168.1.2" 290 IP string `json:"ip"` 291 // Roles is a list of the roles of the node, e.g. master, data, ingest. 292 Roles []string `json:"roles"` 293 294 // Attributes of the node. 295 Attributes map[string]interface{} `json:"attributes"` 296 297 // Indices returns index information. 298 Indices *NodesStatsIndex `json:"indices"` 299 300 // OS information, e.g. CPU and memory. 301 OS *NodesStatsNodeOS `json:"os"` 302 303 // Process information, e.g. max file descriptors. 304 Process *NodesStatsNodeProcess `json:"process"` 305 306 // JVM information, e.g. VM version. 307 JVM *NodesStatsNodeJVM `json:"jvm"` 308 309 // ThreadPool information. 310 ThreadPool map[string]*NodesStatsNodeThreadPool `json:"thread_pool"` 311 312 // FS returns information about the filesystem. 313 FS *NodesStatsNodeFS `json:"fs"` 314 315 // Network information. 316 Transport *NodesStatsNodeTransport `json:"transport"` 317 318 // HTTP information. 319 HTTP *NodesStatsNodeHTTP `json:"http"` 320 321 // Breaker contains information about circuit breakers. 322 Breaker map[string]*NodesStatsBreaker `json:"breakers"` 323 324 // ScriptStats information. 325 ScriptStats *NodesStatsScriptStats `json:"script"` 326 327 // Discovery information. 328 Discovery *NodesStatsDiscovery `json:"discovery"` 329 330 // Ingest information 331 Ingest *NodesStatsIngest `json:"ingest"` 332} 333 334type NodesStatsIndex struct { 335 Docs *NodesStatsDocsStats `json:"docs"` 336 Shards *NodesStatsShardCountStats `json:"shards_stats"` 337 Store *NodesStatsStoreStats `json:"store"` 338 Indexing *NodesStatsIndexingStats `json:"indexing"` 339 Get *NodesStatsGetStats `json:"get"` 340 Search *NodesStatsSearchStats `json:"search"` 341 Merges *NodesStatsMergeStats `json:"merges"` 342 Refresh *NodesStatsRefreshStats `json:"refresh"` 343 Flush *NodesStatsFlushStats `json:"flush"` 344 Warmer *NodesStatsWarmerStats `json:"warmer"` 345 QueryCache *NodesStatsQueryCacheStats `json:"query_cache"` 346 Fielddata *NodesStatsFielddataStats `json:"fielddata"` 347 Completion *NodesStatsCompletionStats `json:"completion"` 348 Segments *NodesStatsSegmentsStats `json:"segments"` 349 Translog *NodesStatsTranslogStats `json:"translog"` 350 RequestCache *NodesStatsRequestCacheStats `json:"request_cache"` 351 Recovery NodesStatsRecoveryStats `json:"recovery"` 352 353 IndicesLevel map[string]*NodesStatsIndex `json:"indices"` // for level=indices 354 ShardsLevel map[string]*NodesStatsIndex `json:"shards"` // for level=shards 355} 356 357type NodesStatsDocsStats struct { 358 Count int64 `json:"count"` 359 Deleted int64 `json:"deleted"` 360} 361 362type NodesStatsShardCountStats struct { 363 TotalCount int64 `json:"total_count"` 364} 365 366type NodesStatsStoreStats struct { 367 Size string `json:"size"` 368 SizeInBytes int64 `json:"size_in_bytes"` 369} 370 371type NodesStatsIndexingStats struct { 372 IndexTotal int64 `json:"index_total"` 373 IndexTime string `json:"index_time"` 374 IndexTimeInMillis int64 `json:"index_time_in_millis"` 375 IndexCurrent int64 `json:"index_current"` 376 IndexFailed int64 `json:"index_failed"` 377 DeleteTotal int64 `json:"delete_total"` 378 DeleteTime string `json:"delete_time"` 379 DeleteTimeInMillis int64 `json:"delete_time_in_millis"` 380 DeleteCurrent int64 `json:"delete_current"` 381 NoopUpdateTotal int64 `json:"noop_update_total"` 382 IsThrottled bool `json:"is_throttled"` 383 ThrottledTime string `json:"throttle_time"` // no typo, see https://github.com/elastic/elasticsearch/blob/ff99bc1d3f8a7ea72718872d214ec2097dfca276/server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java#L244 384 ThrottledTimeInMillis int64 `json:"throttle_time_in_millis"` 385 386 Types map[string]*NodesStatsIndexingStats `json:"types"` // stats for individual types 387} 388 389type NodesStatsGetStats struct { 390 Total int64 `json:"total"` 391 Time string `json:"get_time"` 392 TimeInMillis int64 `json:"time_in_millis"` 393 Exists int64 `json:"exists"` 394 ExistsTime string `json:"exists_time"` 395 ExistsTimeInMillis int64 `json:"exists_in_millis"` 396 Missing int64 `json:"missing"` 397 MissingTime string `json:"missing_time"` 398 MissingTimeInMillis int64 `json:"missing_in_millis"` 399 Current int64 `json:"current"` 400} 401 402type NodesStatsSearchStats struct { 403 OpenContexts int64 `json:"open_contexts"` 404 QueryTotal int64 `json:"query_total"` 405 QueryTime string `json:"query_time"` 406 QueryTimeInMillis int64 `json:"query_time_in_millis"` 407 QueryCurrent int64 `json:"query_current"` 408 FetchTotal int64 `json:"fetch_total"` 409 FetchTime string `json:"fetch_time"` 410 FetchTimeInMillis int64 `json:"fetch_time_in_millis"` 411 FetchCurrent int64 `json:"fetch_current"` 412 ScrollTotal int64 `json:"scroll_total"` 413 ScrollTime string `json:"scroll_time"` 414 ScrollTimeInMillis int64 `json:"scroll_time_in_millis"` 415 ScrollCurrent int64 `json:"scroll_current"` 416 417 Groups map[string]*NodesStatsSearchStats `json:"groups"` // stats for individual groups 418} 419 420type NodesStatsMergeStats struct { 421 Current int64 `json:"current"` 422 CurrentDocs int64 `json:"current_docs"` 423 CurrentSize string `json:"current_size"` 424 CurrentSizeInBytes int64 `json:"current_size_in_bytes"` 425 Total int64 `json:"total"` 426 TotalTime string `json:"total_time"` 427 TotalTimeInMillis int64 `json:"total_time_in_millis"` 428 TotalDocs int64 `json:"total_docs"` 429 TotalSize string `json:"total_size"` 430 TotalSizeInBytes int64 `json:"total_size_in_bytes"` 431 TotalStoppedTime string `json:"total_stopped_time"` 432 TotalStoppedTimeInMillis int64 `json:"total_stopped_time_in_millis"` 433 TotalThrottledTime string `json:"total_throttled_time"` 434 TotalThrottledTimeInMillis int64 `json:"total_throttled_time_in_millis"` 435 TotalThrottleBytes string `json:"total_auto_throttle"` 436 TotalThrottleBytesInBytes int64 `json:"total_auto_throttle_in_bytes"` 437} 438 439type NodesStatsRefreshStats struct { 440 Total int64 `json:"total"` 441 TotalTime string `json:"total_time"` 442 TotalTimeInMillis int64 `json:"total_time_in_millis"` 443} 444 445type NodesStatsFlushStats struct { 446 Total int64 `json:"total"` 447 TotalTime string `json:"total_time"` 448 TotalTimeInMillis int64 `json:"total_time_in_millis"` 449} 450 451type NodesStatsWarmerStats struct { 452 Current int64 `json:"current"` 453 Total int64 `json:"total"` 454 TotalTime string `json:"total_time"` 455 TotalTimeInMillis int64 `json:"total_time_in_millis"` 456} 457 458type NodesStatsQueryCacheStats struct { 459 MemorySize string `json:"memory_size"` 460 MemorySizeInBytes int64 `json:"memory_size_in_bytes"` 461 TotalCount int64 `json:"total_count"` 462 HitCount int64 `json:"hit_count"` 463 MissCount int64 `json:"miss_count"` 464 CacheSize int64 `json:"cache_size"` 465 CacheCount int64 `json:"cache_count"` 466 Evictions int64 `json:"evictions"` 467} 468 469type NodesStatsFielddataStats struct { 470 MemorySize string `json:"memory_size"` 471 MemorySizeInBytes int64 `json:"memory_size_in_bytes"` 472 Evictions int64 `json:"evictions"` 473 Fields map[string]struct { 474 MemorySize string `json:"memory_size"` 475 MemorySizeInBytes int64 `json:"memory_size_in_bytes"` 476 } `json:"fields"` 477} 478 479type NodesStatsCompletionStats struct { 480 Size string `json:"size"` 481 SizeInBytes int64 `json:"size_in_bytes"` 482 Fields map[string]struct { 483 Size string `json:"size"` 484 SizeInBytes int64 `json:"size_in_bytes"` 485 } `json:"fields"` 486} 487 488type NodesStatsSegmentsStats struct { 489 Count int64 `json:"count"` 490 Memory string `json:"memory"` 491 MemoryInBytes int64 `json:"memory_in_bytes"` 492 TermsMemory string `json:"terms_memory"` 493 TermsMemoryInBytes int64 `json:"terms_memory_in_bytes"` 494 StoredFieldsMemory string `json:"stored_fields_memory"` 495 StoredFieldsMemoryInBytes int64 `json:"stored_fields_memory_in_bytes"` 496 TermVectorsMemory string `json:"term_vectors_memory"` 497 TermVectorsMemoryInBytes int64 `json:"term_vectors_memory_in_bytes"` 498 NormsMemory string `json:"norms_memory"` 499 NormsMemoryInBytes int64 `json:"norms_memory_in_bytes"` 500 DocValuesMemory string `json:"doc_values_memory"` 501 DocValuesMemoryInBytes int64 `json:"doc_values_memory_in_bytes"` 502 IndexWriterMemory string `json:"index_writer_memory"` 503 IndexWriterMemoryInBytes int64 `json:"index_writer_memory_in_bytes"` 504 IndexWriterMaxMemory string `json:"index_writer_max_memory"` 505 IndexWriterMaxMemoryInBytes int64 `json:"index_writer_max_memory_in_bytes"` 506 VersionMapMemory string `json:"version_map_memory"` 507 VersionMapMemoryInBytes int64 `json:"version_map_memory_in_bytes"` 508 FixedBitSetMemory string `json:"fixed_bit_set"` // not a typo 509 FixedBitSetMemoryInBytes int64 `json:"fixed_bit_set_memory_in_bytes"` 510} 511 512type NodesStatsTranslogStats struct { 513 Operations int64 `json:"operations"` 514 Size string `json:"size"` 515 SizeInBytes int64 `json:"size_in_bytes"` 516} 517 518type NodesStatsRequestCacheStats struct { 519 MemorySize string `json:"memory_size"` 520 MemorySizeInBytes int64 `json:"memory_size_in_bytes"` 521 Evictions int64 `json:"evictions"` 522 HitCount int64 `json:"hit_count"` 523 MissCount int64 `json:"miss_count"` 524} 525 526type NodesStatsRecoveryStats struct { 527 CurrentAsSource int `json:"current_as_source"` 528 CurrentAsTarget int `json:"current_as_target"` 529} 530 531type NodesStatsNodeOS struct { 532 Timestamp int64 `json:"timestamp"` 533 CPU *NodesStatsNodeOSCPU `json:"cpu"` 534 Mem *NodesStatsNodeOSMem `json:"mem"` 535 Swap *NodesStatsNodeOSSwap `json:"swap"` 536} 537 538type NodesStatsNodeOSCPU struct { 539 Percent int `json:"percent"` 540 LoadAverage map[string]float64 `json:"load_average"` // keys are: 1m, 5m, and 15m 541} 542 543type NodesStatsNodeOSMem struct { 544 Total string `json:"total"` 545 TotalInBytes int64 `json:"total_in_bytes"` 546 Free string `json:"free"` 547 FreeInBytes int64 `json:"free_in_bytes"` 548 Used string `json:"used"` 549 UsedInBytes int64 `json:"used_in_bytes"` 550 FreePercent int `json:"free_percent"` 551 UsedPercent int `json:"used_percent"` 552} 553 554type NodesStatsNodeOSSwap struct { 555 Total string `json:"total"` 556 TotalInBytes int64 `json:"total_in_bytes"` 557 Free string `json:"free"` 558 FreeInBytes int64 `json:"free_in_bytes"` 559 Used string `json:"used"` 560 UsedInBytes int64 `json:"used_in_bytes"` 561} 562 563type NodesStatsNodeProcess struct { 564 Timestamp int64 `json:"timestamp"` 565 OpenFileDescriptors int64 `json:"open_file_descriptors"` 566 MaxFileDescriptors int64 `json:"max_file_descriptors"` 567 CPU struct { 568 Percent int `json:"percent"` 569 Total string `json:"total"` 570 TotalInMillis int64 `json:"total_in_millis"` 571 } `json:"cpu"` 572 Mem struct { 573 TotalVirtual string `json:"total_virtual"` 574 TotalVirtualInBytes int64 `json:"total_virtual_in_bytes"` 575 } `json:"mem"` 576} 577 578type NodesStatsNodeJVM struct { 579 Timestamp int64 `json:"timestamp"` 580 Uptime string `json:"uptime"` 581 UptimeInMillis int64 `json:"uptime_in_millis"` 582 Mem *NodesStatsNodeJVMMem `json:"mem"` 583 Threads *NodesStatsNodeJVMThreads `json:"threads"` 584 GC *NodesStatsNodeJVMGC `json:"gc"` 585 BufferPools map[string]*NodesStatsNodeJVMBufferPool `json:"buffer_pools"` 586 Classes *NodesStatsNodeJVMClasses `json:"classes"` 587} 588 589type NodesStatsNodeJVMMem struct { 590 HeapUsed string `json:"heap_used"` 591 HeapUsedInBytes int64 `json:"heap_used_in_bytes"` 592 HeapUsedPercent int `json:"heap_used_percent"` 593 HeapCommitted string `json:"heap_committed"` 594 HeapCommittedInBytes int64 `json:"heap_committed_in_bytes"` 595 HeapMax string `json:"heap_max"` 596 HeapMaxInBytes int64 `json:"heap_max_in_bytes"` 597 NonHeapUsed string `json:"non_heap_used"` 598 NonHeapUsedInBytes int64 `json:"non_heap_used_in_bytes"` 599 NonHeapCommitted string `json:"non_heap_committed"` 600 NonHeapCommittedInBytes int64 `json:"non_heap_committed_in_bytes"` 601 Pools map[string]struct { 602 Used string `json:"used"` 603 UsedInBytes int64 `json:"used_in_bytes"` 604 Max string `json:"max"` 605 MaxInBytes int64 `json:"max_in_bytes"` 606 PeakUsed string `json:"peak_used"` 607 PeakUsedInBytes int64 `json:"peak_used_in_bytes"` 608 PeakMax string `json:"peak_max"` 609 PeakMaxInBytes int64 `json:"peak_max_in_bytes"` 610 } `json:"pools"` 611} 612 613type NodesStatsNodeJVMThreads struct { 614 Count int64 `json:"count"` 615 PeakCount int64 `json:"peak_count"` 616} 617 618type NodesStatsNodeJVMGC struct { 619 Collectors map[string]*NodesStatsNodeJVMGCCollector `json:"collectors"` 620} 621 622type NodesStatsNodeJVMGCCollector struct { 623 CollectionCount int64 `json:"collection_count"` 624 CollectionTime string `json:"collection_time"` 625 CollectionTimeInMillis int64 `json:"collection_time_in_millis"` 626} 627 628type NodesStatsNodeJVMBufferPool struct { 629 Count int64 `json:"count"` 630 TotalCapacity string `json:"total_capacity"` 631 TotalCapacityInBytes int64 `json:"total_capacity_in_bytes"` 632} 633 634type NodesStatsNodeJVMClasses struct { 635 CurrentLoadedCount int64 `json:"current_loaded_count"` 636 TotalLoadedCount int64 `json:"total_loaded_count"` 637 TotalUnloadedCount int64 `json:"total_unloaded_count"` 638} 639 640type NodesStatsNodeThreadPool struct { 641 Threads int `json:"threads"` 642 Queue int `json:"queue"` 643 Active int `json:"active"` 644 Rejected int64 `json:"rejected"` 645 Largest int `json:"largest"` 646 Completed int64 `json:"completed"` 647} 648 649type NodesStatsNodeFS struct { 650 Timestamp int64 `json:"timestamp"` 651 Total *NodesStatsNodeFSEntry `json:"total"` 652 Data []*NodesStatsNodeFSEntry `json:"data"` 653 IOStats *NodesStatsNodeFSIOStats `json:"io_stats"` 654} 655 656type NodesStatsNodeFSEntry struct { 657 Path string `json:"path"` 658 Mount string `json:"mount"` 659 Type string `json:"type"` 660 Total string `json:"total"` 661 TotalInBytes int64 `json:"total_in_bytes"` 662 Free string `json:"free"` 663 FreeInBytes int64 `json:"free_in_bytes"` 664 Available string `json:"available"` 665 AvailableInBytes int64 `json:"available_in_bytes"` 666 Spins string `json:"spins"` 667} 668 669type NodesStatsNodeFSIOStats struct { 670 Devices []*NodesStatsNodeFSIOStatsEntry `json:"devices"` 671 Total *NodesStatsNodeFSIOStatsEntry `json:"total"` 672} 673 674type NodesStatsNodeFSIOStatsEntry struct { 675 DeviceName string `json:"device_name"` 676 Operations int64 `json:"operations"` 677 ReadOperations int64 `json:"read_operations"` 678 WriteOperations int64 `json:"write_operations"` 679 ReadKilobytes int64 `json:"read_kilobytes"` 680 WriteKilobytes int64 `json:"write_kilobytes"` 681} 682 683type NodesStatsNodeTransport struct { 684 ServerOpen int `json:"server_open"` 685 RxCount int64 `json:"rx_count"` 686 RxSize string `json:"rx_size"` 687 RxSizeInBytes int64 `json:"rx_size_in_bytes"` 688 TxCount int64 `json:"tx_count"` 689 TxSize string `json:"tx_size"` 690 TxSizeInBytes int64 `json:"tx_size_in_bytes"` 691} 692 693type NodesStatsNodeHTTP struct { 694 CurrentOpen int `json:"current_open"` 695 TotalOpened int `json:"total_opened"` 696} 697 698type NodesStatsBreaker struct { 699 LimitSize string `json:"limit_size"` 700 LimitSizeInBytes int64 `json:"limit_size_in_bytes"` 701 EstimatedSize string `json:"estimated_size"` 702 EstimatedSizeInBytes int64 `json:"estimated_size_in_bytes"` 703 Overhead float64 `json:"overhead"` 704 Tripped int64 `json:"tripped"` 705} 706 707type NodesStatsScriptStats struct { 708 Compilations int64 `json:"compilations"` 709 CacheEvictions int64 `json:"cache_evictions"` 710} 711 712type NodesStatsDiscovery struct { 713 ClusterStateQueue *NodesStatsDiscoveryStats `json:"cluster_state_queue"` 714} 715 716type NodesStatsDiscoveryStats struct { 717 Total int64 `json:"total"` 718 Pending int64 `json:"pending"` 719 Committed int64 `json:"committed"` 720} 721 722type NodesStatsIngest struct { 723 Total *NodesStatsIngestStats `json:"total"` 724 Pipelines interface{} `json:"pipelines"` 725} 726 727type NodesStatsIngestStats struct { 728 Count int64 `json:"count"` 729 Time string `json:"time"` 730 TimeInMillis int64 `json:"time_in_millis"` 731 Current int64 `json:"current"` 732 Failed int64 `json:"failed"` 733} 734