Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bitsandfoxes opened this issue Jan 7, 2025 · 2 comments
Open

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

bitsandfoxes opened this issue Jan 7, 2025 · 2 comments
Assignees

Comments

@bitsandfoxes
Copy link
Contributor

bitsandfoxes commented Jan 7, 2025

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
@bruno-garcia
Copy link
Member

Span.Data should end up on on context.trace.data too:

public IReadOnlyDictionary<string, object?> Extra => _data;

So we might want to add an Obsolete on SetExtra if that was used to jsut make transaction and span "look alike"

@bruno-garcia
Copy link
Member

Another thought, since we have:

public Trace Trace => _innerDictionary.GetOrCreate<Trace>(Trace.Type);

We could have Span.Data map to that property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants