dgarbs51/job-execution-recorder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dgarbs51/job-execution-recorder

最新稳定版本:v0.0.3

Composer 安装命令:

composer require dgarbs51/job-execution-recorder

包简介

Laravel listener package for recording queue job execution metrics.

README 文档

README

Job Execution Recorder is a Laravel package that records queue execution lifecycle events (processing, processed, failed) into a job_executions table and provides a configurable dashboard.

Supported Versions

  • Laravel 10.x, 11.x, 12.x, and 13.x
  • PHP 8.2+

What It Includes

  • Queue event listener registration via JobExecutionRecorderServiceProvider
  • Execution listener implementation in src/Listeners/RecordJobExecution.php
  • Migration for creating job_executions
  • Configurable dashboard route + Blade view
  • Configurable database connection for writes and dashboard reads

Installation

composer require dgarbs51/job-execution-recorder
php artisan vendor:publish --provider="DGarbs51\JobExecutionRecorder\JobExecutionRecorderServiceProvider"
php artisan migrate

Publish Options

# Config
php artisan vendor:publish --tag=job-execution-recorder-config

# Views
php artisan vendor:publish --tag=job-execution-recorder-views

Configuration

Publish config to create config/job-execution-recorder.php and then tune values:

return [
    'database_connection' => env('JOB_EXECUTION_DB_CONNECTION', env('DB_CONNECTION')),
    'dashboard' => [
        'enabled' => env('JOB_EXECUTION_RECORDER_DASHBOARD_ENABLED', true),
        'path' => env('JOB_EXECUTION_RECORDER_DASHBOARD_PATH', 'jobs/execution/dashboard'),
        'name' => 'job-execution-recorder.dashboard',
        'view' => 'job-execution-recorder::dashboard',
        'middleware' => ['web', 'auth'],
        'gate' => 'viewJobExecutionDashboard',
        'allowed_emails' => [...],
    ],
];

Environment Variables

  • JOB_EXECUTION_DB_CONNECTION: DB connection for recorder writes + dashboard reads. Defaults to DB_CONNECTION.
  • JOB_EXECUTION_RECORDER_DASHBOARD_ENABLED: enable/disable dashboard route registration.
  • JOB_EXECUTION_RECORDER_DASHBOARD_PATH: route path (default /jobs/execution/dashboard).
  • JOB_EXECUTION_RECORDER_DASHBOARD_ALLOWED_EMAILS: comma-separated email allowlist for non-local environments.
  • dashboard.view can be changed in config to render a custom published view path.

Dashboard Access (Horizon-style)

  • Route middleware defaults to web + auth.
  • Route is additionally protected by the can:viewJobExecutionDashboard ability (configurable with dashboard.gate).
  • In local environments, access is allowed by default.
  • In non-local environments, access is allowed only when the authenticated user's email is in dashboard.allowed_emails (or via your custom gate definition).

You can override the gate in your app:

Gate::define('viewJobExecutionDashboard', function ($user) {
    return $user->isAdmin();
});

Dashboard Filters

The dashboard supports:

  • Time range filtering
  • Exact job_class_short filtering
  • Exact message_group filtering

Message group metrics are displayed only when at least one message-group row exists for the current filter context.

Migration / Index Notes

The package migration is designed to run on PostgreSQL, MySQL, and SQLite. It includes indexes aligned with dashboard access patterns:

  • started_at
  • job_class_short, started_at
  • queue, started_at
  • status, started_at
  • message_group, started_at

Notes

This package currently expects application-level JobExecution model and JobExecutionStatus enum under the App\ namespace. If you want this to be framework-agnostic, extract those into the package as a follow-up.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固