Skip to content

Sentry: metrics layer — emitters, attribute gates, debug-gated RPC tracing #76

@gmaclennan

Description

@gmaclennan

Part of #74. Depends on #75. The core of Phase 11: day-to-day performance signal moves to Sentry metrics; per-RPC tracing becomes debug-only.

Spec: docs/sentry-integration-plan.md §11.2 (metric inventory + volume budget), §11.3 (traces), §11.6 (code changes by file), §11.8 (attribute rules + filter hook).

Deliverables

  • backend/lib/metrics.js + src/sentry-metrics.ts: thin wrappers around Sentry.metrics.* that add the shared attributes (platform, device_class, os_major) and units to every metric, and do nothing when Sentry is off (§11.6)
  • Record the §11.2.a inventory: RPC durations + error counts (client and server), boot/shutdown phase timings and outcomes, sync session metrics, a 60-second sampler for backend memory + event-loop delay, state transitions, storage size/free buckets, IPC error counts, telemetry-forwarding failures, and low-memory warnings from the OS
  • Split the RPC hooks on both sides: always record the metric; only create a Sentry span when debug is on. Record the metric while the span is active so the metric links to the trace (§11.3)
  • tracesSampleRate now driven by debug (1.0 when on, 0 when off); console-log capture on the backend also moves behind debug
  • A beforeSendMetric filter on all four SDKs (React Native, Node, Android, iOS): remove the user.* fields Sentry attaches by default, and drop any metric carrying a forbidden attribute (§11.8)

Tests

  • backend/lib/metrics.test.mjs: metric names/attributes/units, shared-attribute injection, no-op when Sentry off, filter behaviour
  • backend/lib/sentry.test.mjs + src/__tests__/sentry.test.js: debug off ⇒ metric recorded but no span; debug on ⇒ both
  • Manual smoke per §11.10: metrics explorer shows the data, grouping by device_class works, a metric sample links through to its trace, no user.* fields arrive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions