Repository navigation
Commit 53bf840
authored
feat(cli): forward TRACEPARENT/TRACESTATE to gateway for CI trace continuity (NVIDIA#2931)
* feat(cli): forward TRACEPARENT/TRACESTATE to gateway for CI trace continuity
The CLI's gateway gRPC channel now passively forwards the W3C trace context
(TRACEPARENT/TRACESTATE) from its environment, so a CI pipeline's trace parents
the gateway's spans. This needs no OTel collector or provider on the CLI side -
short-lived clients on CI runners and jump hosts just pass through what the CI
system already exports.
Add EnvTraceContextInterceptor to openshell-otel: it reads the trace context
once at construction and injects it as gRPC metadata, and is a no-op when the
context is unset or invalid. Compose it with EdgeAuthInterceptor via a new
GatewayInterceptor, since tonic allows only one interceptor per channel.
Closes issue NVIDIA#2639
Signed-off-by: Chris Moore <[email protected]>
* fix(cli): normalize trace-context env reading and cover interceptor composition
Review follow-ups on the trace-context forwarding feature:
- Normalize each TRACEPARENT/TRACESTATE spelling (trim, drop blanks)
before the lower-case fallback so a blank upper-case value no longer
shadows a valid lower-case one
- Share one env-reading helper between EnvTraceContextInterceptor and
set_parent_from_environment so both paths agree on what counts as set
- Pass the TRACEPARENT_ENV/TRACESTATE_ENV constants instead of duplicated
string literals
- Log at debug level when a present TRACEPARENT is invalid, keeping the
passive no-op behavior but leaving a grep-able signal
- Cover EnvTraceContext::from_env (both spellings, padding, blanks) and
the GatewayInterceptor auth+trace composition with tests
- Drop tracestate when traceparent is invalid, and assert it in tests
- Narrow the traces.mdx claim to standard CLI commands, since term and
completions build clients without the trace interceptor
Signed-off-by: Chris Moore <[email protected]>
* fix(otel): address trace-context review findings
- gate the OTLP export stack behind the new `export` feature and build
the CLI against openshell-otel with default-features = false, so the
CLI no longer compiles and links an exporter it never calls
- split the env-reading test so the mixed-case steps only run where
environment names are case-sensitive; the Windows MSVC lane no longer
fails on them
- restore mutated env vars through a drop guard so a failed assertion
cannot leak them into other tests in the same process
- add an SDK test proving auth_interceptor() clones see a refreshed
OIDC token through the shared bearer slot
- word the trace-forwarding docs around OpenTelemetry integrations
instead of implying CI runners export TRACEPARENT natively
Signed-off-by: Chris Moore <[email protected]>
---------
Signed-off-by: Chris Moore <[email protected]>1 parent e4dd312 commit 53bf840
9 files changed
Lines changed: 1298 additions & 830 deletions
File tree
- crates
- openshell-cli
- src
- openshell-otel
- src
- openshell-sdk/src
- docs/observability
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
20 | 46 | | |
21 | 47 | | |
22 | 48 | | |
| |||
313 | 339 | | |
314 | 340 | | |
315 | 341 | | |
316 | | - | |
317 | | - | |
318 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
319 | 346 | | |
320 | 347 | | |
321 | 348 | | |
322 | 349 | | |
323 | 350 | | |
324 | 351 | | |
325 | 352 | | |
326 | | - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
327 | 364 | | |
328 | 365 | | |
329 | 366 | | |
330 | 367 | | |
331 | | - | |
332 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
333 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
334 | 418 | | |
335 | 419 | | |
336 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
47 | 78 | | |
48 | 79 | | |
49 | 80 | | |
0 commit comments