feat: implemented span stack trace configuration #2181
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
EPIC link: https://jsw.ibm.com/browse/INSTA-57356
This will be the final PR to main for the stack trace filtering feature!
This PR proposes a refactor of the current instrumentation error/stack logic and introduces a new configuration option (
INSTANA_STACK_TRACE) to control stack trace collection behaviour across all instrumentations based on the EPIC design.Goals / Design
none,error,all) - implementationin-code/env:
INSTANA_STACK_TRACE_LENGTH(was already supported by Node.js tracer) - this is global. We don't have any community design for global/local envs yet.INSTANA_STACK_TRACE(this is new) - this is also global. We don't have any community design for global/local envs yet.tracing.stackTraceLength(was already supported by Node.js tracer) -> this is also global. We accepttracing.global.stackTraceLengthas an input param and we print a deprecation warning fortracing.stackTraceLength. Later on as soon as we have full local filtering support, we can continue with the migration.tracing.stackTrace(this is new) - this is also global for now. Same here, we start with the migration (tracing.global.stackTrace) and finish it up as soon as we have to (because there is no local filtering support yet)agent:
tracing.global.stackTraceLength(this is new)tracing.global.stackTrace(this is new)-> no local support yet (this needs to go into the post task for stack trace filtering)
1. Refactor & Unify Instrumentation Logic
1.1 Introduce a Common Error / Stack Handling Helper
Unify
setErrorlogicCreate a shared helper used by all instrumentations for attaching error details and stack traces.
Ensure
getErrorDetailsalways returns a stringGuarantees consistent type in
span.data.<tech>.error.Implement V8 string → stack trace conversion
Handle cases where the stack arrives as a plain string.
Add a test validating correct conversion behaviour.
Add dedicated tests
At least one test to ensure conversion logic is correct.
1.2 Update All Instrumentations to Use Shared Logic
All categories will be updated to call the new unified helper:
This ensures:
1.3 Add Category-Level Tests
Tests to validate:
2. Add Configurable Stack Trace Mode
Introduce a configuration setting:
INSTANA_STACK_TRACE = none | error | all
configuration via agent and custom file
2.1 Implement Stack Trace Mode Behaviour
2.2 Add or Update Tests
Add full coverage for the three modes:
Task List Summary
Refactoring Tasks
setErroracross all instrumentationsgetErrorDetails- refactor: updated sdk to use setErrorDetails fn #2222Stack Trace Configuration Tasks
INSTANA_STACK_TRACEenv variable – only the global configuration for now; create card for the technology-specific implementation laternone | error | all)Optional
After Implementation
points to note:
Stack trace length:
max length: 500
by default: 10
Other issues to resolve after this PR/in between directly to main