Skip to content

Commit

Permalink
[receiver/elasticsearch]: add segment metrics with total aggregation (#…
Browse files Browse the repository at this point in the history
…14786)

* feat: add segment metrics with total aggregation
  • Loading branch information
aboguszewski-sumo authored Oct 31, 2022
1 parent 9810bb0 commit 30e388b
Show file tree
Hide file tree
Showing 9 changed files with 603 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .chloggen/elasticsearch-receiver-segments-total.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
change_type: enhancement
component: elastisearchreceiver
note: Add new metrics related to segments, aggregated by all shards
issues: [14635]

4 changes: 4 additions & 0 deletions receiver/elasticsearchreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ These are the metrics available for this scraper.
| elasticsearch.index.operations.merge.docs_count | The total number of documents in merge operations for an index. | {documents} | Sum(Int) | <ul> <li>index_aggregation_type</li> </ul> |
| elasticsearch.index.operations.merge.size | The total size of merged segments for an index. | By | Sum(Int) | <ul> <li>index_aggregation_type</li> </ul> |
| **elasticsearch.index.operations.time** | Time spent on operations for an index. | ms | Sum(Int) | <ul> <li>operation</li> <li>index_aggregation_type</li> </ul> |
| elasticsearch.index.segments.count | Number of segments of an index. | {segments} | Sum(Int) | <ul> <li>index_aggregation_type</li> </ul> |
| elasticsearch.index.segments.memory | Size of memory for segment object of an index. | By | Sum(Int) | <ul> <li>index_aggregation_type</li> <li>segments_memory_object_type</li> </ul> |
| elasticsearch.index.segments.size | Size of segments of an index. | By | Sum(Int) | <ul> <li>index_aggregation_type</li> </ul> |
| **elasticsearch.index.shards.size** | The size of the shards assigned to this index. | By | Sum(Int) | <ul> <li>index_aggregation_type</li> </ul> |
| **elasticsearch.indexing_pressure.memory.limit** | Configured memory limit, in bytes, for the indexing requests. | By | Gauge(Int) | <ul> </ul> |
| **elasticsearch.indexing_pressure.memory.total.primary_rejections** | Cumulative number of indexing requests rejected in the primary stage. | 1 | Sum(Int) | <ul> </ul> |
Expand Down Expand Up @@ -121,6 +124,7 @@ metrics:
| memory_state (state) | State of the memory | free, used |
| operation (operation) | The type of operation. | index, delete, get, query, fetch, scroll, suggest, merge, refresh, flush, warmer |
| query_cache_count_type (type) | Type of query cache count | hit, miss |
| segments_memory_object_type (object) | Type of object in segment | term, doc_value, index_writer, fixed_bit_set |
| shard_state (state) | The state of the shard. | active, relocating, initializing, unassigned |
| task_state (state) | The state of the task. | rejected, completed |
| thread_pool_name | The name of the thread pool. | |
Expand Down
230 changes: 230 additions & 0 deletions receiver/elasticsearchreceiver/internal/metadata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions receiver/elasticsearchreceiver/internal/model/nodestats.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ type NodeStatsNodesInfoIndices struct {
QueryCache BasicCacheInfo `json:"query_cache"`
FieldDataCache BasicCacheInfo `json:"fielddata"`
TranslogStats TranslogStats `json:"translog"`
SegmentsStats SegmentsStats `json:"segments"`
}

type SegmentsStats struct {
Count int64 `json:"count"`
DocumentValuesMemoryInBy int64 `json:"doc_values_memory_in_bytes"`
IndexWriterMemoryInBy int64 `json:"index_writer_memory_in_bytes"`
MemoryInBy int64 `json:"memory_in_bytes"`
TermsMemoryInBy int64 `json:"terms_memory_in_bytes"`
FixedBitSetMemoryInBy int64 `json:"fixed_bit_set_memory_in_bytes"`
}

type TranslogStats struct {
Expand Down
35 changes: 35 additions & 0 deletions receiver/elasticsearchreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ attributes:
enum:
- primary_shards
- total
segments_memory_object_type:
value: object
description: Type of object in segment
enum:
- term
- doc_value
- index_writer
- fixed_bit_set

metrics:
# these metrics are from /_nodes/stats, and are node level metrics
Expand Down Expand Up @@ -785,3 +793,30 @@ metrics:
value_type: int
attributes: [index_aggregation_type]
enabled: false
elasticsearch.index.segments.count:
description: Number of segments of an index.
unit: "{segments}"
sum:
monotonic: false
aggregation: cumulative
value_type: int
attributes: [index_aggregation_type]
enabled: false
elasticsearch.index.segments.size:
description: Size of segments of an index.
unit: By
sum:
monotonic: false
aggregation: cumulative
value_type: int
attributes: [index_aggregation_type]
enabled: false
elasticsearch.index.segments.memory:
description: Size of memory for segment object of an index.
unit: By
sum:
monotonic: false
aggregation: cumulative
value_type: int
attributes: [index_aggregation_type, segments_memory_object_type]
enabled: false
Loading

0 comments on commit 30e388b

Please sign in to comment.