Skip to content

Commit b9291fc

Browse files
committed
remove trash, tiny fixes
1 parent a492177 commit b9291fc

4 files changed

Lines changed: 17 additions & 30 deletions

File tree

internal/aggregator/aggregator_handlers.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -646,10 +646,6 @@ func (a *Aggregator) handleSendSourceBucket(hctx *rpc.HandlerContext, args tlsta
646646
[]int32{0, format.TagValueIDComponentAggregator, format.TagValueIDMappingCacheEventMiss},
647647
float64(mappingMisses), hostTag, aera)
648648

649-
if !configR.EnableMappingAfterSampling {
650-
a.addUnknownTags(unknownTags, aggBucket.time, hostTag, aera)
651-
}
652-
653649
a.sh2.AddValueCounterHostAERA(args.Time, format.BuiltinMetricMetaAggSizeCompressed,
654650
[]int32{0, 0, 0, 0, conveyor, spare},
655651
float64(compressedSize), 1, hostTag, aera)
@@ -735,25 +731,25 @@ func (a *Aggregator) addUnknownTags(unknownTags map[string]data_model.CreateMapp
735731
unknownMapRemove, unknownMapAdd, createMapAdd, avgRemovedHits, avgRemovedTotal := a.tagsMapper3.AddUnknownTags(unknownTags, time)
736732

737733
if unknownMapRemove != 0 {
738-
a.sh2.AddCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueEvent,
734+
a.sh2.AddValueCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueEvent,
739735
[]int32{0, 0, format.TagValueIDMappingQueueEventUnknownMapRemove},
740-
float64(unknownMapRemove), hostTag, aera)
741-
a.sh2.AddCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueRemovedHitsAvg,
736+
float64(unknownMapRemove), 1, hostTag, aera)
737+
a.sh2.AddValueCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueRemovedHitsAvg,
742738
[]int32{},
743-
avgRemovedHits, hostTag, aera)
744-
a.sh2.AddCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueRemovedTotalAvg,
739+
avgRemovedHits, 1, hostTag, aera)
740+
a.sh2.AddValueCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueRemovedTotalAvg,
745741
[]int32{},
746-
avgRemovedTotal, hostTag, aera)
742+
avgRemovedTotal, 1, hostTag, aera)
747743
}
748744
if unknownMapAdd != 0 {
749-
a.sh2.AddCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueEvent,
745+
a.sh2.AddValueCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueEvent,
750746
[]int32{0, 0, format.TagValueIDMappingQueueEventUnknownMapAdd},
751-
float64(unknownMapAdd), hostTag, aera)
747+
float64(unknownMapAdd), 1, hostTag, aera)
752748
}
753749
if createMapAdd != 0 {
754-
a.sh2.AddCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueEvent,
750+
a.sh2.AddValueCounterHostAERA(time, format.BuiltinMetricMetaMappingQueueEvent,
755751
[]int32{0, 0, format.TagValueIDMappingQueueEventCreateMapAdd},
756-
float64(createMapAdd), hostTag, aera)
752+
float64(createMapAdd), 1, hostTag, aera)
757753
}
758754
}
759755

