Commit d4333fe
committed
agents,lib,src,test: add traceSampleRate support
Add end-to-end traceSampleRate handling across config, runtime
propagation, tracing decisions, and regression tests.
Why:
- Enable configurable probabilistic trace sampling with predictable
behavior.
- Ensure consistent semantics across all config entry points.
- Prevent invalid updates from corrupting current sampling behavior.
- Keep transaction consistency by deciding sampling at the root span
only.
What changed:
- Added traceSampleRate parsing and normalization in JS config paths
with explicit default fallback and finite/range validation in [0, 1].
- Added native config sanitization for traceSampleRate to reject invalid
values before merge, preserving previous valid configuration.
- Ensured runtime sampling state is synchronized from effective current
config after updates to avoid stale shared-memory sample rates.
- Added gRPC reconfigure support for traceSampleRate in proto and agent
mapping, including generated protobuf updates.
- Updated tracing logic so root spans perform the sampling decision and
child spans inherit parent traceFlags.
- Extended tests for:
- invalid value handling (including NaN/Infinity)
- env/package bootstrap behavior
- partial updates preserving existing traceSampleRate
- gRPC invalid-update fallback behavior
- sampling behavior at 0%, 50% (tolerance), and 100%
- worker-thread sampling behavior
- explicit parent/child trace consistency assertions1 parent a7ffd74 commit d4333fe
15 files changed
Lines changed: 540 additions & 43 deletions
File tree
- agents/grpc
- proto
- src
- proto
- lib
- internal/otel
- src/nsolid
- test
- addons/nsolid-tracing
- agents
- fixtures
- parallel
| 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 | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
388 | 393 | | |
389 | 394 | | |
390 | 395 | | |
| |||
1758 | 1763 | | |
1759 | 1764 | | |
1760 | 1765 | | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
1761 | 1770 | | |
1762 | 1771 | | |
1763 | 1772 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments