dd-trace-rb
dd-trace-rb copied to clipboard
[WIP] Add ActiveRecord SQL caller stack
Description
Adds an additional query_caller_stack
tag to ActiveRecord spans. The new tag includes the Rails' caller stack that triggered the SQL execution. Including the query caller stack as part of the span significantly improves the ability to trace down slow queries reported by DataDog to the part of the code from which it originated and ultimately fixing the query.
TODO
- [ ] Add specs
- [ ] Add screenshots
Codecov Report
Merging #1483 (86cba91) into master (c82e5b3) will decrease coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #1483 +/- ##
==========================================
- Coverage 98.22% 98.22% -0.01%
==========================================
Files 860 860
Lines 41271 41278 +7
==========================================
+ Hits 40538 40544 +6
- Misses 733 734 +1
Impacted Files | Coverage Δ | |
---|---|---|
lib/ddtrace/contrib/active_record/events/sql.rb | 97.56% <100.00%> (+0.12%) |
:arrow_up: |
lib/ddtrace/contrib/active_record/ext.rb | 100.00% <100.00%> (ø) |
|
lib/ddtrace/contrib/active_record/utils.rb | 90.90% <100.00%> (+0.90%) |
:arrow_up: |
spec/ddtrace/contrib/sinatra/activerecord_spec.rb | 78.12% <100.00%> (+0.34%) |
:arrow_up: |
...b/action_pack/action_controller/instrumentation.rb | 94.28% <0.00%> (-1.43%) |
:arrow_down: |
spec/ddtrace/configuration/components_spec.rb | 99.80% <0.00%> (-0.01%) |
:arrow_down: |
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 c82e5b3...86cba91. Read the comment docs.
Thanks for the pull request @sandboxws. Can you show us a screenshot of this in action? What does the tag look like?
@delner of course! Will a screenshot of the Ruby hash output suffice or do you prefer a screenshot from an actual DataDog trace from a live product ( i.e. from a DataDog dashboard )?