internal/aggregator/aggregator_insert.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,6 @@ func (a *Aggregator) rowDataMarshalAppendPositions(buckets []*aggregatorBucket,
335335

336336
recentTs := buckets[0].time // by convention first bucket is recent, all others are historic
337337
recentUnknownTags := buckets[0].unknownTags
338-
if !configR.EnableMappingAfterSampling {
339-
recentUnknownTags = nil // make [] extremely fast NOP in processUnknownTag
340-
}
341338
historicTag := int32(format.TagValueIDConveyorRecent)
342339
if len(buckets) > 1 {
343340
historicTag = format.TagValueIDConveyorHistoric
@@ -529,9 +526,7 @@ func (a *Aggregator) rowDataMarshalAppendPositions(buckets []*aggregatorBucket,
529526
key = data_model.Key{Timestamp: t, Metric: format.BuiltinMetricIDContributorsLogRev, Tags: [format.MaxTags]int32{0, int32(insertTimeUnix)}}
530527
res = appendSimpleValueStat(rnd, res, &key, float64(insertTimeUnix)-float64(t), 1, a.aggregatorHostTag.I, metricCache, unknownTags, recentUnknownTags)
531528
}
532-
if configR.EnableMappingAfterSampling {
533-
a.addUnknownTags(unknownTags, recentTs, a.aggregatorHostTag, data_model.AgentEnvRouteArch{}) // no agent info here
534-
}
529+
a.addUnknownTags(unknownTags, recentTs, a.aggregatorHostTag, data_model.AgentEnvRouteArch{}) // no agent info here
535530
return res, sampler.SamplerBuffers, stats, time.Since(startTime)
536531
}
537532

internal/aggregator/config.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type ConfigAggregatorRemote struct {
4646
MigrationV3DisabledShards map[int32]struct{}
4747
MigrationDelaySec int // delay in seconds between migration steps
4848
ClusterShardsAddrs []string
49-
EnableMappingAfterSampling bool
5049
DisableReceiveSampleBudget bool
5150
OriginalSizeDecayHalfLife time.Duration
5251

@@ -211,13 +210,10 @@ func (c *ConfigAggregatorRemote) Bind(f *flag.FlagSet, d ConfigAggregatorRemote,
211210
f.Func("migration-v3-disabled-shards", "List of disabled shards for migration v3", c.setMigrationV3DisabledShards)
212211
f.IntVar(&c.MigrationDelaySec, "migration-delay-sec", d.MigrationDelaySec, "Delay in seconds between migration steps")
213212

214-
var enableMappingStorage bool
215-
f.BoolVar(&enableMappingStorage, "enable-mapping-storage", false, "Enable full mapping inmemory&disk storage")
216-
f.BoolVar(&c.EnableMappingAfterSampling, "enable-mapping-after-sampling", d.EnableMappingAfterSampling, "Enable mapping after sampling")
213+
var enableMappingAfterSampling bool
214+
f.BoolVar(&enableMappingAfterSampling, "enable-mapping-after-sampling", false, "Enable mapping after sampling")
217215
f.IntVar(&c.MaxUnknownTagsInBucket, "mapping-queue-max-unknown-tags-in-bucket", d.MaxUnknownTagsInBucket, "Max unknown tags per bucket to add to mapping queue.")
218216
f.IntVar(&c.MaxCreateTagsPerIteration, "mapping-queue-create-tags-per-iteration", d.MaxCreateTagsPerIteration, "Mapping queue will create no more tags per iteration (roughly second).")
219-
var maxLoadTagsPerIteration int
220-
f.IntVar(&maxLoadTagsPerIteration, "mapping-queue-load-tags-per-iteration", 0, "Mapping queue will load no more tags per iteration (roughly second).")
221217
f.IntVar(&c.TagHitsToCreate, "mapping-queue-hits-to-create", d.TagHitsToCreate, "Tag mapping will be created if it is used in so many different seconds.")
222218
f.IntVar(&c.TagTotalToCreate, "mapping-queue-total-to-create", d.TagTotalToCreate, "Tag mapping will be created if it is used so many times.")
223219
f.IntVar(&c.MaxUnknownTagsToKeep, "mapping-queue-max-unknown-tags-to-keep", d.MaxUnknownTagsToKeep, "Mapping queue will remember and collect hits on so many different strings.")

internal/aggregator/tags-mapper3.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ type unknownTag struct { // fits well into cache line
2424
}
2525

2626
type configTagsMapper3 struct {
27-
MaxUnknownTagsInBucket int // keep for low at first, then increase gradually
28-
MaxCreateTagsPerIteration int // keep for low at first, then increase gradually
27+
MaxUnknownTagsInBucket int // limit # of allocations during aggregation
28+
MaxCreateTagsPerIteration int // limit to protect against all kind of errors
2929
TagHitsToCreate int // if used in N different seconds, then create
30-
TagTotalToCreate int // if used K times, then create
30+
TagTotalToCreate int // if inserted in database K times, then create
3131
MaxUnknownTagsToKeep int
32-
KeepTime int // if not used for the long time, it is removed
32+
KeepTime int // if not used for the long time, it is removed from unknownTags
3333
MaxSendTagsToAgent int
3434
}
3535

0 commit comments

Comments
 (0)