Skip to content

Emit transaction.data inside contexts.trace.data #3873

@bitsandfoxes

Description

@bitsandfoxes

Relates to getsentry/team-sdks#95
See getsentry/team-sdks#95 (comment) for more details.

Current Behavior

  • We currently map extra to data in our SDK
  • When serializing SentryTransaction, the extra data gets written to extra. The ITransactionTracer inherits from IHasExtra so this makes sense.
    writer.WriteDictionaryIfNotEmpty("extra", _extra, logger);

Problem

The current inheritance structure prevents us from correctly mapping:

  • Transaction data to contexts.trace.data
  • Span data to span.data

Proposed Solution

Instead of modifying the inheritance structure for transactions and spans (which would be hacky), we should:

  1. Add SetData methods to both TransactionTracer and SpanTracer
  2. Keep existing SetExtra functionality
    • This allows users to quickly add contexts without creating a full context
    • Note: We do not support arbitrary key-value pairs on the context

Technical Details

  • Transaction data should map to: contexts.trace.data
  • Span data should map to: span.data

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions