feat(ARSN-592): expose manual instrumentation API in lib/tracing#2639
feat(ARSN-592): expose manual instrumentation API in lib/tracing#2639delthas wants to merge 2 commits into
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:
|
0bd8b62 to
0b17396
Compare
ConflictThere is a conflict between your branch Please resolve the conflict on the feature branch ( git fetch && \
git checkout origin/improvement/ARSN-592/manual-instrumentation-api && \
git merge origin/development/8.4Resolve merge conflicts and commit git push origin HEAD:improvement/ARSN-592/manual-instrumentation-api |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/8.4 #2639 +/- ##
================================================
Coverage 73.94% 73.94%
================================================
Files 229 229
Lines 18483 18495 +12
Branches 3823 3849 +26
================================================
+ Hits 13667 13676 +9
- Misses 4811 4814 +3
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Complements `instrumentApiMethod` for consumers whose dispatch owns the span lifecycle directly (e.g. a Router method where the start + end points are visible together). `instrumentApiMethod`'s wrap-once- at-module-load shape fits flat dispatch tables (cloudserver `api[name]=handler`, backbeat handlers); for centralized dispatch the wrap costs an extra per-Route cache + a static-this `.bind` dance to amortize a wrap on a single call site. `startApiSpan(action)` returns: - `end(err?)` — reuses the existing exported `endSpan(span, err?)` so the `recordException` + status + `error.type` ceremony stays in one place; same err-as-optional convention. - `withContext(fn)` — runs `fn` with the span set as the active context so child auto-spans (mongo, ioredis, http) nest underneath. When OTEL is off, returns a no-op object; no `@opentelemetry/api` load on the disabled path. Issue: ARSN-592
Issue: ARSN-592
0b17396 to
bf94ffc
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
|
LGTM |
Summary
Adds
startApiSpan(action)tolib/tracingalongside the existinginstrumentApiMethod— a manual-lifecycle helper for consumers whose dispatch site owns the span start + end points directly.api.<action>(sameSPAN_PREFIXasinstrumentApiMethod).end(err?)reuses the existing exportedendSpan(span, err?)so therecordException+ status +error.typeceremony stays in one place. Same err-as-optional convention.withContext(fn)runsfnwith the span set on the active context so child auto-spans (mongo, ioredis, http) nest underneath.@opentelemetry/apiload.Motivation
VAULT-708 consumes the tracing module via vault PR #203. Reviewer feedback (thread) pointed out that
instrumentApiMethod's wrap-once-at-module-load shape — natural for cloudserver's flat `api[name]=handler` table — forces vault to add a per-Route wrap cache + a static-this `.bind` dance + a new lazy method on Route just to amortize a wrap on a single centralized dispatch site (`Router._startRequest`). `startApiSpan` lets vault call the helper inline at the dispatch site instead, no caching layer needed.Both APIs produce the same span output and share the underlying `endSpan` ceremony; the choice is stylistic at the consumer.
Tests
5 new unit tests in `tests/unit/tracing/instrumentation.spec.js` (13 total in the file):
Related
Issue: ARSN-592