Support runtime environment changes via scope (sync to native Scope.setEnvironment)

Aperta
#6,991 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
android, ios, javascript, react-native, typescript

Direzione di ricerca

This work is parked until @sentry/core gains a scope-level setEnvironment API. First check the linked sentry-javascript proposal and implementation status; if the API exists, trace the scope-sync path on Android and iOS for both architectures, including the bridge spec and its older-binary fallback. Done means runtime environment changes reach native events, logs, and profiles on both platforms.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

React-Native
Context

sentry-java 8.63.0 added Scope.setEnvironment/getEnvironment (sentry-java#5772, proposal sentry-java#5769). It is applied to events, the DSC, logs, metrics and profiles. sentry-cocoa already has -[SentryScope setEnvironment:], and sentry-native has sentry_set_environment.

Problem

In RN, environment can only be set at init (options.environment). That value goes to native once, in RNSentryStart and on iOS. If an app changes environment at runtime, native-captured events (native crashes, ANRs, app-exit/NDK events, native logs and profiles) keep the init-time value.

Blocker

JS @sentry/core's Scope has no environment API, so there's nothing on the JS side to sync over the bridge.

Proposal
  1. Upstream: ask sentry-javascript for a scope-level setEnvironment (or find out whether they plan one).
  2. Once that exists: sync it to native through the scope-sync path on both platforms (Android Scope.setEnvironment, iOS SentryScope setEnvironment:), on both architectures. This adds a bridge spec method, so it needs a fallback for older native binaries.

Until then, this is parked.

Lingua principale
TypeScript
Stelle
1.8k
Fork
371
Merge medio
22h 3m
PR unite (30g)
106

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-react-native

Tutte le issue di getsentry/sentry-react-native

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.