Skip to content

feat(otlp-exporter): add error stack trace to base converter#515

Merged
arjun-rajappa merged 1 commit into
otlp-exporterfrom
span-converter-error-stack
Jul 8, 2026
Merged

feat(otlp-exporter): add error stack trace to base converter#515
arjun-rajappa merged 1 commit into
otlp-exporterfrom
span-converter-error-stack

Conversation

@arjun-rajappa

Copy link
Copy Markdown
Contributor

Changes

base_converter.rb

  • SpanDataWithEvents – wraps SpanData to carry OTel Event objects via Forwardable
  • build_error_events – emits "exception" (with stacktrace) or "error" event when span.ec > 0
  • convert_stack_trace – maps Instana {c, n, m} stack frames to OTel newline-separated string
  • build_status – replaces convert_status; accepts explicit error_count/error_msg args
  • extract_error_message – reads span[:data][type][:error], truncates to 1024 chars
  • span_name – fixed for SDK spans to read span[:data][:sdk][:name]

base_converter_test.rb – adds coverage for all new methods above

- Introduce SpanDataWithEvents wrapper to carry OTel span events without
  breaking the existing SpanData keyword_init constructor
- Add build_error_events: emits exception event (with stacktrace) or
  error event when span.ec > 0
- Add convert_stack_trace: maps Instana stack frames (c/n/m) to OTel
  exception.stacktrace newline-separated string
- Refactor convert_status → build_status(error_count, error_msg) to
  decouple status from implicit span state
- Implement extract_error_message: searches span[:data][type][:error],
  truncates to 1024 chars per OTel recommendation
- Fix span_name for custom (SDK) spans: read span[:data][:sdk][:name]
  instead of span[:n]
- Extend base_converter_test with coverage for all new paths

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>

@pvital pvital left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me.

@arjun-rajappa arjun-rajappa merged commit 4031c6b into otlp-exporter Jul 8, 2026
221 of 228 checks passed
@arjun-rajappa arjun-rajappa deleted the span-converter-error-stack branch July 8, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants