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

module/apmot: fix nil-pointer deref in Inject #763

Merged
merged 2 commits into from May 6, 2020

Conversation

axw
Copy link
Member

@axw axw commented May 6, 2020

If the SpanContext passed to Inject does not contain a Transaction, then Inject would panic due to a nil pointer dereference. Transaction will always be nil in the result of Extract, and will only be set when creating a new span with the context.

We were using the transaction to check if we should inject the legacy header. Since this is not a dynamic configuration setting, we can just use the tracer instead, by adding a tracer.ShouldPropagateLegacyHeader method.

Fixes #761
Supersedes #762

axw added 2 commits May 6, 2020 09:14
If the SpanContext passed to Inject does not
contain a Transaction, then Inject would panic
due to a nil pointer dereference. We were using
the transaction to check if we should inject
the legacy header. Since this is not a dynamic
configuration, we can just use the tracer instead,
by adding a Tracer.ShouldPropagateLegacyHeader
method.
@apmmachine
Copy link
Collaborator

apmmachine commented May 6, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview stats

Expand to view the summary

Build stats

Test stats 🧪

Test Results
Failed 0
Passed 6481
Skipped 158
Total 6639

@codecov-io
Copy link

Codecov Report

Merging #763 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #763      +/-   ##
==========================================
+ Coverage   84.68%   84.71%   +0.02%     
==========================================
  Files         127      127              
  Lines        8384     8385       +1     
==========================================
+ Hits         7100     7103       +3     
+ Misses        899      898       -1     
+ Partials      385      384       -1     
Impacted Files Coverage Δ
module/apmot/tracer.go 85.45% <100.00%> (+1.67%) ⬆️
tracer.go 89.18% <100.00%> (+0.93%) ⬆️
breakdown.go 95.27% <0.00%> (-4.06%) ⬇️

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 4c58b5d...5991ff8. Read the comment docs.

@axw axw merged commit 0267ad0 into elastic:master May 6, 2020
@axw axw deleted the apmot-injet-nil-transaction branch May 6, 2020 01:51
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.

Failure while Injecting a context
3 participants