Skip to content

Commit 5b3ffa8

Browse files
committed
fix(agent): use proper shard for builtin metrics
1 parent fa1121c commit 5b3ffa8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

internal/format/builtin_metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ So avg() of this metric shows estimated full cardinality with or without groupin
171171
BuiltinKind: BuiltinKindMetric,
172172
}},
173173
PreKeyTagID: "4",
174-
ShardStrategy: ShardBuiltin, // sharded the same way as metrtic it describes
174+
ShardStrategy: ShardBuiltin, // sharded the same way as metric it describes
175175
MetricTagID: 4,
176176
}
177177

internal/sharding/sharding.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ func Shard(key *data_model.Key, meta *format.MetricMetaValue, numShards int, sha
1818
case format.ShardByMetric:
1919
shard := uint32(key.Metric) % shardByMetricCount
2020
return shard, true, numShards, 0
21+
case format.ShardBuiltin:
22+
tagId := meta.MetricTagID
23+
// for builtin metrics we always use row values
24+
metric := key.Tags[tagId]
25+
shard := uint32(metric) % shardByMetricCount
26+
return shard, true, numShards, 0
2127
default: // including format.ShardByTagsHsh
2228
var scr []byte
2329
if scratch != nil {

0 commit comments

Comments
 (0)