hypertrace / javaagent

Hypertrace OpenTelemetry Java agent with payload/body and headers data capture.
Apache License 2.0
34 stars 15 forks source link

Fix config being loaded twice #293

Closed ryandens closed 3 years ago

ryandens commented 3 years ago

Description

Resolves #223 (kind of). This bug no longer seems to be present, but as a result of the investigation into #223 a small thread-safety issue was noticed in the double-checked locking implementation. To fix it, I pulled the implementation of memoizing the AgentConfig into a separate class. This made it easier to inject a test double (specifically, a spy) to verify that the config is properly memoized.

Testing

Added test cases on the memoization and resetting of the memoized value.

Checklist:

Documentation

No new documentation required

This solution was based off of/inspired by

pavolloffay commented 3 years ago

thanks @ryandens