feat: add reusable OpenTelemetry tracing module#2632
Conversation
Hello delthas,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
408e74e to
ce66e82
Compare
ce66e82 to
487868d
Compare
487868d to
91330b8
Compare
91330b8 to
daae8f6
Compare
daae8f6 to
cd1d740
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/8.4 #2632 +/- ##
===================================================
+ Coverage 73.65% 73.92% +0.26%
===================================================
Files 223 229 +6
Lines 18247 18480 +233
Branches 3776 3847 +71
===================================================
+ Hits 13440 13661 +221
- Misses 4802 4814 +12
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cd1d740 to
64d8898
Compare
|
@francoisferrand @DarkIsDude intentionally tagging you here as this is moving cloudserver code you already reviewed into this PR. |
15c51a2 to
7c47604
Compare
997efac to
1adc5b1
Compare
1adc5b1 to
98e8782
Compare
f9194b3 to
e40ed56
Compare
Consolidate the OTEL SDK bootstrap, outbound trust-boundary request
hook, health-path span filter, API-method span instrumentor, and kafka
trace-context helpers — previously duplicated across backbeat,
cloudserver and vault — into a single arsenal lib/tracing module,
consumed via require('arsenal/build/lib/tracing').
Consumers supply their own instrumentations through a lazy thunk, so
arsenal keeps only the OTEL SDK core as a dependency (no
instrumentation-* packages). API spans use a shared scality.api scope,
api.<method> names and the error.type attribute; service identity comes
from service.name on the resource. endSpan is exported for consumers
that own their spans (e.g. backbeat's kafka pipeline), and
instrumentApiMethod preserves the static-method `this` receiver.
Issue: ARSN-586
e40ed56 to
d22c781
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
Issue: ARSN-586
Review by Claude Code |
|
/approve |
|
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
This pull request did not target the following hotfix branch(es) so they
Please check the status of the associated issue ARSN-586. Goodbye delthas. The following options are set: approve |
What
Extracts the OpenTelemetry tracing code duplicated across backbeat, cloudserver and vault into a single shared module,
lib/tracing/, consumed viarequire('arsenal/build/lib/tracing').It provides:
init(options)/close()/isEnabled()— SDK bootstrap (ParentBased(TraceIdRatio) sampler, span limits, traces-only, fail-fast asserts, bounded-flush shutdown race). Config assembly is split into a testablebuildSdkConfig().loadTrustedHosts()/makeTrustedHostsHook()— outbound trust boundary that stripstraceparent/tracestateon calls to untrusted hosts.OTEL_TRUSTED_HOSTSsupports NO_PROXY-style.suffixentries (e.g..svc.cluster.localtrusts every in-cluster service, subdomains and apex). We do not bother doing a trim() on each host, the value is expected to be well-formed, avoiding swallowing formatting mistakes.isHealthPath(url, pathSet)— probe/scrape span filter.instrumentApiMethod(handler, name)— per-API-method span wrapper (scopescality.api, spanapi.<method>,error.typeattribute; service disambiguated byservice.nameon the resource).kafka.*— W3C trace-context propagation over node-rdkafka headers.Design notes
init()takes a lazyinstrumentations: () => Instrumentation[]thunk, invoked only when OTEL is enabled. So arsenal carries noinstrumentation-*packages — only the OTEL SDK core, asoptionalDependencies;@opentelemetry/apistays a hard (inert) dependency.require('arsenal').tracing. The arsenal barrel eagerly loads ioredis/mongodb; reachinginit()through it would load them before OTEL can patch them. Thelib/tracingsubpath loads nothing instrumentable at import time.ENABLE_OTEL=trueto enable); seelib/tracing/README.mdfor env vars and usage.Consumer adoption (backbeat, cloudserver, vault) lands in separate PRs once this ships.
Issue: ARSN-586