Skip to content
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

pkg/trace/event: make event service & operation matching insensitive #3113

Merged
merged 2 commits into from
Mar 5, 2019

Conversation

gbbr
Copy link
Contributor

@gbbr gbbr commented Mar 4, 2019

This change makes apm_config.analyzed_rate_by_service and apm_config.analyzed_spans
entries case insensitive.

The reasoning behind this is that Viper always lower-cases keys in the yaml file,
making it impossible to make case-sensitive comparisons against the orginal value.

See spf13/viper#411.

@gbbr gbbr added the team/agent-apm trace-agent label Mar 4, 2019
@gbbr gbbr added this to the 6.11.0 milestone Mar 4, 2019
@gbbr gbbr requested a review from a team as a code owner March 4, 2019 12:44
@gbbr gbbr force-pushed the gbbr/extract-legacy-casing branch from b597214 to d8bd1bb Compare March 4, 2019 12:51
@gbbr gbbr changed the title pkg/trace/event: make event service & operation matchin insensitive pkg/trace/event: make event service & operation matching insensitive Mar 4, 2019
@@ -101,7 +101,7 @@ type AgentConfig struct {
// It maps tag keys to a set of replacements. Only supported in A6.
ReplaceTags []*ReplaceRule

// transaction analytics
// transaction analytics, all map keys are lower-cased by Viper.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should enforce it ourselves on top of Viper? I don't like the fact that we depend so much on a side effect of a dependency. If Viper changes its behavior, extracting events for all uppercase names will break but none of our tests will catch it (at least as far as I can tell).

@gbbr
Copy link
Contributor Author

gbbr commented Mar 4, 2019 via email

@codecov
Copy link

codecov bot commented Mar 4, 2019

Codecov Report

Merging #3113 into master will decrease coverage by 1.79%.
The diff coverage is 100%.

@@            Coverage Diff            @@
##           master    #3113     +/-   ##
=========================================
- Coverage   56.03%   54.23%   -1.8%     
=========================================
  Files         407      540    +133     
  Lines       30189    38383   +8194     
=========================================
+ Hits        16917    20818   +3901     
- Misses      12424    16324   +3900     
- Partials      848     1241    +393
Flag Coverage Δ
#linux 57.25% <100%> (?)
#windows 56.06% <100%> (+0.02%) ⬆️
Impacted Files Coverage Δ
pkg/trace/event/extractor_fixed_rate.go 100% <100%> (ø) ⬆️
pkg/trace/event/extractor_legacy.go 62.5% <100%> (+62.5%) ⬆️
...g/util/kubernetes/apiserver/metadata_controller.go 55.3% <0%> (ø)
pkg/util/kubernetes/apiserver/diagnosis.go 18.18% <0%> (ø)
pkg/util/containers/cri/diagnosis.go 28.57% <0%> (ø)
pkg/clusteragent/custommetrics/store.go 65.04% <0%> (ø)
pkg/util/hostname_nix.go 0% <0%> (ø)
pkg/util/docker/global.go 0% <0%> (ø)
pkg/util/pipe_nix.go 0% <0%> (ø)
pkg/util/kubernetes/apiserver/apiserver.go 11.91% <0%> (ø)
... and 146 more

@bmermet
Copy link
Contributor

bmermet commented Mar 4, 2019

I agree that having an E2E test from config to the extractor is the best safeguard. Otherwise simply applying ToLower to the string we get from Viper to make sure we enforce it explicitly seems safe enough for me.

@gbbr
Copy link
Contributor Author

gbbr commented Mar 5, 2019

I chose your latter suggestion and lower-cased all the keys on constructing these extractors. I guess from an API standpoint this is the best approach anyway. Let me know what you think.

@gbbr gbbr requested a review from bmermet March 5, 2019 10:37
@gbbr gbbr force-pushed the gbbr/extract-legacy-casing branch 2 times, most recently from faa54f8 to 63734f6 Compare March 5, 2019 10:40
gbbr added 2 commits March 5, 2019 12:50
This change makes `apm_config.analyzed_rate_by_service` and
`apm_config.analyzed_spans` entries case insensitive. The reasoning
behind this is that Viper always lower-cases keys in the yaml file, make
it impossible to compare against the orginal value. See spf13/viper#411.
@gbbr gbbr force-pushed the gbbr/extract-legacy-casing branch from 63734f6 to 8208fda Compare March 5, 2019 10:51
Copy link
Contributor

@bmermet bmermet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@gbbr gbbr merged commit 29e9d37 into master Mar 5, 2019
@gbbr gbbr deleted the gbbr/extract-legacy-casing branch March 5, 2019 13:57
truthbk pushed a commit that referenced this pull request Mar 6, 2019
…3113)

* pkg/trace/event: make event service & operation matchin insensitive

This change makes `apm_config.analyzed_rate_by_service` and
`apm_config.analyzed_spans` entries case insensitive. The reasoning
behind this is that Viper always lower-cases keys in the yaml file, make
it impossible to compare against the orginal value. See spf13/viper#411.
@gbbr gbbr modified the milestones: 6.11.0, 6.10.1 Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team/agent-apm trace-agent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants