jobviz/agent
Composer 安装命令:
composer require jobviz/agent
包简介
Lightweight agent SDK for monitoring Laravel Queue, Symfony Messenger, and custom PHP queue jobs with Jobviz
README 文档
README
Lightweight SDK for streaming job lifecycle events from your PHP application to Jobviz — real-time monitoring, alerting, and AI-powered debugging for background jobs.
Supports Laravel Queue, Symfony Messenger, and custom providers.
Install
composer require jobviz/agent
Quick Start
Laravel (zero-config)
Add your API key to .env:
JOBVIZ_API_KEY=your-api-key
That's it. The service provider auto-discovers via Composer, hooks into Laravel's queue events, and streams them to Jobviz in batches.
Optionally publish the config file:
php artisan vendor:publish --provider="Jobviz\Agent\Laravel\JobvizServiceProvider"
Symfony Messenger
use Jobviz\Agent\Config; use Jobviz\Agent\Jobviz; use Jobviz\Agent\Providers\SymfonyMessengerProvider; Jobviz::init(new Config( apiKey: $_ENV['JOBVIZ_API_KEY'], provider: new SymfonyMessengerProvider( dispatcher: $container->get('event_dispatcher'), ), ));
Register SymfonyMessengerProvider as a service to auto-wire it as an event subscriber.
Multiple queue systems
use Jobviz\Agent\Config; use Jobviz\Agent\Jobviz; use Jobviz\Agent\Providers\MultiProvider; use Jobviz\Agent\Providers\LaravelQueueProvider; use Jobviz\Agent\Providers\SymfonyMessengerProvider; Jobviz::init(new Config( apiKey: $_ENV['JOBVIZ_API_KEY'], provider: new MultiProvider([ new LaravelQueueProvider($app['events']), new SymfonyMessengerProvider($dispatcher), ]), ));
In-Job Logging
Attach structured log entries to a running job for step-by-step visibility in the Jobviz timeline:
use Jobviz\Agent\Jobviz; // Inside your job's handle() method Jobviz::log( ['id' => $this->job->getJobId(), 'name' => 'SendEmail', 'queue' => 'emails'], 'Fetching template', ); Jobviz::log( ['id' => $this->job->getJobId(), 'name' => 'SendEmail', 'queue' => 'emails'], 'Sending email', ['recipients' => count($this->recipients)], );
Deployment Tracking
Correlate deployments with job failures in the Jobviz dashboard:
use Jobviz\Agent\Jobviz; Jobviz::trackDeployment( version: '1.4.2', commitHash: 'abc123f', description: 'Fix email retry logic', );
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
required | Your Jobviz project API key |
provider |
QueueProviderInterface |
required | Queue provider instance |
endpoint |
string |
https://app.jobviz.dev |
Jobviz API endpoint |
env |
?string |
null |
Environment tag (e.g. production, staging) |
batchSize |
int |
100 |
Max events per HTTP batch |
flushInterval |
float |
3.0 |
Flush interval in seconds |
maxBufferSize |
int |
10000 |
Max events buffered in memory before dropping oldest |
captureInput |
bool |
true |
Capture job payload data |
captureStackTraces |
bool |
true |
Capture stack traces on failure |
redactKeys |
bool|string[] |
true |
Redact sensitive keys from job data |
debug |
bool |
false |
Enable verbose logging |
onError |
?Closure |
null |
Called when a batch fails to send |
Laravel config
When using Laravel, all options are configurable via config/jobviz.php and environment variables. See JOBVIZ_API_KEY, JOBVIZ_ENDPOINT, JOBVIZ_ENV, and JOBVIZ_DEBUG.
Internal buffering
The event buffer holds up to maxBufferSize events (default 10 000) in memory. When the buffer is full, the oldest events are dropped to prevent unbounded memory growth.
HTTP transport retries failed requests with exponential backoff (up to 4 attempts) and respects 429 Retry-After headers.
Privacy & Data Sanitization
By default, the agent captures job input data and error stack traces — this powers Jobviz's debugging and AI root-cause analysis features.
If your jobs handle sensitive data, you have several levels of control:
use Jobviz\Agent\Config; // 1. Disable input capture entirely new Config(apiKey: $key, provider: $provider, captureInput: false); // 2. Disable stack trace capture new Config(apiKey: $key, provider: $provider, captureStackTraces: false); // 3. Redact built-in sensitive keys (password, secret, token, etc.) new Config(apiKey: $key, provider: $provider, redactKeys: true); // 4. Redact custom keys (merged with built-in set) new Config(apiKey: $key, provider: $provider, redactKeys: ['ssn', 'dob', 'bankAccount']); // 5. Disable redaction entirely new Config(apiKey: $key, provider: $provider, redactKeys: false);
Built-in redacted keys: password, secret, token, apikey, api_key, authorization, creditcard, credit_card, ssn, accesstoken, access_token, refreshtoken, refresh_token.
Key matching is case-insensitive — Authorization, AUTHORIZATION, and authorization are all redacted.
See our Privacy Policy for full details on data handling.
Multi-Instance Usage
The Jobviz::init() / Jobviz::stop() helpers manage a global singleton. For advanced use cases (tests, multi-tenant), instantiate JobvizAgent directly:
use Jobviz\Agent\Config; use Jobviz\Agent\JobvizAgent; $agent = new JobvizAgent(new Config( apiKey: $_ENV['JOBVIZ_API_KEY'], provider: $provider, )); $agent->start(); // Later... $agent->stop();
Custom Providers
Implement the QueueProviderInterface to monitor any queue system:
use Closure; use Jobviz\Agent\JobEvent; use Jobviz\Agent\Providers\QueueProviderInterface; class MyQueueProvider implements QueueProviderInterface { public function connect(Closure $push): void { // Subscribe to your queue system and call $push(new JobEvent(...)) for each event } public function disconnect(): void { // Clean up connections } }
Graceful Shutdown
In Laravel, the service provider automatically flushes remaining events when the application terminates.
For standalone usage, call stop() to flush the buffer before your process exits:
use Jobviz\Agent\Jobviz; register_shutdown_function(fn() => Jobviz::stop());
Tip:
Jobviz::stop()disconnects providers and flushes the in-memory buffer — typically under 1 second.
Requirements
- PHP >= 8.1
- Guzzle HTTP >= 7.0
- One of: Laravel 10+/11+ or Symfony 6+/7+ (or a custom provider)
Documentation
Full documentation is available at jobviz.dev/docs.
License
jobviz/agent 适用场景与选型建议
jobviz/agent 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「symfony」 「monitoring」 「laravel」 「jobs」 「observability」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jobviz/agent 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jobviz/agent 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jobviz/agent 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
PHP AMQP Binding Library
The bundle for easy using json-rpc api on your project
A Laravel package to monitor queue jobs.
SoftWax Health Check Bundle for Symfony framework
1Pilot client for Symfony
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-10