-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a flag that skips tag duplicate removal logic #165
Conversation
@@ -148,7 +154,7 @@ func (eng *Engine) measure(t time.Time, name string, value interface{}, ftype Fi | |||
m.Tags = append(m.Tags[:0], eng.Tags...) | |||
m.Tags = append(m.Tags, tags...) | |||
|
|||
if len(tags) != 0 && !TagsAreSorted(m.Tags) { | |||
if len(tags) != 0 && !eng.SkipTagDuplicateRemoval && !TagsAreSorted(m.Tags) { | |||
SortTags(m.Tags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still want to sort tags even if we are not removing duplicates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename the SortTags function to RemoveDuplicates
that's really what it's doing, the sorting is an artifact of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense but I can see other usages such as flagon. Do you want to rename to RemoveDuplicates
because it doesn't offer the backwards compatibility?
@kevinburkesegment would you please review again? Thank you! |
@kevinburkesegment I just wanted to follow up. Could you please review this PR when you have a moment? Thank you so much! |
dc46363
to
f03f0bc
Compare
f03f0bc
to
ec8ad7d
Compare
This pull request primarily introduces a new feature to the
Engine
struct inengine.go
which allows the skipping of duplicate tag removal in the metrics reporting process. This feature is tested inengine_test.go
.The most important changes are:
New feature:
engine.go
: Added a new boolean fieldSkipTagDuplicateRemoval
to theEngine
struct. This field controls whether the engine should skip the removal of duplicate tags from the tags list before sending.Feature integration:
engine.go
: Modified themeasure
andReportAt
methods of theEngine
struct to check theSkipTagDuplicateRemoval
field before removing duplicate tags. [1] [2]Testing:
engine_test.go
: Added a new test scenario inTestEngine
to test the behavior whenSkipTagDuplicateRemoval
is set.engine_test.go
: Implemented a new test functiontestEngineSkipTagDuplicateRemoval
to test the new feature.Contexts
https://twilio.slack.com/archives/CPLTV1V9A/p1720735336325819