Skip to content

ref(types): Add known attribute keys to SpanAttributes type#10295

Merged
Lms24 merged 1 commit intodevelopfrom
lms/ref-core-add-known-attribute-keys
Jan 25, 2024
Merged

ref(types): Add known attribute keys to SpanAttributes type#10295
Lms24 merged 1 commit intodevelopfrom
lms/ref-core-add-known-attribute-keys

Conversation

@Lms24
Copy link
Copy Markdown
Member

@Lms24 Lms24 commented Jan 23, 2024

(extracted from #10274 to discuss in isolation)

I propose we add known attribute keys to the SpanAttributes type because this way we can

  1. enforce a concrete type for some known keys
  2. give users (and us) auto suggestions when setting attributes

WDYT, is this an improvement to the pure Record type?

@Lms24 Lms24 requested review from AbhiPrasad and mydea January 23, 2024 13:11
Comment on lines +27 to +30
'sentry.origin': string;
'sentry.op': string;
'sentry.source': string;
'sentry.sample_rate': number;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I guess the downside is that we can't use the semantic attribute constants defined in @sentry/core (as const instead of the hard-coded names).

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.

I guess this is better than nothing, still! It's just some type sugar on top, so 🤷 still feels like an improvement!

@Lms24 Lms24 changed the title ref(types): Add known attribute keys to SpanAttributes ref(types): Add known attribute keys to SpanAttributes type Jan 23, 2024
@Lms24 Lms24 force-pushed the lms/ref-core-add-known-attribute-keys branch from facdb7e to d1d7823 Compare January 25, 2024 15:14
@Lms24 Lms24 enabled auto-merge (squash) January 25, 2024 15:15
@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 77.85 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 69.04 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 72.93 KB (0%)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 62.68 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 33.07 KB (+0.01% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.25 KB (0%)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.26 KB (+0.01% 🔺)
@sentry/browser - Webpack (gzipped) 22.5 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 75.58 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 67.13 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 32.97 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 24.43 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 211.38 KB (-0.02% 🔽)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 99.4 KB (-0.04% 🔽)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 73.08 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 36.07 KB (+0.02% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 69.45 KB (+0.01% 🔺)
@sentry/react - Webpack (gzipped) 22.55 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 86.11 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 50.41 KB (+0.01% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.21 KB (0%)

@Lms24 Lms24 merged commit cbccf51 into develop Jan 25, 2024
@Lms24 Lms24 deleted the lms/ref-core-add-known-attribute-keys branch January 25, 2024 15:56
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