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

Refactor reading of trace identifiers in profiler #1591

Merged
merged 4 commits into from
Jul 14, 2021

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Jul 13, 2021

This PR is an extraction of the work did for #1568, but without the addition of opentelemetry support for profiler.

We're still discussing with upstream how opentelemetry support will look (see open-telemetry/opentelemetry-ruby#842), but I rather liked the refactoring that we did, so I'd like to merge it in, and later we can just add the missing bits from #1568.

This refactor will enable us to support getting the trace identifiers
from more than just datadog traces without adding yet more logic to the
stack collector.
As discussed during PR review of #1568, it's problematic to just cache
whatever's in `Datadog.tracer` because we can observe the old value
during component initialization.

To break the loop, let's instead directly initialize the
`TraceIdentifiers::Ddtrace` class with the correct tracer during
component initialization.

IMHO this has a further advantage: it makes it really explict where
there is a tracer-to-profiler dependency whereas previously there was
just a call to `Datadog.tracer` deep in the bowels of the profiler that
could be called at any point.
@ivoanjo ivoanjo requested a review from a team July 13, 2021 10:21
@codecov-commenter
Copy link

Codecov Report

Merging #1591 (4f72415) into master (a54750f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1591   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files         896      900    +4     
  Lines       43010    43081   +71     
=======================================
+ Hits        42263    42334   +71     
  Misses        747      747           
Impacted Files Coverage Δ
lib/ddtrace/configuration/components.rb 98.21% <100.00%> (+0.01%) ⬆️
lib/ddtrace/profiling.rb 100.00% <100.00%> (ø)
lib/ddtrace/profiling/collectors/stack.rb 98.92% <100.00%> (-0.05%) ⬇️
lib/ddtrace/profiling/trace_identifiers/ddtrace.rb 100.00% <100.00%> (ø)
lib/ddtrace/profiling/trace_identifiers/helper.rb 100.00% <100.00%> (ø)
spec/ddtrace/configuration/components_spec.rb 99.80% <100.00%> (+<0.01%) ⬆️
spec/ddtrace/profiling/collectors/stack_spec.rb 99.06% <100.00%> (-0.05%) ⬇️
spec/ddtrace/profiling/integration_spec.rb 94.77% <100.00%> (+0.06%) ⬆️
...dtrace/profiling/trace_identifiers/ddtrace_spec.rb 100.00% <100.00%> (ø)
...ddtrace/profiling/trace_identifiers/helper_spec.rb 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a54750f...4f72415. Read the comment docs.

@ivoanjo ivoanjo merged commit 4be092e into master Jul 14, 2021
@ivoanjo ivoanjo deleted the ivoanjo/extract-trace-to-profile-refactor branch July 14, 2021 07:47
@github-actions github-actions bot added this to the 0.52.0 milestone Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants