← Back to Pull requests

feat(demo): show the app's own telemetry in HackerNewsDemo #1340

Open
unknown opened this pull request with 388 lines diff across 4 files
View on GitHub
unknown unknown commented on Dec 02, 2026 03:45 UTC
Author

Show the demo app's own telemetry

Author: @williazz · Status: ready for review · 2026-12-03

Background

!Today the demo's telemetry is visible only in a collector; this PR copies it into an in-app Telemetry tab and floating bar, leaving export unchanged.

1. Session, user and vitals processors stamp each span and log record (Telemetry.swift#L120-L145).
2. Batch processors hand them to OTLP/HTTP exporters, which post to localhost:4318 by default.

Problem statement

On a simulator, a Revyl device or a reviewer's phone, nothing listens at that endpoint, so a demo of the SDK shows no telemetry. A reviewer must run a collector and backend to see which records an instrumentation emits or how they nest.

A solution must:

1. Show every span, log and event the SDK hands its exporters, live, in the app.
2. Stay responsive through a 1,000-record load test.
3. Change no SDK or instrumentation code and leave export as it is.

Out of scope

Delivery: the tab shows what reached the exporters, not the collector; a collector remains that check. Metrics: spans and logs only.

Proposal

TimelineSpanProcessor and TimelineLogRecordProcessor (NEW, TelemetryTimeline.swift#L455-L500) copy each record into TelemetryTimeline (NEW), which keeps the newest 500 and running totals since the last clear, and publishes to the main thread at most every 200 ms (L194-L198). The new Telemetry tab offers:

  • Raw: spans under their parents, logs under their span; runs of one kind collapse into a burst row.

  • Aggregated: count, rate, errors and p50/p95 per kind, nested by parent kind.

  • Detail: attributes, span events, a trace waterfall and OTLP/JSON.

  • Pause, Clear, pull to refresh, and a floating bar with the latest record on every screen.
  • The Revyl walkthrough at f4b01bd4 exercises each, including a 1,000-record load test while paused. Only Examples/ changes.

    Alternate solutions

    Do nothing

    Every demo and review still needs a collector.

    An exporter instead of processors

    An exporter sees spans only after they end and batch, so in-flight spans and start order would be lost.

    Glossary

    Burst: one row for consecutive top-level records of one kind, each within a second of the last. OTLP: the OpenTelemetry Protocol. Processor: an SDK hook that sees each span at start and end, or each log at emit, before export.

    written by billy's 🤖

    Diff: 388 lines (+291 / -97) across 4 files Reviewer: aranhave Review duration: 4538m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.43) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 388 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.357
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1340"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.1% (MEDIUM) · Higher = larger blast radius
    43.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.6% · Safe to merge
    24.6%