{
  "repo": "tidbcloud/jiralert",
  "binary": "jiralert",
  "binary_path": "cmd/jiralert/main.go",
  "surface_kind": "webhook_service",
  "type": "webhook_service",
  "services": [
    {
      "name": "JiralertLifecycle",
      "package": "main",
      "methods": [
        {
          "name": "Startup",
          "name_key": "Runtime JiralertLifecycle.Startup",
          "input": "flags + environment variables",
          "output": "loaded config/template/precheck matcher, initialized optional integrations, registered HTTP handlers, and running stdlib HTTP server",
          "type": "local"
        },
        {
          "name": "LoadConfig",
          "name_key": "Runtime JiralertLifecycle.LoadConfig",
          "input": "CONFIG_PATH or CONFIG_SECRET_NAME",
          "output": "*config.Config",
          "type": "local"
        },
        {
          "name": "LoadTemplate",
          "name_key": "Runtime JiralertLifecycle.LoadTemplate",
          "input": "conf.Template or conf.TemplateSecretName",
          "output": "*template.Template",
          "type": "local"
        },
        {
          "name": "LoadPrecheckMatcher",
          "name_key": "Runtime JiralertLifecycle.LoadPrecheckMatcher",
          "input": "conf.PrecheckPath or conf.PrecheckSecretName",
          "output": "precheck.Matcher",
          "type": "local"
        },
        {
          "name": "InitializeLocks",
          "name_key": "Runtime JiralertLifecycle.InitializeLocks",
          "input": "conf.DistributedLocks",
          "output": "*locks.Locks or nil",
          "type": "local"
        },
        {
          "name": "InitializeClinic",
          "name_key": "Runtime JiralertLifecycle.InitializeClinic",
          "input": "conf.DBDSN + clinic/event configuration",
          "output": "*clinic.Client + validate.Validator",
          "type": "local"
        },
        {
          "name": "InitializeJiraClient",
          "name_key": "Runtime JiralertLifecycle.InitializeJiraClient",
          "input": "receiver/global Jira auth settings",
          "output": "client.IssueTracker adapter",
          "type": "local"
        },
        {
          "name": "StartHTTPServer",
          "name_key": "Runtime JiralertLifecycle.StartHTTPServer",
          "input": "LISTEN_ADDRESS or -listen-address",
          "output": "serving HTTP handlers on the configured address",
          "type": "local"
        }
      ]
    }
  ],
  "extensions": {
    "http_routes": [
      {
        "name_key": "HTTP POST /alert",
        "method": "POST",
        "path": "/alert",
        "handler": "main.alertHandler",
        "description": "Receive Alertmanager webhook JSON and process Jira issue lifecycle, including buffered execution under local rate limiting.",
        "conditions": []
      },
      {
        "name_key": "HTTP GET /",
        "method": "GET",
        "path": "/",
        "handler": "main.homePageHandler",
        "description": "Render the JIRAlert home page HTML.",
        "conditions": []
      },
      {
        "name_key": "HTTP GET /version",
        "method": "GET",
        "path": "/version",
        "handler": "main.versionPageHandler",
        "description": "Return the build version string.",
        "conditions": []
      },
      {
        "name_key": "HTTP GET /config",
        "method": "GET",
        "path": "/config",
        "handler": "main.configPageHandler",
        "description": "Render the current YAML configuration with secrets redacted.",
        "conditions": []
      },
      {
        "name_key": "HTTP GET /healthz",
        "method": "GET",
        "path": "/healthz",
        "handler": "main.healthzPageHandler",
        "description": "Return an OK health response.",
        "conditions": []
      }
    ],
    "listeners": [
      {
        "protocol": "http",
        "address_source": "LISTEN_ADDRESS or -listen-address",
        "purpose": "main webhook and status HTTP server",
        "conditions": []
      }
    ],
    "notes": [
      "The binary exposes five HTTP handlers from net/http: /alert, /, /version, /config, and /healthz.",
      "The HTML home page links to /metrics and /debug/pprof, but the binary does not register those handlers in main.go.",
      "Per-summary throttling is local in-memory rate limiting via golang.org/x/time/rate. Redis is only used for optional distributed locking during custom-group issue aggregation.",
      "When POST /alert exceeds the local rate limit, the handler buffers the work on a background queue and returns HTTP 200 before the downstream Jira flow runs."
    ]
  }
}
