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

Migrate to math/rand/v2 #34676

Open
25 tasks
mx-psi opened this issue Aug 14, 2024 · 6 comments
Open
25 tasks

Migrate to math/rand/v2 #34676

mx-psi opened this issue Aug 14, 2024 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed priority:p3 Lowest

Comments

@mx-psi
Copy link
Member

mx-psi commented Aug 14, 2024

Component(s)

No response

Describe the issue you're reporting

Go 1.22 introduced math/rand/v2 which replaces the math/rand stdlib package. We should migrate to it!

Once we have migrated, we can forbid its usage via depguard.

Components using math/rand v1:

  • connector/servicegraphconnector
  • examples/demo
  • exporter/awskinesisexporter
  • exporter/awss3exporter
  • exporter/azuredataexplorerexporter
  • exporter/clickhouseexporter
  • exporter/datasetexporter
  • exporter/loadbalancingexporter
  • exporter/mezmoexporter
  • exporter/otelarrowexporter
  • exporter/rabbitmqexporter
  • internal/aws
  • internal/coreinternal
  • internal/exp
  • internal/otelarrow
  • pkg/batchperresourceattr
  • pkg/sampling
  • pkg/stanza
  • processor/deltatocumulativeprocessor
  • processor/groupbyattrsprocessor
  • processor/probabilisticsamplerprocessor
  • processor/tailsamplingprocessor
  • receiver/awsfirehosereceiver
  • testbed/testbed
  • testbed/tests

(generated with rg math/rand -l -tgo | cut -d'/' -f1-2 | sort | uniq | sed 's/^/- [ ] /')

Counterpart to open-telemetry/opentelemetry-collector/issues/10885.

@mx-psi mx-psi added needs triage New item requiring triage enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers priority:p3 Lowest and removed needs triage New item requiring triage labels Aug 14, 2024
@Kei-Ta
Copy link

Kei-Ta commented Aug 22, 2024

I can pick this up

@mx-psi
Copy link
Member Author

mx-psi commented Aug 22, 2024

@Kei-Ta This is being worked on in the linked PR #34685. Feel free to leave a review there :)

@mx-psi mx-psi linked a pull request Aug 22, 2024 that will close this issue
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

@github-actions github-actions bot added the Stale label Oct 22, 2024
@mx-psi mx-psi removed the Stale label Oct 22, 2024
@jmacd
Copy link
Contributor

jmacd commented Oct 29, 2024

We should migrate to it!

Please say why? It's not obvious.

@mx-psi
Copy link
Member Author

mx-psi commented Oct 29, 2024

@jmacd You can read https://go.dev/blog/randv2#problem and also the last section: https://go.dev/blog/randv2#principles. In summary: math/rand has some issues, and for all packages in the standard library with a v2, the v1 version will either have the same functionality or be, if possible, a wrapper over v2, so using v1 should always be worse than migrating to v2 for standard library packages.

@mx-psi
Copy link
Member Author

mx-psi commented Oct 29, 2024

Adding to this: our policy (as shown by our tooling) is to use the latest version available of all dependencies. This particular case is special because v1 will keep on being supported, but in general, to ensure we can quickly answer to new vulnerabilities in our dependencies web update everything to the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed priority:p3 Lowest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants