Skip to content

Telemetry ​

The app reports what its user does to Instagram as telemetry events. The Simulator logs the events of the actions that need them and sends them for you. Most programs never need this page: the entries deliver the telemetry that is still pending when the process closes (The app process). This page is for a program that wants to send it earlier, inside the program.

What is logged and when it is sent ​

The events a flow logs accumulate in the process's telemetry store (they are not part of a checkpoint). Actions that instrument a sequence (profile visits, video view counts) log their events as part of the action, best-effort. The close of the process delivers what is pending. FlushTelemetry is "send now, inside the program": it sends every channel that has a delivery and reports { events }.

ts
import { AndroidIgpapi, FeedTimelineScreen, FlushTelemetry } from '@igpapi/android';
import { Effect } from 'effect';
import { readFile } from 'node:fs/promises';

const saved = JSON.parse(await readFile('session.json', 'utf8'));

const sent = await AndroidIgpapi.launch({
  checkpoint: saved,
  screen: FeedTimelineScreen,
  main: feed =>
    Effect.gen(function* () {
      // ...the screen actions that log events...
      yield* feed.swipeToNext();
      // Send what has been logged now, instead of at the close.
      return yield* FlushTelemetry(); // { events }
    }),
});
console.log(sent.events);

It sends only into the delivery session the process began at start-up. A process that never began one gets TelemetryDeliverySessionError (reason: 'session') and keeps its events in the store. A program that composes the app layer itself starts the session with pigeonSendInfraBatches (@igpapi/pigeon-nest).

When a delivery fails ​

An empty store sends nothing ({ events: 0 }). If a channel's upload is rejected (the transport fails, or the server answers a non-2xx), FlushTelemetry fails with TelemetryDeliveryError after putting that channel's events back unchanged, so running it again sends the same events. The error names the channel and why it failed: reason: 'transport' carries the request layer's cause, reason: 'http' carries the response status. A channel that delivered before the failing one keeps its events sent.

Flush inside the same program whose events it should deliver: the store belongs to the process.

The pages of this site are the README files of the repository. The API reference is generated from the source.