{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "insights/v1/events/honeybadger-python/oban.job_finished.json",
  "title": "Oban: job_finished",
  "description": "An Oban job finished, whether it succeeded or failed. Emitted for both oban.job.stop and oban.job.exception telemetry events.",
  "x-hb": {
    "notifiers": [
      "honeybadger-python"
    ],
    "category": "jobs",
    "component": "Oban"
  },
  "type": "object",
  "properties": {
    "event_type": {
      "type": "string",
      "const": "oban.job_finished"
    },
    "job_id": {
      "type": "integer",
      "description": "Oban job database ID.",
      "examples": [
        123456
      ]
    },
    "worker": {
      "type": "string",
      "description": "Fully qualified worker name (\"module.Class\").",
      "examples": [
        "myapp.workers.WelcomeEmail"
      ]
    },
    "queue": {
      "type": "string",
      "description": "Queue the job ran on.",
      "examples": [
        "default"
      ]
    },
    "state": {
      "type": "string",
      "description": "Resulting job state: \"completed\", \"retryable\", \"discarded\", \"cancelled\", or \"scheduled\" (snoozed). Failures are \"retryable\" until max_attempts is exhausted, then \"discarded\".",
      "examples": [
        "completed"
      ]
    },
    "attempt": {
      "type": "integer",
      "description": "Attempt number (1-based).",
      "examples": [
        1
      ]
    },
    "max_attempts": {
      "type": "integer",
      "description": "Maximum number of attempts before the job is discarded.",
      "examples": [
        20
      ]
    },
    "duration": {
      "type": "number",
      "description": "Job execution duration in milliseconds.",
      "examples": [
        845.2103
      ]
    },
    "queue_time": {
      "type": "number",
      "description": "Time the job spent waiting in the queue (scheduled_at to attempted_at) in milliseconds.",
      "examples": [
        12.5
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tags assigned to the job.",
      "examples": [
        [
          "mailer"
        ]
      ]
    },
    "error_type": {
      "type": "string",
      "description": "Exception class name. Only present when the job failed (state \"retryable\" or \"discarded\").",
      "examples": [
        "ValueError"
      ]
    },
    "error_message": {
      "type": "string",
      "description": "Exception message. Only present when the job failed (state \"retryable\" or \"discarded\").",
      "examples": [
        "invalid user id"
      ]
    },
    "args": {
      "type": "object",
      "description": "Job arguments (filtered). Only present when include_args is enabled in insights_config.",
      "additionalProperties": true,
      "examples": [
        {
          "user_id": 42
        }
      ]
    },
    "meta": {
      "type": "object",
      "description": "Job metadata (filtered). Only present when include_args is enabled in insights_config.",
      "additionalProperties": true,
      "examples": [
        {
          "source": "signup"
        }
      ]
    },
    "request_id": {
      "type": "string",
      "description": "Request ID propagated from the originating request's event context via Oban job metadata.",
      "examples": [
        "1f9f6f1a-2b3c-4d5e-8f6a-7b8c9d0e1f2a"
      ]
    }
  },
  "required": [
    "event_type",
    "job_id",
    "worker",
    "queue",
    "state"
  ]
}
