-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
refactor: consistently use one uuid library #40161
Conversation
the codebase is using a mix of github.com/google/uuid and github.com/gofrs/uuid Update the codebase to use github.com/gofrs/uuid consistently and bump to the current major version.
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Is there a good argument for one over the other? The APIs look pretty similar, but there are some aspects of each that are not in the other, so one is not a drop in replacement for the other. |
Good point! I don't have a strong opinion on either. To be honest, I went with
Can you expand on this ? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far the PR looks great! I don't have any strong preference about which library to use, but I like the fact that github.com/gofrs/uuid
is community maintained.
@kruskall do you think it would be worth it to add the google/uuid to the gomodguard section of |
Pinging @elastic/obs-ds-hosted-services (Team:obs-ds-hosted-services) |
Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform) |
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Pinging @elastic/sec-deployment-and-devices (Team:Security-Deployment and Devices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a pity that this is mixed up with lint clean up.
switch err { | ||
case ErrFileTruncate: | ||
switch { | ||
case errors.Is(err, ErrFileTruncate): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any cases that these error values are returned wrapped so (disclaimer: as a non-owner) I'm not convinced of the value of this, but if this change is going to be made, the tests that look at error values should be updated to match (ErrInactive
is the target of an exact value check).
@@ -59,7 +59,7 @@ func NewInputRegistry(inputType, id string, optionalParent *monitoring.Registry) | |||
// logs during support interactions. | |||
log := logp.NewLogger("metric_registry") | |||
// Make an orthogonal ID to allow tracking register/deregister pairs. | |||
uuid := uuid.New().String() | |||
uuid := uuid.Must(uuid.NewV4()).String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS crypto/rand.Reader
hides EAGAIN so this should be OK.
@elastic/beats-tech-leads sorry for the ping, this only need one more review. Any help ? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single nit about a check that might have become redundant, but this LGTM
Proposed commit message
consistently use one uuid library
the codebase is using a mix of github.com/google/uuid and github.com/gofrs/uuid Update the codebase to use github.com/gofrs/uuid consistently and bump to the current major version.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs