{
  "repo": "tidbcloud/cost-metering-service",
  "binary": "server",
  "binary_path": "cmd/server/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "services": [
    {
      "name": "CostAPI",
      "type": "http",
      "base_path": "/api/v1/cost",
      "methods": [
        {
          "name": "CostUnits",
          "name_key": "HTTP POST /api/v1/cost/measures",
          "http_method": "POST",
          "path": "/measures",
          "input": "forms.UnitCostsInput",
          "output": "forms.UnitCosts",
          "description": "Submit cost measurement data"
        },
        {
          "name": "CostUnitsTest",
          "name_key": "HTTP GET /api/v1/cost/tenants/:tenant_id/cost/test",
          "http_method": "GET",
          "path": "/tenants/:tenant_id/cost/test",
          "input": "-",
          "output": "string",
          "description": "Test endpoint"
        },
        {
          "name": "ListUnits",
          "name_key": "HTTP GET /api/v1/cost/units",
          "http_method": "GET",
          "path": "/units",
          "input": "-",
          "output": "[]forms.UnitInfo",
          "description": "List all billing units"
        },
        {
          "name": "CreateUnit",
          "name_key": "HTTP POST /api/v1/cost/units",
          "http_method": "POST",
          "path": "/units",
          "input": "forms.UnitInfo",
          "output": "forms.UnitInfo",
          "description": "Create billing unit"
        },
        {
          "name": "GetUnit",
          "name_key": "HTTP GET /api/v1/cost/units/:unit_key",
          "http_method": "GET",
          "path": "/units/:unit_key",
          "input": "uri: unit_key",
          "output": "forms.UnitInfo",
          "description": "Get billing unit by key"
        },
        {
          "name": "UpdateUnit",
          "name_key": "HTTP PUT /api/v1/cost/units/:unit_key",
          "http_method": "PUT",
          "path": "/units/:unit_key",
          "input": "uri: unit_key, body: forms.UnitInfo",
          "output": "forms.UnitInfo",
          "description": "Update billing unit"
        },
        {
          "name": "DeleteUnit",
          "name_key": "HTTP DELETE /api/v1/cost/units/:unit_key",
          "http_method": "DELETE",
          "path": "/units/:unit_key",
          "input": "uri: unit_key",
          "output": "forms.OKType",
          "description": "Delete billing unit"
        }
      ]
    },
    {
      "name": "MetricsEndpoint",
      "type": "http",
      "base_path": "/",
      "methods": [
        {
          "name": "Version",
          "name_key": "HTTP GET /version",
          "http_method": "GET",
          "path": "/version",
          "input": "-",
          "output": "VersionResp",
          "description": "Get service version"
        },
        {
          "name": "PrometheusMetrics",
          "name_key": "HTTP GET /metrics",
          "http_method": "GET",
          "path": "/metrics",
          "input": "-",
          "output": "Prometheus metrics",
          "description": "Prometheus metrics endpoint"
        }
      ]
    },
    {
      "name": "PprofEndpoint",
      "type": "http",
      "base_path": "/debug/pprof",
      "methods": [
        {
          "name": "Index",
          "name_key": "HTTP GET /debug/pprof/",
          "http_method": "GET",
          "path": "/",
          "input": "-",
          "output": "pprof index",
          "description": "pprof index endpoint"
        },
        {
          "name": "Cmdline",
          "name_key": "HTTP GET /debug/pprof/cmdline",
          "http_method": "GET",
          "path": "/cmdline",
          "input": "-",
          "output": "cmdline profile",
          "description": "pprof cmdline endpoint"
        },
        {
          "name": "Profile",
          "name_key": "HTTP GET /debug/pprof/profile",
          "http_method": "GET",
          "path": "/profile",
          "input": "query: seconds",
          "output": "cpu profile",
          "description": "pprof CPU profile endpoint"
        },
        {
          "name": "SymbolPost",
          "name_key": "HTTP POST /debug/pprof/symbol",
          "http_method": "POST",
          "path": "/symbol",
          "input": "body: symbol addresses",
          "output": "symbol resolution",
          "description": "pprof symbol lookup endpoint"
        },
        {
          "name": "SymbolGet",
          "name_key": "HTTP GET /debug/pprof/symbol",
          "http_method": "GET",
          "path": "/symbol",
          "input": "query: symbol addresses",
          "output": "symbol resolution",
          "description": "pprof symbol lookup endpoint"
        },
        {
          "name": "Trace",
          "name_key": "HTTP GET /debug/pprof/trace",
          "http_method": "GET",
          "path": "/trace",
          "input": "query: seconds",
          "output": "execution trace",
          "description": "pprof trace endpoint"
        },
        {
          "name": "Allocs",
          "name_key": "HTTP GET /debug/pprof/allocs",
          "http_method": "GET",
          "path": "/allocs",
          "input": "-",
          "output": "allocs profile",
          "description": "pprof allocs profile endpoint"
        },
        {
          "name": "Block",
          "name_key": "HTTP GET /debug/pprof/block",
          "http_method": "GET",
          "path": "/block",
          "input": "-",
          "output": "block profile",
          "description": "pprof block profile endpoint"
        },
        {
          "name": "Goroutine",
          "name_key": "HTTP GET /debug/pprof/goroutine",
          "http_method": "GET",
          "path": "/goroutine",
          "input": "-",
          "output": "goroutine profile",
          "description": "pprof goroutine profile endpoint"
        },
        {
          "name": "Heap",
          "name_key": "HTTP GET /debug/pprof/heap",
          "http_method": "GET",
          "path": "/heap",
          "input": "-",
          "output": "heap profile",
          "description": "pprof heap profile endpoint"
        },
        {
          "name": "Mutex",
          "name_key": "HTTP GET /debug/pprof/mutex",
          "http_method": "GET",
          "path": "/mutex",
          "input": "-",
          "output": "mutex profile",
          "description": "pprof mutex profile endpoint"
        },
        {
          "name": "Threadcreate",
          "name_key": "HTTP GET /debug/pprof/threadcreate",
          "http_method": "GET",
          "path": "/threadcreate",
          "input": "-",
          "output": "threadcreate profile",
          "description": "pprof threadcreate profile endpoint"
        }
      ]
    },
    {
      "name": "BackgroundWorkers",
      "type": "worker",
      "methods": [
        {
          "name": "SQSMeasureConsumer",
          "name_key": "Runtime SQSMeasureConsumer.processMessages",
          "description": "Consumes cost measurement messages from AWS SQS."
        },
        {
          "name": "SQSDLMeasureConsumer",
          "name_key": "Runtime SQSDLMeasureConsumer.processMessages",
          "description": "Consumes messages from AWS SQS dead-letter queue."
        },
        {
          "name": "CalculateWorker",
          "name_key": "Runtime CalculateWorker.CalculateWorkerFunc",
          "description": "Calculates cost distribution based on measurements every hour."
        }
      ]
    }
  ],
  "extensions": {
    "notes": [
      "cmd/server exposes cost APIs, metrics, and pprof handlers, and starts SQS-backed background workers."
    ]
  }
}
