Add `@sentry/conventions` dependency and use its constants for registered keys

Đang mở
#7,050 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
53/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react-native, typescript

Hướng nghiên cứu

Start with packages/core/package.json and the internal entry points src/js/tracing/ops.ts and src/js/tracing/semanticAttributes.ts, then inspect the listed files containing the keys. Check the installed @sentry/conventions version to confirm its exported constant names, and read packages/core/AGENTS.md for the dependency approval rule. Done when registered keys use the conventions constants, the documentation rules are updated, and the listed build, dependency, API report, and TypeScript compatibility checks pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Improvement React-Native

The SDK hardcodes attribute keys and span ops as strings. For keys that Sentry Conventions already registers, use the constants from @sentry/conventions instead. Nothing changes on the wire.

Dependency

  • Add @sentry/conventions to dependencies in packages/core/package.json.
  • Use the same range as @sentry/core (^0.16.0 today). On 0.x a caret only allows patch updates, so a different range ships a second copy.
  • @sentry/core already loads @sentry/conventions/attributes at runtime, so the module is already in app bundles. /op adds about 11 KB unminified.
  • Import only through the subpaths @sentry/conventions/attributes and @sentry/conventions/op. The package ships root-level attributes.js and op.js files, so this also works with older Metro versions that ignore exports.
  • From now on, bump it together with each @sentry/* JS bump.

Keys to swap

Today Constant
ops navigation, ui.action, http.client NAVIGATION, UI_ACTION, HTTP_CLIENT
ops app.update.check, app.update.download APP_UPDATE_CHECK, APP_UPDATE_DOWNLOAD
app.vitals.start.type, app.vitals.start.screen APP_VITALS_START_TYPE, APP_VITALS_START_SCREEN
sentry.origin, sentry.release, sentry.replay_id SENTRY_*
log attributes device.brand, device.family, device.model, os.name, os.version DEVICE_*, OS_*
thread.id, thread.name, http.query THREAD_*, HTTP_QUERY

Docs

Add a rule to packages/core/AGENTS.md and the code-guidelines skill: attribute keys and ops come from @sentry/conventions, and a new key needs a Sentry Conventions PR merged first.

Acceptance criteria

  • Existing tests pass unchanged.
  • yarn build passes from a clean state.
  • yarn circularDepCheck passes.
  • yarn api-report:check shows no change.
  • The TS 3.8 compat job stays green.
Agent notes
  • Keep src/js/tracing/ops.ts and src/js/tracing/semanticAttributes.ts as the internal entry points, re-exporting from conventions, so imports elsewhere don't change. Neither file is in the public API report.
  • Where the keys are:
    • Ops: tracing/ops.ts, tracing/onSpanEndUtils.ts, integrations/expoupdateslistener.ts.
    • Log attributes: integrations/logEnricherIntegration.ts.
    • Thread keys: tracing/span.ts, profiling/uiProfilingIntegration.ts.
    • http.query: integrations/devicecontext.ts.
  • In 0.33 the op exports are named without a suffix (NAVIGATION, HTTP_CLIENT). The 0.16 package uses *_SPAN_OP names, so check which version is installed after the range bump.
  • Adding a dependency needs maintainer approval (AGENTS.md: Ask first).
Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
371
Merge trung bình
22 giờ 3 phút
Pull request đã merge (30 ngày)
106

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/sentry-react-native

Tất cả issue của getsentry/sentry-react-native

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.