PAM Native Observability
Start here
Section titled “Start here”Every PAM Native product runs on the PAM runtime. Install and verify PAM first, create a Native application, and add this package through PAM Composer:
curl -fsSL https://github.com/push-in/pam/releases/latest/download/install.sh | shpam doctorpam init my-app --template nativecd my-apppam composer require pushinbr/pam-native-observabilitypam doctorpam native devpushinbr/pam-native-observability 0.5 has two independent parts: a native
Sentry exporter (Sentry Android 8.50.1 with NDK, Sentry Cocoa 8.x) that
captures crashes of the embedded PHP runtime, ANRs/app hangs and PHP errors,
and a pure-PHP telemetry pipeline with OTLP/HTTP JSON export. Requires PAM
Native >=1.0.35 <2.0.0.
use Pam\Native\App;use Pam\Native\Diagnostics\RuntimeError;use Pam\Native\Observability\{Observability, SentryExporter};
// Once at boot, before App::run().Observability::exporter( SentryExporter::dsn('https://public@o1.ingest.sentry.io/42') ->environment('production') ->release('chat@2.4.0+118') ->tracesSampleRate(0.25) ->profilesSampleRate(0.05), // 0.5.0+);
// Errors thrown inside renders and handlers (PAM Native 1.7+).App::onError(fn (Throwable $e, RuntimeError $r) => Observability::capture($e, handled: !$r->fatal()));
Observability::user('42');Observability::breadcrumb('Opened chat 42', 'navigation');The exporter configuration is persisted and restored by a content provider
(Android) or at module creation (iOS), so crashes before PHP boots are
reported. PHP events are de-duplicated for 60 s and rate limited (30 per
minute by default); personal data is off unless sendDefaultPii().
Spans, logs and OTLP
Section titled “Spans, logs and OTLP”use Pam\Native\Observability\{CurlTelemetryTransport, Observability, ObservabilityConfig, SpanStatus, WireProtocol};
$telemetry = new Observability( new ObservabilityConfig('https://collector.example', 'chat-mobile', '2.4.0', wireProtocol: WireProtocol::OtlpHttpJson), new CurlTelemetryTransport(),);$span = $telemetry->span('feed.load');try { $this->loadFeed(); $span->status(SpanStatus::Ok); }catch (Throwable $e) { $span->exception($e); throw $e; }finally { $span->end(); $telemetry->flush(); }Spans go to /v1/traces, logs and crash context to /v1/logs, counters and
gauges to /v1/metrics. Queues are bounded and drop the oldest signals; a
failed export is restored to the front of the queue.