Skip to content

Commit

Permalink
Hide string top mapping behind remote config
Browse files Browse the repository at this point in the history
  • Loading branch information
razmser committed Jan 23, 2025
1 parent b11916d commit 63e89fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/aggregator/aggregator_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,10 @@ func (a *Aggregator) handleSendSourceBucketAny(hctx *rpc.HandlerContext, args tl
for i, str := range item.Skeys {
processStringTag(i, str, false)
}
for i, tb := range item.Top {
processStringTag(i, tb.Stag, true)
if configR.MapStringTop {
for i, tb := range item.Top {
processStringTag(i, tb.Stag, true)
}
}
keyBytes = keyBytes[:0]
switch configR.Shard {
Expand Down
3 changes: 3 additions & 0 deletions internal/aggregator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type ConfigAggregatorRemote struct {
Shard int // aggreagator sharding
MappingCacheSize int64
MappingCacheTTL int
MapStringTop bool

configTagsMapper2
}
Expand Down Expand Up @@ -91,6 +92,7 @@ func DefaultConfigAggregator() ConfigAggregator {
Shard: ShardAgentHash,
MappingCacheSize: 1 << 30,
MappingCacheTTL: 86400 * 7,
MapStringTop: false, // disabled by default because API doesn't support it yet

configTagsMapper2: configTagsMapper2{
MaxUnknownTagsInBucket: 1024,
Expand All @@ -117,6 +119,7 @@ func (c *ConfigAggregatorRemote) Bind(f *flag.FlagSet, d ConfigAggregatorRemote,
f.IntVar(&c.Shard, "shard", d.Shard, "Sharding strategy")
f.Int64Var(&c.MappingCacheSize, "mappings-cache-size-agg", d.MappingCacheSize, "Mappings cache size both in memory and on disk for aggregator.")
f.IntVar(&c.MappingCacheTTL, "mappings-cache-ttl-agg", d.MappingCacheTTL, "Mappings cache item TTL since last used for aggregator.")
f.BoolVar(&c.MapStringTop, "map-string-top", d.MapStringTop, "Map string top")

f.IntVar(&c.MaxUnknownTagsInBucket, "mapping-queue-max-unknown-tags-in-bucket", d.MaxUnknownTagsInBucket, "Max unknown tags per bucket to add to mapping queue.")
f.IntVar(&c.MaxCreateTagsPerIteration, "mapping-queue-create-tags-per-iteration", d.MaxCreateTagsPerIteration, "Mapping queue will create no more tags per iteration (roughly second).")
Expand Down

0 comments on commit 63e89fa

Please sign in to comment.