Skip to content

fix(telemetry): keep span status and events in SqliteSpanExporter - #7486

Open
mittalpk wants to merge 1 commit into
google:mainfrom
mittalpk:fix/sqlite-span-exporter-status-events
Open

mittalpk wants to merge 1 commit into
google:mainfrom
mittalpk:fix/sqlite-span-exporter-status-events

Conversation

@mittalpk

@mittalpk mittalpk commented Oct 9, 2026

Copy link
Copy Markdown

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

SqliteSpanExporter stored neither a span's status nor its events, so a span that ended with an exception read back as UNSET with no events. This stores the status code, status description and events, restores them in _row_to_readable_span, and adds the three columns to a database created by an earlier version when it is opened.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

pytest tests/unittests/telemetry: 880 passed, 7 xfailed. Four new tests in test_sqlite_span_exporter.py; the two covering status and events fail without the change.

Manual End-to-End (E2E) Tests:

Ran the reproduction script from #7484.

Before:

columns: [..., 'invocation_id', 'attributes_json']
status read back: UNSET
events read back: []

After:

columns: [..., 'invocation_id', 'attributes_json', 'status_code', 'status_description', 'events_json']
status read back: ERROR
events read back: [<opentelemetry.sdk.trace.Event object at 0x...>]

A database file written by the previous version is upgraded on open; that case has its own test.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

The exporter is not imported elsewhere in this repository, so the end-to-end check above uses it directly through a TracerProvider, as the issue does.

The exporter stored neither, so a span that ended with an exception read
back as UNSET with no events. Store status code, status description and
events, restore them on read, and add the columns to existing databases.
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.

SqliteSpanExporter drops a span's status and events, so an exception that ended a run is lost (2.11.0)

2 participants