observability library
Module — observability v0. Structured action log + natural-language renderer.
Classes
- ActionLog
- Bounded ring of LogEntrys. Oldest entries drop off when the capacity is reached. Thread of execution is single per session, so no locking.
- AppAlert
-
One thing an app reported: name is the event's
alertfield, group the AlertKind a watch selects it by. - AppLogBuffer
- Bounded ring of app-side log events. Subscribes to the VM service's Stderr + Logging streams on subscribe and cancels them on unsubscribe. Survives glint session re-attach: the buffer itself outlives any one subscription.
- AppLogEntry
- AppLogScan
- What AppLogBuffer.scan found: the entries to show and the counts behind them.
- AuditEntry
- AuditLog
-
Tamper-evident telemetry log at
<dataDir>/telemetry-audit.log: one<ts>|<prev_hash>|<payload_b64>|<this_hash>line per payload, each hash covering the line before it, likegit log. - AuditVerifyResult
- BreakpointHit
- One matched line: what matched, whether the app was paused for it, and the screen at that moment.
- CallMark
- Where a call's counters stood at one moment; the difference between two marks is what happened in between.
- CallProgress
- What one tool call is doing right now: feeds the heartbeat, names the stuck phase on a timeout, and owns the subprocesses to kill when the call is abandoned. Found from any code on the call via current.
- FailureEntry
- FlutterErrorEntry
- One distinct error the app reported, with how often and where.
- FlutterErrorFeed
-
The distinct errors an app reports, read without any app code: Flutter's structured error events when
flutter runenabled them, else the error dumps in the app's console output. - GlintConfig
-
Runtime-tunable defaults. Tools that have a baked-in constant
(poll cadences, ceilings, ring capacities) consult this instead,
so the agent can adjust them via the
configMCP tool without restarting glint. - HttpFailureMonitor
- Reads one app's dart:io HTTP profile on a timer and raises an AppAlert for each request that failed (4xx, 5xx or a transport error); runs only while something holds it.
- LogBreakpoint
- A regex armed on the app's log lines.
- LogBreakpoints
- Log breakpoints for one app: matches each new log line, pauses the app on a hit, and queues hits for the agent.
- LogEntry
-
Closed set of log entry kinds. Sealed so the
logstool can branch exhaustively when rendering. - LogRenderer
-
Natural-language view of an ActionLog's entries. Renders each
event on one line:
[t+Δ] tool(args) → summary. Δ is relative to the first entry in the slice. - OverflowInfo
-
How far a render object overflowed, read from the framework's
A RenderFlex overflowed by 42 pixels on the bottom.message. - Session
- One named slice of activity — opens at a point in the ActionLog's sequence, closes at a later point. Sessions don't own their entries; they hold a sequence range that ActionLog.query can slice on.
- SessionManager
- Tracks one active session at a time plus the history of closed ones. Opening a new session auto-closes the previous one.
- SessionNote
- StateObserver
- SuccessEntry
- ToolEvent
- UsageEventStore
-
Append-only JSONL store at
<dataDir>/usage-events.jsonl; ids stay monotonic across processes, and a full file is gzipped intousage-archive/(newest 20 MB kept) instead of being cut. Writes are best-effort and never throw. - UsageRecorder
- Bounded ring of ToolEvents with FNM-style correlation IDs, backed by UsageEventStore when a data dir is configured. One process-wide instance; tool handlers call record post-call.
- UsageReporter
-
glint's usage rollups: the shared
UsageShipperover the recorder's events; sends nothing unlessGLINT_TELEMETRY=on. - UsageShipResult
-
The outcome of
UsageShipper.ship.
Enums
- AlertKind
-
The kinds of alert a watch can ask for;
disconnected(opt-in) covers thedisconnectedandreconnectedevents around aterminated. - AppLogStream
-
Where a log entry came from.
stderrcaptures direct stderr writes,stdoutcaptures FlutterError dumps + print() (Flutter routes FlutterError through debugPrint → stdout, not stderr),loggingcapturesdeveloper.logcalls. - FlutterErrorChannel
-
Where an occurrence was read from: Flutter's
Flutter.Errorevents, glint's in-app error hooks or the app's console output. - SceneState
- Coarse top-level state per §8.6: derived cheaply from the already- read scene. No extra polling — just inspects what's there.
- ToolOutcome
-
ok/error/empty. Same vocabulary as flutter_network_mcp.
Constants
- glintSwitches → const TelemetrySwitches
-
glint's telemetry switches:
GLINT_TELEMETRY,GLINT_NO_TELEMETRY,GLINT_NO_USAGE. - kCharsPerToken → const double
- Rough characters per token, the usual heuristic for JSON-ish text.
- kCollectorEndpoint → const String
- Collector endpoint baked into the binary so users can audit where payloads go.
- kErrorMessageMaxChars → const int
-
Max chars in the
errorMessagefield for crash payloads. - kGlintVersion → const String
-
The
versionglint's rollups carry, so the shared collector tells the products apart. - kStackHeadFrames → const int
- Max stack frames in crash payloads.
- kTelemetryTimeout → const Duration
- Budget for one POST, short enough that shutdown never waits on an unreachable collector.
- kTelemetryUserAgent → const String
- User-Agent for the HTTPS request. Lets the collector rate-limit by product if a future glint fork misuses the endpoint.
Functions
-
dartVersion(
) → String -
The Dart SDK version: the leading semver triple of
Platform.version. -
estimateTokens(
int bytes) → int -
Estimated agent-side tokens for a reply of
bytescharacters. -
installId(
String dataDir) → String -
A random id created once per install in
dataDir; unlike a hash of the path, it reveals nothing about the user or the machine. -
looseBool(
Object? value) → bool? - A bool from a bool or the strings "true" / "false"; null otherwise.
-
looseInt(
Object? value) → int? - An int from an int, a whole double (15000.0) or a numeric string ("15000"); null otherwise.
-
looseNum(
Object? value) → double? - A number from a num or a numeric string; null otherwise.
-
osDescriptor(
) → String -
"macos 14.6", with long version strings capped at 60 characters. -
postTelemetry(
String jsonStr) → Future< int> -
POSTs
jsonStrto the collector as glint; throws on connection failure, callers swallow. -
redactForSharing(
String input, {Iterable< String> appNames = const [], Iterable<String> deviceNames = const [], Iterable<String> hosts = const []}) → String -
redactPath, redactSecrets and the given app, device and host names together, for anything posted publicly; reports build one
IdentityRedactorand reuse it. -
redactPath(
String input, {String? home}) → String -
Strips filesystem identity (username, project name, directory layout) from text that leaves the machine;
<home>/…/lib/x.dartbecomes<project>/lib/x.dart,package:URIs are untouched, and it is idempotent. -
redactSecrets(
String input) → String -
Masks bearer tokens, JWTs, long hex keys and
password=-style values in free text. -
redactStackHead(
StackTrace stack, {int maxFrames = 8}) → List< String> -
Redacts every line of a Dart stack trace, keeping the first
maxFramesframes. -
resolveDataDir(
) → String - Glint's per-install data dir. Holds the audit log + ship watermark.
- True only when the user opted in to sharing usage stats.
-
Why usage stats are not shared, or null when the user opted in with
GLINT_TELEMETRY=onand nothing overrides it. -
summarizeUsage(
List< Map< rows, {int topTransitions = 15}) → Map<String, Object?> >String, Object?> -
Aggregates tool-call rows, ordered by
correlation_idthenid, into per-tool stats, the outcome-tagged tool-to-next-tool transitions, and self-correction rates; tokens come fromestimated_tokensor elseresult_bytes. -
telemetryDisabled(
[Map< String, String> ? env]) → bool -
True when
GLINT_NO_TELEMETRYturns off local usage recording and sharing alike. -
truthyEnv(
String? v) → bool -
Treats
true,1,yesandon(any case, trimmed) as true. -
usageDisabled(
[Map< String, String> ? env]) → bool -
True when local usage recording is off (
GLINT_NO_TELEMETRYorGLINT_NO_USAGE).
Exceptions / Errors
- CallAbandoned
- The call is being abandoned (its ceiling passed), so new subprocesses must not start.
- CallTimeboxExceeded
- Thrown by CallProgress.timeboxed when its body outlived its limit; says where the body had got to.