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

[CIAPP-1208] Rework RSpec instrumentation as separate traces for each test #1381

Merged

Conversation

AdrianLC
Copy link
Contributor

This fixes an issue on ci-app where we do not expect several spans with type: test on the same trace.
We discussed two options and went for this:

  • Adding a new span type for rspec example_group, that would be excluded from our indexation and queries.
  • Reworking the instrumentation to match how it works on other junit style frameworks, as well as on the JS instrumentation for Jest (which also has a BDD style interface).

The instrumentation now only patches RSpec::Example and we remove any wrapping on ExampleGroup.
This is a new integration only used internally so it should be fine to re-do without backwards compatibility concerns.

I also increased the test coverage to address our concerns not knowing how it would work with the lazy nature of rspec on let, and before/after/around hooks.

@AdrianLC AdrianLC self-assigned this Feb 24, 2021
@AdrianLC AdrianLC requested review from a team February 24, 2021 15:54
@codecov-io
Copy link

Codecov Report

Merging #1381 (b233d53) into master (b06b84f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1381   +/-   ##
=======================================
  Coverage   98.13%   98.14%           
=======================================
  Files         755      754    -1     
  Lines       35885    35946   +61     
=======================================
+ Hits        35217    35279   +62     
+ Misses        668      667    -1     
Impacted Files Coverage Δ
lib/ddtrace/contrib/rspec/ext.rb 100.00% <ø> (ø)
lib/ddtrace/contrib/rspec/integration.rb 100.00% <ø> (ø)
lib/ddtrace/contrib/rspec/patcher.rb 100.00% <ø> (ø)
spec/ddtrace/contrib/rspec/patcher_spec.rb 100.00% <ø> (ø)
lib/ddtrace/contrib/rspec/example.rb 94.59% <100.00%> (+1.49%) ⬆️
spec/ddtrace/contrib/rspec/instrumentation_spec.rb 100.00% <100.00%> (ø)
...b/action_pack/action_controller/instrumentation.rb 94.28% <0.00%> (-1.43%) ⬇️

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 b06b84f...b233d53. Read the comment docs.

@marcotc marcotc merged commit 390df27 into master Feb 24, 2021
@marcotc marcotc deleted the adrian.lopezcalvo/rspec-rework-tests-as-separate-traces branch February 24, 2021 20:43
@github-actions github-actions bot added this to the 0.46.0 milestone Feb 24, 2021
Copy link
Contributor

@juan-fernandez juan-fernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Not like my Ruby skills are off the charts 😆

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.

None yet

5 participants