newrelic / newrelic-telemetry-sdk-java

Java library for sending telemetry data to New Relic
Apache License 2.0
41 stars 37 forks source link

Update Utils.generateUUID() to generate UUIDs conforming to RFC 4122 V4 #300

Closed tmancill closed 2 years ago

tmancill commented 2 years ago

This PR addresses the issue @Steven-M-Brown raised in https://github.com/newrelic/newrelic-telemetry-sdk-java/pull/292#issuecomment-1228879917. The code in #292 will generate UUIDs that don't conform to RFC 4122.

The logic in Utils.generateUUID() is verbose because I thought it best to adhere as closely to the logic in UUID.randomUUID() and the UUID(byte[]) constructor signature as possible.