pushinbr / pam-native-observability
Vendor-neutral telemetry and a native Sentry exporter (crashes, ANRs, NDK, PHP errors) for PAM Native.
Package info
github.com/push-in/pam-native-observability
Type:pam-native-plugin
pkg:composer/pushinbr/pam-native-observability
Requires
- php: ^8.5
- ext-json: *
- pushinbr/pam-native: ^1.53.1
Requires (Dev)
- phpstan/phpstan: ^2.1
- pushinbr/pam-native-testing: ^0.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-18 04:38:25 UTC
README
Traces, metrics, logs and crash context without vendor lock-in.
Instrument PHP, Rust and native boundaries with redacted, bounded telemetry exported over OTLP to the backend of your choice, or report crashes, ANRs and PHP errors through the native Sentry SDK.
Install · Quick example · Platforms · Permissions · Docs · Issues
Install
Inside a PAM Native project, add only this capability:
pam composer require pushinbr/pam-native-observability pam doctor --fix
The package is a PAM Native plugin (module observability); nothing is added to pam-native.json. The pure-PHP telemetry pipeline (Observability instances, encoders, transports) also works outside PAM Native. Use pam packages to inspect availability. New to PAM? Follow the five-minute PAM Native setup once (pam init my-app --template native).
Quick example
use Pam\Native\Observability\{CurlTelemetryTransport, Observability, ObservabilityConfig}; use Pam\Native\Observability\{SentryExporter, SpanStatus, WireProtocol}; // Vendor-neutral pipeline (OTLP/HTTP JSON to your collector) $config = new ObservabilityConfig( endpoint: 'https://collector.example', serviceName: 'showcase-mobile', serviceVersion: '1.0.0', wireProtocol: WireProtocol::OtlpHttpJson, ); $telemetry = new Observability($config, new CurlTelemetryTransport()); $span = $telemetry->span('feed.load'); try { loadFeed(); $span->status(SpanStatus::Ok); } catch (Throwable $e) { $span->exception($e); throw $e; } finally { $span->end(); $telemetry->flush(); } // Native Sentry exporter: once, at boot Observability::exporter( SentryExporter::dsn('https://public@o1.ingest.sentry.io/42') ->environment('production') ->release('chat@2.4.0+118') ->tracesSampleRate(0.25), ); Observability::capture($error, tags: ['screen' => 'chat']); // handled throwable
The queue is bounded and drops the oldest signals under backpressure; failed exports are restored to the front of the queue. Secrets and personal data are never collected automatically. Walk-throughs: telemetry pipeline (W3C traceparent continuation, custom transports), Sentry exporter (what is captured, App::onError(), iOS), certified OTLP export.
Platform support
| Platform | Support | Notes |
|---|---|---|
| Android | API 24+ | Sentry Android core + NDK 8.50.1 |
| iOS | 15.0+ | Sentry Cocoa 8.x Swift package (from 8.40.0); not yet validated on a device |
| PAM Native | 1.53.1 to < 2.0.0 | composer.json requires ^1.53.1 (Android 7.0/7.1 hosts); PHP 8.5+ |
Permissions and requirements
| Platform | Declared by the plugin |
|---|---|
| Android | android.permission.INTERNET, android.permission.ACCESS_NETWORK_STATE |
| iOS | No Info.plist keys |
- Android: dependencies
io.sentry:sentry-android-coreandsentry-android-ndk8.50.1. The manifest disables Sentry's auto-init (io.sentry.auto-init=false,SentryInitProviderremoved) and adds theSentryBootstrapcontent provider that restores the persisted exporter before PHP boots. - iOS: Swift package
getsentry/sentry-cocoafrom8.40.0(up to next major), productSentry. Upload dSYMs to Sentry for symbolicated native frames. CurlTelemetryTransportneeds the PHPcurlextension; implementTelemetryTransportwhen it is not available.
What you can build
- Cross-layer performance tracing
- Crash and error correlation
- Production health dashboards and SLO evidence
| Best for | A focused capability you can add to any PAM Native application |
| Native path | OpenTelemetry-compatible pipeline · Sentry Android/Cocoa SDKs |
| Application model | Composer package + generated native integration |
| Design rule | Independent module; no feed, vertical or application template bundled |
The default HTTPS transport works with a collector or ingestion gateway; use Observability::exporter(SentryExporter::dsn(...)) for Sentry, or implement TelemetryTransport for Datadog, Honeycomb, New Relic or an offline spool.
Production checklist
- Send remote telemetry only to HTTPS endpoints you control or explicitly trust.
- Define an attribute allowlist and never attach secrets or personal data by default.
- Keep
captureExceptionDetailsdisabled unless users consent to messages, source paths, line numbers and stack traces leaving the device. - Flush on lifecycle transitions without blocking the UI indefinitely.
- Monitor dropped-signal counters and tune bounded queues from evidence.
- Run
pam doctor,pam testand a signed release build on every supported platform. - Exercise denial, cancellation, backgrounding, process restart and offline behavior before release.
Troubleshooting
- Nothing is exported: verify endpoint, sampling decision and explicit
flush(). - Batches retry forever: make the transport surface permanent versus transient failures.
- Signals disappear under load: inspect queue capacity and dropped-signal diagnostics.
- Native integration is stale: run
pam doctor --fix, rebuild the native host and inspect the first reported diagnostic.
Compatibility
pushinbr/pam-native-observability |
pushinbr/pam-native |
Android | iOS |
|---|---|---|---|
| 0.5.4+ | >=1.53.1 <2.0.0 |
API 24+ (Android 7.0), Sentry Android 8.50.1 | 15+, Sentry Cocoa 8.x |
| 0.5.0 to 0.5.3 | >=1.7.0 <2.0.0 (tested with 1.7.0 and 1.46.x; App::onError() and Diagnostics\ErrorReporter need 1.7+) |
API 26+, Sentry Android 8.50.1 | 15+, Sentry Cocoa 8.x |
| 0.4.x | >=1.0.35 <2.0.0 |
API 26+ | 15+ |
| 0.3.x | >=1.0.35 <2.0.0 |
API 26+ | Telemetry pipeline only |
Platform SDKs, credentials, entitlements, physical hardware and store configuration remain application responsibilities.
Docs
- Telemetry pipeline
- Sentry exporter
- Certified OTLP export
- API reference
- A real example: Zé Chat
- Runnable demo app
- PAM Native overview
- Plugin and native capability model
- Changelog
- Report an issue: security vulnerabilities go through the repository security policy or GitHub private vulnerability reporting, not a public issue
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · Made in Brazil by Pushin