Commit 58ce111
committed
Better span sampler (#903)
* Better span sampler
This updates OpenTelemetry.Sampler so that it uses
`traces_sample_rate` for sampling spans before they
get sent to the span processor.
This way we're not processing spans when they are
dropped during sampling, which was previously the
case as the Client was responsible for sampling
just before attemping to send a transaction.
* Enhance sampling logic to record discarded transactions
* Clarify trace-level sampling decision-making
Previously it incorrectly referred to "parent" where
in reality we're dealing with spans from the same
trace and respect sampling decisions that were
already made for a given trace.
This is not the same thing as parent/child spans
that we're handling in the SpanProcessor as this
type of relationship is established post-sampling.
* Remove unnecessary sleep calls in sampler tests
* Fix flaky test
* Clean up make_sampling_decision
* Simplify client reports for dropped transactions
* Update traces_sample_rate default value to be nil
* Account for `nil` sample_rate when sampling
* Use put_test_config
* Update traces_sample_rate spec to allow nil value1 parent 55cacc1 commit 58ce111
File tree
9 files changed
+611
-40
lines changed- lib/sentry
- client_report
- opentelemetry
- test
- sentry
- opentelemetry
9 files changed
+611
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| |||
126 | 124 | | |
127 | 125 | | |
128 | 126 | | |
129 | | - | |
130 | | - | |
| 127 | + | |
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
134 | 131 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 132 | | |
140 | 133 | | |
141 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | | - | |
27 | | - | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
621 | 622 | | |
622 | 623 | | |
623 | 624 | | |
624 | | - | |
| 625 | + | |
625 | 626 | | |
626 | 627 | | |
627 | 628 | | |
| |||
662 | 663 | | |
663 | 664 | | |
664 | 665 | | |
665 | | - | |
| 666 | + | |
666 | 667 | | |
667 | 668 | | |
668 | 669 | | |
| |||
763 | 764 | | |
764 | 765 | | |
765 | 766 | | |
766 | | - | |
767 | | - | |
768 | | - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
769 | 770 | | |
770 | 771 | | |
771 | | - | |
| 772 | + | |
772 | 773 | | |
773 | 774 | | |
774 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
7 | 15 | | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
| 19 | + | |
11 | 20 | | |
12 | 21 | | |
13 | 22 | | |
14 | 23 | | |
| 24 | + | |
15 | 25 | | |
16 | | - | |
| 26 | + | |
17 | 27 | | |
18 | 28 | | |
19 | 29 | | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
28 | 58 | | |
29 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
30 | 127 | | |
31 | 128 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | | - | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
| |||
0 commit comments