-
Notifications
You must be signed in to change notification settings - Fork 107
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
separate application tracer registration from user named tracers #287
Conversation
Codecov Report
@@ Coverage Diff @@
## main #287 +/- ##
==========================================
+ Coverage 37.28% 37.32% +0.04%
==========================================
Files 47 46 -1
Lines 3251 3255 +4
==========================================
+ Hits 1212 1215 +3
- Misses 2039 2040 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
register_tracer/2, | ||
register_application_tracer/1, |
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 think this is still integrated in the Elixir module: https://github.com/open-telemetry/opentelemetry-erlang/blob/main/apps/opentelemetry_api/lib/open_telemetry.ex#L130
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.
ah yup, thanks!
Wonder if mix xref should be catching that.
a24a60d
to
0ea8959
Compare
As I was updating the changelog just now I had a thought. In current and previous versions a user registering a tracer This made no sense since In this PR, as it stands now, a user registering tracer However, neither would a user registering a tracer named A solution would be to still register all tracers as persistent_terms and the large map would point a module name to a tracer name (application name) which is then looked up. This would greatly shrink what is stored in the map as right now it is a lot of duplication, but would require yet another lookup, semi-psuedo code:
That map looking like I think those duplicate tracer records would be optimized away if the map was constructed like, So should first verify that the tracer record is indeed duplicated. |
a1e8321
to
eaa2a54
Compare
Because `persistent_term:put` slows down as the number of terms grows a project with thousands of modules can cause startup to timeout as it sets a term for every module in it. This patch replaces that term for each module with a single term containing a map of `module => tracer`. Users must be able to register named tracers at runtime and we want to not trigger a global GC by updating the tracer map used for module to tracer mapping. So any user registered tracer will have its own `persistent_term`. The macro for looking up a tracer used in macros like `?with_span` now looks up the tracer by looking up the module in the "application tracers" (the persistent term containing the map). While a user looking up a named tracer will do so with the function `opentelemetry:get_tracer/1` which looks directly for a term with that name. This means a user could register a tracer with the same name as a module. Whether this is good or bad or needs a check to guard against is not covered by this PR.
eaa2a54
to
64cbc0a
Compare
Fixes #279
Because
persistent_term:put
slows down as the number of termsgrows a project with thousands of modules can cause startup to
timeout as it sets a term for every module in it. This patch
replaces that term for each module with a single term containing
a map of
module => tracer
.Users must be able to register named tracers at runtime and we
want to not trigger a global GC by updating the tracer map
used for module to tracer mapping. So any user registered tracer
will have its own
persistent_term
.The macro for looking up a tracer used in macros like
?with_span
now looks up the tracer by looking up the module in the
"application tracers" (the persistent term containing the map).
While a user looking up a named tracer will do so with the function
opentelemetry:get_tracer/1
which looks directly for a term withthat name.
This means a user could register a tracer with the same name as a
module. Whether this is good or bad or needs a check to guard
against is not covered by this PR.