Commit ac6e2f1
authored
fix(node): Pass inferred name & attributes to
Previously, we passed the span name directly to the `tracesSampler`
as-is. However, this is not ideal because this does not match the name
we actually send to sentry later, making this confusing. The reason is
that we infer the name from the attributes for some types of spans, but
we do that at export-time.
This PR adjust this so that we send the inferred name & attributes to
the `tracesSampler`. This works reasonably enough. However, there is a
big caveat: This still only has access to the initial attributes that a
span has at creation time. This means that we'll never have e.g. the
`http.route` correctly there, because all `http.server` spans originate
from the http instrumentation where they do not have a route yet, and
then more specific instrumentation (e.g. express or fastify) add the
`http.route` to that span later. So the name will never be parametrized,
for example, for `http.server` spans, which is not ideal (as it will
still not match the final span exactly) but should still be better than
what we had so far (where the name would always just be e.g. `GET`).
Fixes #12944tracesSampler (#12945)1 parent 4549263 commit ac6e2f1
File tree
6 files changed
+131
-39
lines changed- dev-packages/node-integration-tests/suites/express/tracing/tracesSampler
- packages/opentelemetry
- src
- utils
- test
6 files changed
+131
-39
lines changedLines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
59 | 81 | | |
60 | 82 | | |
61 | 83 | | |
62 | 84 | | |
63 | | - | |
64 | | - | |
| 85 | + | |
| 86 | + | |
65 | 87 | | |
66 | 88 | | |
67 | 89 | | |
| |||
72 | 94 | | |
73 | 95 | | |
74 | 96 | | |
75 | | - | |
76 | | - | |
| 97 | + | |
| 98 | + | |
77 | 99 | | |
78 | | - | |
| 100 | + | |
79 | 101 | | |
80 | 102 | | |
81 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
| |||
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
93 | | - | |
94 | | - | |
95 | 91 | | |
96 | 92 | | |
97 | 93 | | |
| |||
131 | 127 | | |
132 | 128 | | |
133 | 129 | | |
134 | | - | |
135 | | - | |
136 | 130 | | |
137 | 131 | | |
138 | 132 | | |
| |||
156 | 150 | | |
157 | 151 | | |
158 | 152 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 153 | | |
168 | | - | |
| 154 | + | |
169 | 155 | | |
170 | 156 | | |
171 | 157 | | |
172 | 158 | | |
173 | 159 | | |
174 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
175 | 166 | | |
176 | 167 | | |
177 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
33 | 31 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
| |||
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
57 | | - | |
| 52 | + | |
58 | 53 | | |
59 | 54 | | |
60 | 55 | | |
| |||
97 | 92 | | |
98 | 93 | | |
99 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1320 | 1320 | | |
1321 | 1321 | | |
1322 | 1322 | | |
1323 | | - | |
1324 | | - | |
1325 | | - | |
| 1323 | + | |
1326 | 1324 | | |
1327 | 1325 | | |
1328 | 1326 | | |
| |||
1357 | 1355 | | |
1358 | 1356 | | |
1359 | 1357 | | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1363 | 1368 | | |
1364 | | - | |
| 1369 | + | |
1365 | 1370 | | |
1366 | 1371 | | |
1367 | 1372 | | |
1368 | 1373 | | |
1369 | | - | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1370 | 1377 | | |
1371 | 1378 | | |
1372 | 1379 | | |
| |||
0 commit comments