motiv-labs / janus

An API Gateway written in Go
https://hellofresh.gitbooks.io/janus
MIT License
2.79k stars 318 forks source link

Respect parent sampling decision if not public endpoint #419

Closed s4nji closed 5 years ago

s4nji commented 5 years ago

What does this PR do?

Currently, if IsPublicEndpoint is set to false (and Janus does not ignore propagated traces), and the parent span decides that the trace should not be sampled, Janus still decides whether or not it should sample the trace.
This causes traces without root span to be recorded if it decides to sample against the parent's decision.

This PR adds a new sampler that ensures sampling decision of the parent span are always respected. If there is no parent span (i.e. it's a direct request to Janus), only then the specified sampler will be used (which currently defaults to ProbabilitySampler(0.15)).

Links and References

codecov[bot] commented 5 years ago

Codecov Report

Merging #419 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #419   +/-   ##
=======================================
  Coverage   40.46%   40.46%           
=======================================
  Files          76       76           
  Lines        2659     2659           
=======================================
  Hits         1076     1076           
  Misses       1520     1520           
  Partials       63       63

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 63a0fc2...0c3b906. Read the comment docs.

nenad commented 5 years ago

:+1:

Approved with Zappr Approved with Zappr Approved with Zappr

s-radyuk commented 5 years ago

+1

Approved with Zappr Approved with Zappr Approved with Zappr