pepperfm/dozor-agent 问题修复 & 功能扩展

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

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

pepperfm/dozor-agent

Composer 安装命令:

composer require pepperfm/dozor-agent

包简介

Self-hostable Laravel instrumentation and local agent starter inspired by laravel/nightwatch.

README 文档

README

A self-hostable Laravel instrumentation and local agent starter, adapted from the public laravel/nightwatch package architecture and transport ideas, but renamed and reshaped for Dozor.

What this bundle gives you

  • Laravel package with dozor:agent and dozor:status commands
  • local TCP ingest client/server using a framed payload protocol
  • request tracing middleware
  • query, queue, and exception watchers
  • newline-delimited JSON storage for ingested records
  • configuration already renamed from NIGHTWATCH_* to DOZOR_*

What this is not

  • not a drop-in clone of the hosted Nightwatch backend
  • not a full production-ready APM yet
  • not a fork that keeps Laravel/Nightwatch branding

It is a good self-hosted starter: clean enough to keep, small enough to reshape.

Install

composer require pepperfm/dozor-agent
php artisan vendor:publish --tag=dozor-config

Local package smoke install (path repository)

{
  "repositories": [
    {
      "type": "path",
      "url": "../dozor-agent",
      "options": {
        "symlink": true
      }
    }
  ]
}
composer require pepperfm/dozor-agent:*
php artisan list | grep dozor:
php artisan vendor:publish --tag=dozor-config

Install is safe even if the local worker is not running yet. The package does not break composer install, deploy hooks, or package:discover when 127.0.0.1:4815 is unavailable. You can install first and start the worker later.

Typical env

DOZOR_ENABLED=true
DOZOR_TOKEN=change-me
DOZOR_APP_NAME="My App"
DOZOR_ENV=production
DOZOR_SERVER=app-1
DOZOR_INGEST_URI=127.0.0.1:4815
DOZOR_INGEST_EVENT_BUFFER=500
DOZOR_REQUEST_SAMPLE_RATE=1.0
DOZOR_IGNORE_QUERIES=false
DOZOR_AGENT_STORE_PATH=/var/www/app/storage/app/dozor
DOZOR_AGENT_SHIP_FLUSH_INTERVAL_SECONDS=10

Run local agent

php artisan dozor:agent

Useful options:

php artisan dozor:agent --listen-on=127.0.0.1:4815 --store-path=/var/www/app/storage/app/dozor
php artisan dozor:agent --ship-flush-interval-seconds=10
php artisan dozor:status
php artisan dozor:status --json
php artisan dozor:status --strict

dozor:status --strict is opt-in diagnostics and may fail when the local worker is down. Regular runtime instrumentation stays non-fatal and keeps buffered retry behavior.

Runtime telemetry and status

dozor:status now reports:

  • local agent reachability (ping)
  • queue depth and failed queue depth
  • dropped batches and failed upload counters
  • last flush / heartbeat / upload timestamps

Shipping strategy is strict batching by default and cannot be toggled via config flags.

Telemetry state is persisted to:

DOZOR_AGENT_STATE_PATH=/var/www/app/storage/app/dozor/runtime-state.json

Production packaging examples

Example service files are available in:

  • examples/supervisor/dozor-agent.conf.example
  • examples/systemd/dozor-agent.service.example

Current record model

The package emits records like:

  • request
  • query
  • job
  • exception
  • custom

Each record includes a trace_id, timestamps, app/environment/server metadata, and a payload block.

Files worth editing first

  • src/DozorServiceProvider.php
  • src/Core.php
  • src/Http/Middleware/TraceRequest.php
  • src/Agent/Server.php
  • config/dozor.php

Suggested next steps

  1. swap NDJSON file storage for ClickHouse / Postgres / Kafka / Redis Streams
  2. add outgoing HTTP instrumentation
  3. add trace/span hierarchy instead of flat child records
  4. add metric rollups (minute buckets, P95/P99)
  5. correlate deployments/releases

pepperfm/dozor-agent 适用场景与选型建议

pepperfm/dozor-agent 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 149 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「monitoring」 「laravel」 「apm」 「DoZoR」 「observability」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 pepperfm/dozor-agent 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pepperfm/dozor-agent 我们能提供哪些服务?
定制开发 / 二次开发

基于 pepperfm/dozor-agent 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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