stackmonitor/agent-laravel
StackMonitor Agent for Laravel: a lightweight package that connects your Laravel application to StackMonitor for monitoring and insights. Easy to install and configure, it reports runtime data from your app so you can keep an eye on performance and health in one place.
Architecture fit
The package is an agent-side telemetry collector paired with a hosted dashboard. v1.18.0 extended the report payload with a php_code section; v1.21.0 adds distro build-suffix reporting for PHP (e.g. Ubuntu's -1ubuntu2.20) as a first-class field rather than something the dashboard infers. Neither release introduces a new service, queue, or storage dependency. Architecturally both are additive extensions of the agent→dashboard contract. The default posture remains metadata-only (file counts, sizes, and a path/size/mtime fingerprint), which aligns with the package's existing low-touch, read-only collection model.
Integration feasibility
app/ and for composer.lock packages not resolvable on packagist.org, dev packages excluded. Expect a small, bounded increase in report-generation time (≤2s per report, with a deferred 20s retry path for slow packages).STACKMONITOR_AGENT_FILE_CONTENTS=true and hard-gated on ext-zip. This is a meaningful control: the default install ships no source code off-box.php_code.contents and, now, the distro build suffix. This is a version-skew constraint that must be encoded in the rollout plan, not discovered during it.Technical risk
| Risk | Severity | Notes |
|---|---|---|
| Source code egress via ZIP opt-in | High | Even scoped to *.php, app/ can contain secrets, keys, hardcoded credentials, proprietary logic. Requires explicit security and legal sign-off, not just an env var. |
| Filesystem scanning overhead | Medium | 2s per-report budget plus cache; large repos or slow network mounts (NFS/EFS) can still degrade report latency. The 10-minute cache mitigates steady-state cost but not cold-start cost. |
| Symlink / path containment | Medium | Release states linked folders inside a package are not followed and ZIPs are constrained to the package folder. Validate this on real repos with symlinked vendor dirs and monorepo layouts. |
| Fingerprint information disclosure | Low–Medium | Paths, sizes, and mtimes leak project structure and package inventory. Lower risk than content, but should be covered by the same data-handling review. |
| ZIP resource exhaustion | Medium | 5000-file / 8MB caps are sensible; confirm streaming vs. in-memory ZIP creation to avoid PHP memory_limit failures on large packages. |
| Agent/dashboard version skew | Medium | Dashboard-first is mandatory; older dashboards must tolerate unknown fields or the agent upgrade must be held. Applies equally to the new build-suffix field. |
| Config drift | Low | A single boolean env var controls egress. Needs to be owned by platform/security, not left to individual app teams. |
| Alert downgrade on distro-patched PHP | Low–Medium | v1.21.0 deliberately converts some PHP vulnerability warnings into hints for distro-patched builds. This is correct (distros backport fixes without version bumps) but it reduces the loudness of a security signal. Teams with strict "warn on any PHP CVE" policies may need to re-baseline expectations; confirm the dashboard still surfaces hints in the UI and any export/API. |
Key questions
app/ scan include .env-adjacent or generated PHP (e.g. compiled views, cache files)? Are there exclusion patterns, or only the 5000-file cap?ext-zip is absent but the env var is true — silent disable, warning, or error?vendor/ trees, and does the 2s/20s budget hold on network-attached storage?php_code.contents, and which first understands the distro build suffix? What is the minimum supported pairing for each?-1ubuntu2.20 vs -1ubuntu2.19) reliably, or only warn/hint on the base version?Stack fit
Fits the existing Laravel/PHP agent deployment pattern: Composer package, env-driven configuration, no new infrastructure. The ZIP path depends on ext-zip (commonly present, but must be confirmed in base images and CI runners). The v1.21.0 build-suffix field adds nothing to the stack-fitness picture — it relies on the runtime PHP version string already available to the agent. No database migrations or new external services are implied.
Migration path
php_code, php_code.contents, and the distro build suffix.STACKMONITOR_AGENT_FILE_CONTENTS unset/false. This is behaviourally safe: new report fields are additive, and only metadata leaves the host.FILE_CONTENTS=true on a single canary app, then expand in cohorts.Compatibility
composer.json against our current runtime baseline before scheduling.Sequencing Dashboard → staging agent (metadata only) → production agent (metadata only, canary then fleet) → security decision → canary with content upload → broader enablement. Do not bundle the agent upgrade and the opt-in flag into the same change window; separating them keeps the blast radius of a rollback small. Because v1.21.0 changes alerting semantics, deploy it in its own window from the dashboard's vulnerability-reporting changes, so that any shift in warning counts is attributable to one change.
Maintenance Low steady-state maintenance: no schema, no migrations, no new daemon. The main ongoing cost is config governance for the content-upload flag and periodic review of what counts as an "unresolvable" Composer package (private packages, path repositories, VCS dependencies). v1.21.0 adds a small second-order maintenance item: the distro-suffix mapping is a moving target as distros cut new security pockets, so dashboard-side parsing may lag newly patched builds. Expect occasional questions when the package inventory in the dashboard doesn't match team expectations, and separately when a PHP CVE shows as a hint rather than a warning.
Support New support surface: "why is my package missing from the PHP upgrade forecast?" Common causes will be dev-package exclusion, packagist-resolvable packages being skipped, the 5000-file cap, scan timeouts, and the 10-minute cache. Document these in the internal runbook. The cache means stale results are expected for up to 10 minutes after a deploy — support scripts should account for it rather than treating it as a bug.
Add a second runbook entry for v1.21.0: "why is this PHP vulnerability only a hint?" with the answer that the host's PHP build includes a distro revision and the dashboard assumes the distro backported the fix. Give support a way to verify the actual patch level (e.g. dpkg -l php* / distro changelog) when a hint is contested.
Scaling Per-report cost is bounded but real: ≤2s typical, with a slow package deferred and given 20s in a later report. Across a large fleet this is a modest CPU/IO increase, but it will be noticeable on shared hosts or network filesystems. The ZIP path is the only meaningful bandwidth consumer and is capped at 8MB per package per fetch. Because ZIPs are pulled on demand by package id rather than pushed with every report, request volume should be low — but confirm the dashboard caches them. The v1.21.0 field is effectively free from a scaling perspective.
Failure modes
| Failure | Impact | Mitigation |
|---|---|---|
| Scan exceeds time budget | Package absent from forecast until a later report | Expected behaviour; surface in dashboard as "pending" rather than silently missing |
ext-zip missing |
Content upload silently unavailable | Report php_code.contents=false; alert on config/extension mismatch |
| Dashboard older than agent | php_code or build suffix ignored or dashboard errors |
Enforce dashboard-first rollout and version pinning |
| Large repo / memory limit | ZIP generation fails | Stream ZIP creation; alert on failure; keep 8MB cap |
| Symlinked vendor or linked folders | Packages not scanned or partially scanned | Validate on real repos; document the "linked folders not followed" behaviour |
| Accidental flag enablement | Source code egress | Keep flag out of shared env templates; require change approval; audit php_code.contents state per app |
| Unparsed distro build suffix | Vulnerability downgraded to hint when it shouldn't be, or vice versa | Validate on our actual base images; log the raw version string; keep hint items visible in UI/API exports |
| Hint not surfaced downstream | Security team loses sight of a real outstanding CVE | Confirm hints flow into exports/SIEM; sample-audit after rollout |
Ramp-up Estimate half a day for a platform engineer to validate the metadata-only path in staging and a further 1–2 days for the security review if content upload is pursued. Teams consuming the forecast need no training beyond knowing where the data comes from and why some packages are absent. v1.21.0 needs a short briefing to security/on-call (15–30 minutes) so the warning→hint downgrade on distro-patched PHP isn't mistaken for lost coverage. The dashboard-first dependency remains the main scheduling constraint — plan it as a two-step release, not a single upgrade.
Recommendation Adopt the metadata-only capability by default; it is low-risk and directly supports PHP upgrade planning. Take v1.21.0 as part of the same metadata-only track — it is an additive field with no config or infrastructure cost, and the warning→hint behaviour is technically correct for distro-backported PHP fixes — but explicitly notify security/on-call and confirm hints remain visible in exports before rollout. Treat the ZIP content-upload feature as a separate, gated decision requiring security, legal, and data-handling sign-off — the env var makes it technically easy, which is precisely why the approval should be explicit and auditable.
How can I help you explore Laravel packages today?