Laravel Horizon statistics

Get Laravel Horizon statistics for your site.

In Ploi it is possible to see your Laravel Horizon statistics directly from the Ploi panel. This article describes how you can get these statistics via the Ploi API.

How do I configure Laravel Horizon statistics


GET/api/servers/{server}/sites/laravel/horizon/{type}

Get Horizon statistics

This endpoint returns Laravel Horizon statistics for your site.

Optional parameters

  • Name
    type
    Type
    string
    Description

    The type of statistics to retrieve. Options: stats, workload, masters, failed. Defaults to stats.

Request (stats)

GET
/api/servers/{server}/sites/laravel/horizon
curl -G "https://ploi.io/api/servers/{server}/sites/laravel/horizon" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json"

Response (stats)

{
  "data": {
    "failedJobs": 1,
    "jobsPerMinute": 0,
    "pausedMasters": 0,
    "periods": {
      "failedJobs": 10080,
      "recentJobs": 60
    },
    "processes": 1,
    "queueWithMaxRuntime": null,
    "queueWithMaxThroughput": null,
    "recentJobs": 0,
    "status": "running",
    "wait": {
      "redis:default": 0
    }
  }
}

Response (workload)

{
  "data": [
    {
      "name": "default",
      "length": 0,
      "wait": 0,
      "processes": 1
    }
  ]
}

Response (masters)

{
  "data": {
    "from-macbook-pro-Ry0f": {
      "name": "from-macbook-pro-Ry0f",
      "pid": "104064",
      "status": "running",
      "supervisors": [
        {
          "name": "from-macbook-pro-Ry0f:supervisor-1",
          "master": "from-macbook-pro-Ry0f",
          "pid": "104078",
          "status": "running",
          "processes": {
            "redis:default": 1
          }
        }
      ]
    }
  }
}

Response (failed)

{
  "data": {
    "jobs": [
      {
        "id": "67a059c9-51a4-4b94-b7c1-289d6c20ccf5",
        "connection": "redis",
        "queue": "default",
        "name": "App\\Jobs\\Fails",
        "status": "failed",
        "exception": "ErrorException: Use of undefined constant broken"
      }
    ],
    "total": 1
  }
}