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

Floats in statsd percentiles #5528

Closed

Conversation

Pitxyoki
Copy link
Contributor

@Pitxyoki Pitxyoki commented Mar 4, 2019

Required for all PRs:

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

This addresses #5527. Note that this will be a breaking change for those using the plugin with the percentile array configured with integer numbers. It will now fail in those cases and only work with floats.

The already-present Unit Tests were only slightly changed to accept the correct type. No new tests were added.
A signed CLA should be on its way.

@glinton glinton added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin area/statsd labels Mar 4, 2019
@glinton
Copy link
Contributor

glinton commented Mar 4, 2019

Can you make the pr against master?

@danielnelson
Copy link
Contributor

For the backwards compatibility issue, we can define a number type. Place this in internal/internal.go:

type Number struct {
	Value float64
}

func (n *Number) UnmarshalTOML(b []byte) error {
	value, err := strconv.ParseFloat(string(b), 64)
	if err != nil {
		return err
	}

	n.Value = value
	return nil
}

Then use a []internal.Number as the type in the plugin.

@Pitxyoki Pitxyoki changed the base branch from release-1.9 to master March 12, 2019 16:01
@Pitxyoki Pitxyoki changed the base branch from master to release-1.9 March 12, 2019 16:02
@Pitxyoki
Copy link
Contributor Author

Thank you for your feedback. This will continue in #5572.

@Pitxyoki Pitxyoki closed this Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/statsd feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants