Skip to content

Commit

Permalink
Collect total_data_set_size_in_bytes from elasticsearch module (#37457)
Browse files Browse the repository at this point in the history
* Collect total_data_set_size_in_bytes from elasticsearch module

Some APIs return total_data_set_size_in_bytes, which is usually the same as size_in_bytes, except when using partially mounted indices/searchable snapshots. For those the size_in_bytes returns zero, while total_data_set_size_in_bytes is the total shard size of the backing index on object storage.

We want to collect this to see how much storage each index is using on object storage.
Marking it as optional because older versions of ES don't return the field.
  • Loading branch information
henrikno committed Jan 16, 2024
1 parent 1554d7d commit fb96791
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 10 deletions.
62 changes: 61 additions & 1 deletion metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30458,6 +30458,13 @@ type: long

--

*`elasticsearch.cluster.stats.indices.store.total_data_set_size.bytes`*::
+
--
type: long

--

*`elasticsearch.cluster.stats.indices.total`*::
+
--
Expand Down Expand Up @@ -30790,6 +30797,13 @@ type: long

--

*`elasticsearch.index.primaries.store.total_data_set_size_in_bytes`*::
+
--
type: long

--

*`elasticsearch.index.primaries.docs.count`*::
+
--
Expand Down Expand Up @@ -30952,6 +30966,18 @@ type: long
Total size of the index in bytes.


type: long

format: bytes

--

*`elasticsearch.index.total.store.total_data_set_size_in_bytes`*::
+
--
Total size of the index in bytes including backing data for partially mounted indices.


type: long

format: bytes
Expand Down Expand Up @@ -31482,6 +31508,18 @@ type: long
Total size of the index in bytes.


type: long

format: bytes

--

*`elasticsearch.index.summary.primaries.store.total_data_set_size.bytes`*::
+
--
Total size of the index in bytes including backing data for partially mounted indices.


type: long

format: bytes
Expand Down Expand Up @@ -31605,6 +31643,18 @@ type: long
Total size of the index in bytes.


type: long

format: bytes

--

*`elasticsearch.index.summary.total.store.total_data_set_size.bytes`*::
+
--
Total size of the index in bytes including backing data for partially mounted indices.


type: long

format: bytes
Expand Down Expand Up @@ -32104,7 +32154,17 @@ format: bytes
*`elasticsearch.node.stats.indices.store.size.bytes`*::
+
--
Total size of the store in bytes.
Total size of all shards assigned to this node in bytes.


type: long

--

*`elasticsearch.node.stats.indices.store.total_data_set_size.bytes`*::
+
--
Total size of shards in bytes assigned to this node including backing data for partially mounted indices.


type: long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@
"host": {
"name": "host.example.com"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
fields:
- name: store.size.bytes
type: long
- name: store.total_data_set_size.bytes
type: long
- name: total
type: long
description: >
Expand Down
3 changes: 2 additions & 1 deletion metricbeat/module/elasticsearch/cluster_stats/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ var (
"primaries": c.Int("primaries"),
}),
"store": c.Dict("store", s.Schema{
"size": s.Object{"bytes": c.Int("size_in_bytes")},
"size": s.Object{"bytes": c.Int("size_in_bytes")},
"total_data_set_size": s.Object{"bytes": c.Int("total_data_set_size_in_bytes", s.Optional)},
}),
"fielddata": c.Dict("fielddata", s.Schema{
"memory": s.Object{
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/elasticsearch/fields.go

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions metricbeat/module/elasticsearch/index/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"query_time_in_millis": 2456214
},
"store": {
"size_in_bytes": 17759832
"size_in_bytes": 17759832,
"total_data_set_size_in_bytes": 17759832
},
"query_cache": {
"memory_size_in_bytes": 21120,
Expand Down Expand Up @@ -89,7 +90,8 @@
"total_size_in_bytes": 2199683211
},
"store": {
"size_in_bytes": 17759832
"size_in_bytes": 17759832,
"total_data_set_size_in_bytes": 17759832
},
"indexing": {
"index_time_in_millis": 117187,
Expand Down Expand Up @@ -152,4 +154,4 @@
"host": {
"name": "host.example.com"
}
}
}
7 changes: 7 additions & 0 deletions metricbeat/module/elasticsearch/index/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
type: long
- name: store.size_in_bytes
type: long
- name: store.total_data_set_size_in_bytes
type: long
- name: docs.count
type: long
- name: docs.deleted
Expand Down Expand Up @@ -113,6 +115,11 @@
type: long
description: >
Total size of the index in bytes.
- name: store.total_data_set_size_in_bytes
format: bytes
type: long
description: >
Total size of the index in bytes including backing data for partially mounted indices.
- name: query_cache
type: group
fields:
Expand Down
6 changes: 4 additions & 2 deletions metricbeat/module/elasticsearch/index/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ type primaries struct {
FixedBitSetMemoryInBytes int `json:"fixed_bit_set_memory_in_bytes"`
} `json:"segments"`
Store struct {
SizeInBytes int `json:"size_in_bytes"`
SizeInBytes int `json:"size_in_bytes"`
TotalDataSetSizeInBytes int `json:"total_data_set_size_in_bytes"`
} `json:"store"`
Refresh struct {
TotalTimeInMillis int `json:"total_time_in_millis"`
Expand Down Expand Up @@ -132,7 +133,8 @@ type total struct {
FixedBitSetMemoryInBytes int `json:"fixed_bit_set_memory_in_bytes"`
} `json:"segments"`
Store struct {
SizeInBytes int `json:"size_in_bytes"`
SizeInBytes int `json:"size_in_bytes"`
TotalDataSetSizeInBytes int `json:"total_data_set_size_in_bytes"`
} `json:"store"`
Refresh struct {
TotalTimeInMillis int `json:"total_time_in_millis"`
Expand Down
10 changes: 10 additions & 0 deletions metricbeat/module/elasticsearch/index_summary/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
format: bytes
description: >
Total size of the index in bytes.
- name: store.total_data_set_size.bytes
type: long
format: bytes
description: >
Total size of the index in bytes including backing data for partially mounted indices.
- name: segments.count
type: long
description: >
Expand Down Expand Up @@ -78,6 +83,11 @@
format: bytes
description: >
Total size of the index in bytes.
- name: store.total_data_set_size.bytes
type: long
format: bytes
description: >
Total size of the index in bytes including backing data for partially mounted indices.
- name: segments.count
type: long
description: >
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/elasticsearch/index_summary/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ var indexSummaryDict = s.Schema{
"size": s.Object{
"bytes": c.Int("size_in_bytes"),
},
"total_data_set_size": s.Object{
"bytes": c.Int("total_data_set_size_in_bytes", s.Optional),
},
}),
"segments": c.Dict("segments", s.Schema{
"count": c.Int("count"),
Expand Down
6 changes: 5 additions & 1 deletion metricbeat/module/elasticsearch/node_stats/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@
- name: store.size.bytes
type: long
description: >
Total size of the store in bytes.
Total size of all shards assigned to this node in bytes.
- name: store.total_data_set_size.bytes
type: long
description: >
Total size of shards in bytes assigned to this node including backing data for partially mounted indices.
- name: fielddata
type: group
fields:
Expand Down
3 changes: 3 additions & 0 deletions metricbeat/module/elasticsearch/node_stats/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ var (
"size": s.Object{
"bytes": c.Int("size_in_bytes"),
},
"total_data_set_size": s.Object{
"bytes": c.Int("total_data_set_size_in_bytes", s.Optional),
},
}),
"segments": c.Dict("segments", s.Schema{
"count": c.Int("count"),
Expand Down

0 comments on commit fb96791

Please sign in to comment.