Commit 4dd532f
authored
refactor(trace-utils)!: change header name type to accept dynamic values (#1722)
# What does this PR do?
* Change the header map type passed throughout data-pipeline and trace
utils from `Hashmap<&'static str, String> to `http::HeaderMap`
This should not cause extra allocations for fixed header names, as the
header names for string values are "const constructed" and trivially
copyable.
In fact it should cause less allocations as header values are now
`http::HeaderValue` instead of `String`. The static ones don't require
an allocation and clone becomes a shallow copy.
# Motivation
OTLP supports requires the ability to defined extra headers sent with
the payload in configuration
# Additional Notes
The first iteration I went through created a `Hashmap<http::HeaderName,
String>` but this does not work, as http::HeaderName implement
Borrow<str> but does not hash like the &str it represents (see
hyperium/http#824)1 parent 5426a8b commit 4dd532f
File tree
8 files changed
+184
-171
lines changed- libdd-common/src
- libdd-data-pipeline/src
- trace_exporter
- libdd-trace-utils/src
- send_data
- send_with_retry
8 files changed
+184
-171
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 89 | | |
94 | 90 | | |
95 | 91 | | |
| |||
101 | 97 | | |
102 | 98 | | |
103 | 99 | | |
104 | | - | |
| 100 | + | |
105 | 101 | | |
106 | 102 | | |
107 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
87 | | - | |
| 86 | + | |
88 | 87 | | |
89 | 88 | | |
90 | | - | |
91 | | - | |
| 89 | + | |
| 90 | + | |
92 | 91 | | |
93 | 92 | | |
94 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
| 151 | + | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
566 | | - | |
| 566 | + | |
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
741 | | - | |
| 741 | + | |
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| |||
876 | 876 | | |
877 | 877 | | |
878 | 878 | | |
879 | | - | |
880 | 879 | | |
881 | 880 | | |
882 | 881 | | |
| |||
920 | 919 | | |
921 | 920 | | |
922 | 921 | | |
923 | | - | |
| 922 | + | |
924 | 923 | | |
925 | 924 | | |
926 | 925 | | |
| |||
Lines changed: 22 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
90 | 86 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
| |||
115 | 110 | | |
116 | 111 | | |
117 | 112 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 113 | + | |
121 | 114 | | |
122 | 115 | | |
123 | 116 | | |
| |||
179 | 172 | | |
180 | 173 | | |
181 | 174 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
188 | 178 | | |
189 | 179 | | |
190 | 180 | | |
| |||
212 | 202 | | |
213 | 203 | | |
214 | 204 | | |
215 | | - | |
216 | | - | |
| 205 | + | |
| 206 | + | |
217 | 207 | | |
218 | 208 | | |
219 | 209 | | |
| |||
346 | 336 | | |
347 | 337 | | |
348 | 338 | | |
349 | | - | |
| 339 | + | |
350 | 340 | | |
351 | 341 | | |
352 | 342 | | |
| |||
377 | 367 | | |
378 | 368 | | |
379 | 369 | | |
380 | | - | |
381 | | - | |
382 | | - | |
| 370 | + | |
383 | 371 | | |
384 | 372 | | |
385 | 373 | | |
| |||
394 | 382 | | |
395 | 383 | | |
396 | 384 | | |
397 | | - | |
| 385 | + | |
398 | 386 | | |
399 | 387 | | |
400 | 388 | | |
| |||
0 commit comments