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

Fix translate empty tag values #5083

Merged
merged 3 commits into from
Dec 13, 2018
Merged

Fix translate empty tag values #5083

merged 3 commits into from
Dec 13, 2018

Conversation

raphaelquati
Copy link
Contributor

@raphaelquati raphaelquati commented Dec 4, 2018

Fix for #5063

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@glinton glinton added platform/windows fix pr to fix corresponding bug labels Dec 6, 2018
@glinton
Copy link
Contributor

glinton commented Dec 6, 2018

Also, don't forget to sign the CLA.

@raphaelquati
Copy link
Contributor Author

raphaelquati commented Dec 6, 2018

I've already sign! Forgot to check!

@glinton glinton added this to the 1.9.1 milestone Dec 6, 2018
dimensionNames = append(dimensionNames, tag.Key)
dimensionValues = append(dimensionValues, tag.Value)
if value == "" {
value = "<empty>"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can dimensions be added with the value as the empty string instead of using a placeholder value?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we can't have empty strings at all, I'd like to try this instead:

diff --git a/plugins/outputs/azure_monitor/azure_monitor.go b/plugins/outputs/azure_monitor/azure_monitor.go
index 5c435ac0..1c933072 100644
--- a/plugins/outputs/azure_monitor/azure_monitor.go
+++ b/plugins/outputs/azure_monitor/azure_monitor.go
@@ -340,6 +340,9 @@ func hashIDWithTagKeysOnly(m telegraf.Metric) uint64 {
        h.Write([]byte(m.Name()))
        h.Write([]byte("\n"))
        for _, tag := range m.TagList() {
+               if tag.Key == "" || tag.Value == "" {
+                       continue
+               }
                h.Write([]byte(tag.Key))
                h.Write([]byte("\n"))
        }

Copy link
Contributor Author

@raphaelquati raphaelquati Dec 12, 2018

Choose a reason for hiding this comment

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

Yes. this implementation is better. I've tested here with success.
image

@danielnelson danielnelson modified the milestones: 1.9.1, 1.9.2 Dec 11, 2018
@danielnelson danielnelson merged commit f794d5b into influxdata:master Dec 13, 2018
danielnelson pushed a commit that referenced this pull request Dec 13, 2018
trevorwhitney pushed a commit to trevorwhitney/telegraf that referenced this pull request Feb 14, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug platform/windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants