B Conformance
An implementation conforms to a version of the profile when it passes every vector for that version that applies to it. A vector is a scripted situation and the exact result the implementation must produce. The Apsio SDKs and the Apsio ingestor run the same vectors in CI; any other OpenTelemetry SDK or backend can run them too.
Vectors live in vectors/v0.1/<area>/<name>.json and validate against
schemas/v0.1/vector.schema.json.
They are published with each version as
vectors-0.1.tar.gz, with the schemas. Vectors, schemas and
runners are Apache-2.0.
B.1 Kinds
Section titled “B.1 Kinds”| Kind | Who runs it | Input | Expected |
|---|---|---|---|
function |
SDKs and backends | Values for a pure function of the profile (the sampling decision, clock correction) | The function’s output |
ingest |
Backends | HTTP requests, each with the time it is received | Each response’s status, the normalized records stored and, when relevant, the session states |
sdk |
SDKs | Steps: launches, API calls, clock changes, network conditions | The requests the SDK sends |
Every vector also has given, when and then: the same situation in plain sentences,
for people.
An ingest vector MAY have backend: what the backend knows about the vector’s app key
before the requests. sessionless_refused (not_included or quota_reached) says the
account does not accept records without session.id, or no longer does for the period
(1.5). A backend that has no such state skips those vectors.
B.2 Functions
Section titled “B.2 Functions”| Function | Input | Output |
|---|---|---|
sampling. |
session_id, rate |
true or false (9.1) |
instrumentation. |
session_id, families (optional, the policy’s instrumentation.families in force when the session starts) and optionally changed_to, families fetched later in the same session |
Per family, in the order of 15.1, released or held (15.3) |
instrumentation. |
trigger (a time), window_minutes and records (each a time) |
released, the 0-based indexes of the records the trigger releases (15.4) |
instrumentation. |
id (a request id) and subject (an app.installation.id or a user.hash) |
The request’s match (15.5) |
instrumentation. |
rule (as in instrumentation.rules) and record: kind (log or span), event_name (a log record’s), name (a span’s), network (true for a network span), body, severity (a number), duration_ms, attributes and resource (objects) |
true when the rule matches the record, false otherwise (15.8) |
policy. |
id (a layer’s id) and installation_id |
The layer’s bucket for the install, 0 to 9999 (12.4) |
policy. |
policy (a policy document) and device: app_version, os_name, os_version, device_model, installation_id and user_hash, each optional, and now (Unix seconds) |
applied and holdback, the ids of the layers the device applies and of those it is held back from, in list order, and families, the instrumentation.families it ends with (12.4) |
session. |
views (the app.screen.name of each view, in order), requests (each method, host or null, template, status_code or null, duration_ms), screen_loads (each screen, duration_ms) and app_starts (each type, duration_ms) |
screen_path, and requests, screen_loads and app_starts as the objects of their JSON arrays, before the size limit (3.5) |
connectivity. |
changes, in order, each a time (milliseconds from the session’s start) and a type (network.connection.type), and session_end |
offline_ms, and connection_types in the order first seen, after a change undone within 2 seconds is dropped with the change that undid it (7.10) |
device_ |
changes, in order, each a time (milliseconds from the session’s start), a type (thermal_state, low_power, memory_warning or connectivity) and, for connectivity, a value (network.connection.type), and limit |
written, the records written per type (only the types written), and dropped, those over the limit, summed, after a connectivity change undone within 2 seconds is dropped with the change that undid it and a repeat of the same connection type is not a change (7.8) |
log_ |
platform (apple, android or javascript) and level, the platform’s name for it |
severity_number and severity_text, or null when the level is not bridged (13.7) |
log_ |
entries, in order, each a time (milliseconds), a severity number and the body’s bytes, and options: min_level, rate (a second), burst, session_limit, max_body_bytes (4096 when left out) and optionally session_start (milliseconds; the session has no earlier one) |
written and truncated, the indexes written and those whose body is cut, and dropped, those over a limit, after the entries under min_level are left out, the bucket counted on the entries’ own times (13.7) |
log_ |
args, a console call’s arguments, each typed (string, number, boolean, null, undefined, bigint, symbol, function, error or object), and limit (4096 when left out) |
body, what the JS bridge writes (13.7) |
ui. |
taps, in order, each a time and x, y in points (iOS) or dp (Android) |
bursts, each the time of its first tap and its count (8.7) |
error. |
type, frames (in stack order, each in_app and either function or image and offset, an integer) and optionally fingerprint |
The device fingerprint (15.7) |
clock. |
original, sent_at (or null), received_at |
The corrected time (5.2) |
crash. |
images (each a name, the bytes of its JSON entry as the SDK encodes it, and frame, the index of the first stack frame in it, or null) and limit |
kept, the names in the order sent, and truncated (1.6) |
crash. |
platform (apple or android), path (the image’s resolved path) and, on Apple platforms, bundle (the crashed process’s main bundle path, an extension’s own), on Android package (the package name) |
true or false (6.5) |
hang. |
active_at_install (true when the app is already active as the detector installs), first_active (the first activation, or null while the process has not become active) and hang_start, both milliseconds from process start |
launch, or null when the hang has no phase (6.3) |
metrickit. |
One iOS 27 DiagnosticReport in a neutral shape: kind (the DiagnosticResult case: memoryException, hang, crash and so on, or any other), end (its timeRange end, Unix nanoseconds as a decimal string), pid (its environment.pid, or null), application_version and call_stack_tree (the result’s tree, as Apple encodes it) |
The records the SDK sends for it: for a memoryException, one app.abnormal_exit with event_name, time, the pid that joins it to its session, the attributes it maps from the report (the SDK adds the session’s, 6.4) and the call_stack_tree unchanged; [] for a kind the profile does not know |
metrickit. |
One iOS 27 MetricReport in a neutral shape: full_day (its full-day entry’s totals, the second row of 7.3’s table, each a metric, unit and value) and intervals (its few-hour entries, each a list of the same) |
The points the SDK sends: one delta sum per full-day total, with name, unit, kind and value; the few-hour entries are never mapped (7.3) |
live. |
allowed (live inspection on the device), consent, kill_switch, testers (the policy’s live.testers), install, user_hash (or null), now (Unix seconds), app_state (active, inactive or background) and saving (low_power, low_data, data_saver or null) |
state (open, paused or closed), with tester, the matched entry’s id, and proof, its proof, unless closed, and reason when paused (16.1) |
live. |
testers (the policy’s live.testers), tester and proof (the hello’s) and now (Unix seconds) |
Whether the backend counts the hello’s tester (true or false) (16.7) |
live. |
origin (the policy’s live.origin) |
https (used), loopback (plain HTTP to 127.0.0.1, [::1] or localhost, which an SDK may use for local testing only) or ignored (as if the policy had no live) (16.4) |
live. |
channel (open, paused or closed), paused_ms, stop (from next, or null), now_ms, until_ms (on the device’s clock, null before the first frames), session_bytes and day_bytes (compressed frames and results sent) |
Why the live session ends (closed, stop, paused, until, session_bytes or day_bytes, the first that applies), or null (16.3) |
screen. |
shows (each a session, the screen name and the screen’s instance) |
The views sent, in order: each screen and its previous (absent for a session’s first) (8.6) |
privacy. |
keys (the start option redact), attributes (the app’s) and optionally sdk (those the SDK writes itself) |
attributes and sdk as stored: the matching app attributes and a listed exception.message set to [REDACTED] (11.1) |
replay. |
text |
The masked text (10.3) |
replay. |
nodes (a frame’s nodes) and delta (its update, remove and add) |
The nodes after the delta, by ascending id (10.1) |
replay. |
options, policy (optional), unresolved (optional) and tree |
Per node id, in tree order: content (shown, masked or hidden) and touches (true or false) (10.4) |
replay. |
segments, the number of segments a session closes; policy (optional), the policy in force when the session starts, read for replay.max_minutes_per_session; optionally changed_to, a policy fetched later in the same session |
head, tail and kept, the 1-based numbers of the segments sent, in order (10.6) |
An SDK runs instrumentation.decisions through its own session and policy code, not a copy
of the formula: it starts a session under families, applies changed_to as a newly fetched
policy when the case has one, then asks the session for each family’s decision. A mode or
rate read from the current policy instead of the one stored at session start fails the case
with changed_to.
An SDK runs replay.kept_segments through its own recorder and session code: it starts a
session under policy, applies changed_to as a newly fetched policy when the case has one,
closes segments segments, ends the session, and reports the segments it sent.
A replay.mask tree is neutral: each SDK maps its views onto it. A node has an id, a
kind (container, text, input, image, webview, map, video or keyboard;
container when absent), classes (the class names it belongs to), setting (mask,
unmask, hide or null, the instance API), identifier (the accessibility identifier
or tag), secure and children. options has text (all or inputs), touches
(show or hide) and mask_classes, unmask_classes, hide_classes; policy has the
policy’s text, mask_classes and hide_classes; unresolved (optional) lists the class
names that do not resolve in the app, which start strict mode when a hide or mask list
names one (10.4).
Times are decimal strings of Unix nanoseconds.
A function vector MAY list pending cases: device recordings it does not hold yet, each with what to record and the item that tracks it. A case names the recording in the profile’s own words. A runner runs the vector’s cases and reports its pending ones by name; they are not failures.
B.3 The normalized record
Section titled “B.3 The normalized record”A backend stores data its own way. To compare backends, an ingest runner converts each
stored record to this neutral form:
| Field | Value |
|---|---|
signal |
log, span or metric |
app_ |
The app key the record arrived with |
batch_ |
The Apsio-Batch-Id of the request, or "" |
session_ |
Per 2.4, or "" |
event_ |
Logs: the event name, or "" |
name |
Spans and metrics: the span or metric name |
scope |
The record’s InstrumentationScope name, or "": for a log, its logger (13.6) |
severity_ |
Logs |
body |
Logs: the body as a JSON value |
time |
{ "original", "observed", "corrected" }: logs use timeUnixNano; spans and metric points use their end time |
start_ |
Spans and metric points: { "original", "corrected" } |
kind |
Spans: the OTLP SpanKind name without its prefix (INTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER), or "" when it is SPAN_KIND_UNSPECIFIED or a value this version does not name |
status |
Spans: { "code", "message" }. code is OK or ERROR, and UNSET when the span has no status, has STATUS_CODE_UNSET or a code this version does not name; message is the status description when code is ERROR, and "" otherwise |
resource |
The Resource attributes as an object, with the overrides of 2.5 applied |
attributes |
The record attributes as sent, as an object |
sample_ |
Per 9.3 |
metric |
Metric points: type (histogram, sum, gauge), temporality (delta, cumulative), and the point’s count, sum, min, max, bucket_counts, explicit_bounds or value, each only when present |
Attribute values convert from OTLP AnyValue to JSON: strings, booleans and doubles as
themselves, integers as numbers, arrays as arrays, key-value lists as objects, and bytes
as base64 strings. Times are decimal strings.
An ingest vector can also expect session states: per session, the outcome the
backend holds after all requests (3.4).
B.4 Matching
Section titled “B.4 Matching”A runner compares the actual result with the expected one by these rules:
- Objects match as a subset. Every key in the expected object must be in the actual one with a matching value; other actual keys are ignored.
- Arrays match exactly, element by element, with the same length.
- Expected records in an
ingestvector match as a set. The stored records must be exactly as many as the expected ones, and each expected record must match a different stored record, in any order. - Expected records in an
sdkrequest match as “contains”. Each expected record must match a different record of the request; the request may carry others (session events, breadcrumbs). No record of the request may match an entry ofabsent_records. - Expected requests in an
sdkvector match in order, as a subsequence of the requests the SDK sent: each expected request matches the next sent request that matches it. Requests to/v1/policyare ignored unless the vector expects one. - A request also has, for matching, its
origin(the scheme, host and port it went to), itsquery(an object of its query parameters), itst(when it was sent: seconds on the harness clock since the vector’s first step) and, on the live channel, itsbody(the JSON body, decompressed), each matched as the rules above say. A header the request does not carry matches{ "$absent": true }. never_requestedis checked against every request. No request the SDK sent, whatever its path and order, may match an entry; an entry is a request pattern with any ofpath,origin,query,headers,bodyandt, and uses the captures of the expected requests.sentandnever_sentare checked against every request. Each entry ofsentmust match a different record of some request the SDK sent, whatever its path and order; no record of any request may match an entry ofnever_sent.- Captures are made in the order the expect writes them:
requests, thensent. An entry ofsentcan use a capture an expected request made, and makes its own for the entries after it.never_sentandnever_requestedcan use any capture made byrequestsorsent: a{ "$not": "name" }there needs the valuenamewas bound to, so a capture thatsentmakes is threaded through, never left unbound. A reference ($ref,$notor$gt) to a name no capture made is an error in the vector: the runner fails it, and never counts the entry as a match or as a non-match. - Only delivered requests count. Expected requests,
sentandnever_sentconsider the requests the network delivered: an attempt refused while thenetworkstep has the device offline sent nothing. A request that timed out counts, since the backend may have received it. - Captures are tried in the order the expected values are written. When a set or “contains” match can pair records in more than one way, the runner tries the pairings until one satisfies every capture and reference.
- Special values in the expected side:
| Value | Matches |
|---|---|
{ "$absent": true } |
The key is missing |
{ "$type": "string" } |
Any value of that JSON type (string, number, boolean, object, array) |
{ "$capture": "name" } |
Any value, remembered as name |
{ "$ref": "name" } |
The value remembered as name |
{ "$not": "name" } |
Any value other than the one remembered as name |
{ "$gt": "name" } |
A time (decimal string) later than the one remembered as name |
{ "$min": n, "$max": m } |
A number from n to m, both included; either bound may be left out |
B.5 SDK steps
Section titled “B.5 SDK steps”An sdk vector drives the SDK through a test harness that controls the clock, storage,
process lifecycle and network. 0.1.0 defines these steps, and a later version may add more
without changing them; each SDK maps them to its platform in its own test driver.
| Step | Does |
|---|---|
{ "do": "install" } |
A fresh install: storage is empty |
{ "do": "launch" } |
A cold start of the process; the SDK is started with the vector’s start options and fetches the policy before the step ends |
{ "do": "terminate", "how": "normal" | "crash" | "kill" | "user_ |
Ends the process: a normal exit, a crash in the app’s code, a kill without warning, the user quitting the app, or a kill for memory after the platform’s low-memory signal (6.4) |
{ "do": "terminate", "how": "recorded", "exit": "<reason>", "foreground": true | false } |
Ends the process and leaves the platform’s own record of an exit of that kind, in the foreground or not, for the next launch to read (exit is an apsio.exit.reason other than unknown, os_update and normal) |
{ "do": "update", "what": "app" | "os" } |
Ends the process if it runs, as the platform does for an update, then replaces the app with a new build, or updates the operating system and restarts the device |
{ "do": "background" } / { "do": "foreground" } |
Moves the app between states |
{ "do": "advance", "seconds": n } |
Moves the device clock forward |
{ "do": "network", "mode": "online" | "offline" | "timeout" | "status", "status": n } |
How the next requests are answered: 200, no connection, a timeout, or a given status |
{ "do": "call", "api": "<name>", "args": { … } } |
A call of the public API (13), or of recordHybridCrash for a cross-platform layer (14.1); args.attributes, when present, is an object of attribute values: strings, numbers, booleans and arrays of strings |
{ "do": "flush" } |
Asks the SDK to send what is queued, and waits until it has tried |
{ "do": "live_ |
Queues one answer of the harness’s live server for that route (hello, next, frames or results), after those already queued; headers and body are optional (16.4) |
{ "do": "policy", "policy": { … } } |
Serves this policy document to the SDK’s fetches from now on; the SDK sees it at its next fetch: the next launch, or a foreground when 60 seconds or more have passed since the last fetch (12.1) |
On a platform with no termination callback (Android), the driver models
{ "do": "terminate", "how": "normal" } as a move to the background followed by the end
of the process, with the platform’s record of a normal exit for the next launch to read
(on Android, an ApplicationExitInfo with REASON_EXIT_SELF; REASON_USER_REQUESTED is a
user quit, 6.4).
The drivers model the other terminations with what each platform gives the next launch:
user_quit is, on iOS, a move to the background, the termination notice
(applicationWillTerminate) and the end of the process, and on Android an
ApplicationExitInfo with REASON_USER_REQUESTED; memory is the platform’s low-memory
signal followed, on iOS, by a kill without warning, and on Android by an
ApplicationExitInfo with REASON_LOW_MEMORY and the importance the app had (visible or
higher in the foreground, cached in the background). update changes the app’s build (its
app.build_id and version) or the operating system’s version and build, with a restart. For recorded, the driver
leaves what the platform would: on Android an ApplicationExitInfo with the matching
reason and importance, on iOS the MetricKit diagnostic or termination record. A driver
that cannot produce a kind on its platform (a watchdog on Android) skips the vector; a
vector that only one platform can run names the platform in its given.
The harness answers GET /v1/policy with the vector’s policy document, or with 404
when the vector has none (the SDK then uses the profile’s defaults), until a policy step
replaces it.
For live inspection (section 16) the harness also runs a live server at the
vector’s live.origin, a loopback origin: an SDK runs the live/sdk-* vectors only if its test
build accepts one (16.4 allows it in any build), and the call step takes setLiveInspection. The
server answers each request of a route with the next answer queued for that route, in order.
With none queued:
helloanswers what it answered last, or200with{ "viewers": 0, "interval_s": 30 }when it has answered nothing yet;nextholds the request 25 seconds on the harness clock, then answers204, as a backend does; a request the SDK cancels meanwhile ends without an answer;framesandresultsanswer200with{}.
The harness clock is the device clock that advance moves, so interval_s, the 25-second hold
and the request times t all follow it. A request to an origin other than the policy’s
live.origin (a Location the server named) is recorded as sent to that origin and answered
by nothing, as a host that does not exist.
The harness also fails a live/sdk-* vector, whatever its expect, when a secret leaves where
it belongs:
- The device tokens and the proofs. The
device_tokenof every answer the live server gave, and everyproofthe SDK sent in a hello, MUST NOT appear anywhere in a request to any origin other than the policy’slive.origin: its URL, any header, or its decompressed body, ingest records included. The harness searches for each value as a substring as it is, URL-encoded (percent-encoded), and in base64 (standard or URL-safe, with or without padding) of the hex text and of the 32 bytes it encodes. - The app key. The app key MUST appear only in the
Apsio-App-Keyheader of requests to the ingestendpoint, the policy andlive.origin: in no other header, URL or body. The one exception is the hostname of an ingest or policy origin, when the SDK uses its default per-app host derived from the key (1.3), asa-k3f9q2x7.ingest.example.com. - Nothing stored. After each
terminatestep, the harness searches every file the app’s storage holds at that moment (the SDK’s directory for the vector’s install, the app’s preferences and, where the platform lets the driver read it, its keychain or keystore) for every device token served and every proof sent so far. It searches each file’s bytes as they are and, for a gzip file, decompressed, for each value as its 64-character hex text, as the 32 bytes that text encodes, and as those bytes in base64 (standard or URL-safe, with or without padding). Any match fails the vector. A file the SDK deleted before the step is not searched. - Redirects, where the server is above HTTP. A driver whose live server fakes the SDK’s live
transport, above the platform’s HTTP stack, proves with
live/sdk-no-redirectthe channel’s side (a3xxis a failure, and nothing goes to theLocationhost). It also MUST prove, with its own test of the real transport, that the HTTP stack follows no redirect: a3xxto another port on loopback, and no connection made to it.
Each expected request has path, headers (matched without regard to case), records
and absent_records. A request’s records are flattened from the OTLP body, whatever its
grouping into Resources and scopes, to: event_name, severity_number, body,
session_id (per 2.4), name
(spans and metrics), scope (the InstrumentationScope name), attributes and resource.
B.6 Runners
Section titled “B.6 Runners”The repository ships a validator for the vector files (pnpm validate). Runners for
Rust (the Apsio ingestor), Swift and Kotlin load the vectors of a pinned version and run
them in each implementation’s CI.