Skip to content

Commit 6adb646

Browse files
authored
Correctly calculate disk usage for frozen data tier telemetry (#86580) (#86749)
The telemetry for data tiers was using the size in bytes, however, for the frozen tier using searchable snapshots, this was the disk usage rather than the size of the actual data. This commit changes the telemetry to use `total_data_set_size` as introduced in #70625 so that the telemetry is correct. Resolves #86055
1 parent 3ffbc17 commit 6adb646

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

docs/changelog/86580.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 86580
2+
summary: Correctly calculate disk usage for frozen data tier telemetry
3+
area: Stats
4+
type: bug
5+
issues:
6+
- 86055

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/DataTiersFeatureSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private static void aggregateDataTierShardStats(NodeStats nodeStats, Index index
198198
final List<IndexShardStats> allShardStats = nodeStats.getIndices().getShardStats(index);
199199
if (allShardStats != null) {
200200
for (IndexShardStats shardStat : allShardStats) {
201-
accumulator.totalByteCount += shardStat.getTotal().getStore().getSizeInBytes();
201+
accumulator.totalByteCount += shardStat.getTotal().getStore().totalDataSetSizeInBytes();
202202
accumulator.docCount += shardStat.getTotal().getDocs().getCount();
203203

204204
// Accumulate stats about started shards
@@ -210,7 +210,7 @@ private static void aggregateDataTierShardStats(NodeStats nodeStats, Index index
210210
if (primaryStoreStats != null) {
211211
// if primaryStoreStats is null, it means there is no primary on the node in question
212212
accumulator.primaryShardCount++;
213-
long primarySize = primaryStoreStats.getSizeInBytes();
213+
long primarySize = primaryStoreStats.totalDataSetSizeInBytes();
214214
accumulator.primaryByteCount += primarySize;
215215
accumulator.valueSketch.add(primarySize);
216216
}

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/DataTiersFeatureSetTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ private List<NodeStats> buildNodeStats(ClusterState clusterState, long bytesPerS
769769
}
770770

771771
private static ShardStats shardStat(long byteCount, long docCount, ShardRouting routing) {
772-
StoreStats storeStats = new StoreStats(byteCount, 0L, 0L);
772+
StoreStats storeStats = new StoreStats(randomNonNegativeLong(), byteCount, 0L);
773773
DocsStats docsStats = new DocsStats(docCount, 0L, byteCount);
774774

775775
CommonStats commonStats = new CommonStats(CommonStatsFlags.ALL);

0 commit comments

Comments
 (0)