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

Ensure we don't mutate provided statistics tags #7203

Merged
merged 1 commit into from
Aug 24, 2016
Merged

Ensure we don't mutate provided statistics tags #7203

merged 1 commit into from
Aug 24, 2016

Conversation

e-dard
Copy link
Contributor

@e-dard e-dard commented Aug 24, 2016

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass

@jsternberg as we discussed yesterday.

@mention-bot
Copy link

@e-dard, thanks for your PR! By analyzing the annotation information on this pull request, we identified @gunnaraasen to be a potential reviewer

@jsternberg
Copy link
Contributor

I think this can probably be more easily done by just adding a MergeTags() function that returns a new map. I don't think there's any need to create a new type.

@e-dard
Copy link
Contributor Author

e-dard commented Aug 24, 2016

@jsternberg you mean MergeTags(a, b map[string]string)?

I had a couple of reasons for the StatisticTags type:

  • It's impossible to get the arguments the wrong way around and accidentally merge the wrong thing onto the wrong thing;
  • It makes it clear what sort of tags we're talking about when we do defaultTags models.StatisticTags on the types, rather than defaultTags map[string]string.

I don't mind changing it to MergeTags(a, b map[string]string) if it's preferred though.

@jsternberg
Copy link
Contributor

It's fine with me as-is 👍

I think the order might be wrong since I think the statTags are supposed to overwrite what's passed in, but I made that mistake originally when I first did this and they don't conflict anyway. We'll fix that another time if it ends up being an issue.

@e-dard e-dard merged commit 8bb3fcb into master Aug 24, 2016
@e-dard e-dard deleted the er-stats branch August 24, 2016 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants