Commit 50dd8eb
refactor: improve OTLP endpoint configuration handling
Change InitTracer to accept endpoint as parameter instead of reading
from environment variable. This improves testability and follows
separation of concerns.
Changes:
- InitTracer now takes endpoint as parameter: InitTracer(ctx, endpoint)
- Remove confusing env var manipulation in cmd/build.go
- Simplify test (no need to manipulate environment)
- Make configuration flow clearer: flag → function parameter
Benefits:
- Easier to test (no env var side effects)
- Clearer API (explicit parameter vs implicit env var)
- Consistent with other reporters (e.g., SegmentReporter)
- No circular dependency between flag default and env var
Co-authored-by: Ona <no-reply@ona.com>1 parent 0e0a067 commit 50dd8eb
3 files changed
+7
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 328 | + | |
| 329 | + | |
335 | 330 | | |
336 | 331 | | |
337 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | | - | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 170 | + | |
180 | 171 | | |
181 | | - | |
| 172 | + | |
182 | 173 | | |
183 | 174 | | |
184 | 175 | | |
| |||
0 commit comments