본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

미터링 & 빌링 정책 설정 레퍼런스

원문 보기 위키 갱신

미터링 & 빌링 정책 설정 레퍼런스 (Metering & Billing Policy Configuration Reference)

이 문서는 Kong의 Metering & Billing 정책에서 설정할 수 있는 모든 파라미터를 JSON 스키마 형태로 정리한 설정 레퍼런스예요. ingest 엔드포인트와의 keepalive 유지 시간, 큐의 배치 크기와 재시도 간격 같은 큐 동작 옵션부터 API 요청별 사용량 이벤트 발행 여부, TLS 인증서 검증 설정까지 다뤄요. 각 파라미터의 타입, 기본값, 허용 범위를 한눈에 확인할 수 있어서 정책을 세밀하게 튜닝할 때 참고하기 좋아요.

출처: 문서

본문

{
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "keepalive": {
          "type": "number",
          "description": "How long in milliseconds an idle connection to the ingest endpoint is kept open before being closed.",
          "default": 60000
        },
        "queue": {
          "type": "object",
          "properties": {
            "max_batch_size": {
              "type": "integer",
              "maximum": 1000000,
              "minimum": 1,
              "description": "Maximum number of entries that can be processed at a time.",
              "default": 1
            },
            "max_coalescing_delay": {
              "type": "number",
              "maximum": 3600,
              "minimum": 0,
              "description": "Maximum number of (fractional) seconds to elapse after the first entry was queued before the queue starts calling the handler.",
              "default": 1
            },
            "max_entries": {
              "type": "integer",
              "maximum": 1000000,
              "minimum": 1,
              "description": "Maximum number of entries that can be waiting on the queue.",
              "default": 10000
            },
            "max_bytes": {
              "type": "integer",
              "description": "Maximum number of bytes that can be waiting on a queue, requires string content."
            },
            "max_retry_time": {
              "type": "number",
              "description": "Time in seconds before the queue gives up calling a failed handler for a batch.",
              "default": 60
            },
            "initial_retry_delay": {
              "type": "number",
              "maximum": 1000000,
              "minimum": 0.001,
              "description": "Time in seconds before the initial retry is made for a failing batch.",
              "default": 0.01
            },
            "max_retry_delay": {
              "type": "number",
              "maximum": 1000000,
              "minimum": 0.001,
              "description": "Maximum time in seconds between retries, caps exponential backoff.",
              "default": 60
            },
            "concurrency_limit": {
              "type": "integer",
              "enum": [
                -1,
                1
              ],
              "description": "The number of of queue delivery timers. -1 indicates unlimited.",
              "default": 1
            }
          }
        },
        "meter_api_requests": {
          "type": "boolean",
          "description": "Emit a usage event for each API Gateway request.",
          "default": true
        },
        "ssl_verify": {
          "type": "boolean",
          "description": "Verify the TLS certificate presented by the ingest endpoint.",
          "default": true
        },
        "attributes": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "look_up_value_in": {
                "type": "string",
                "description": "The header name or query parameter that contains the value, e.g 'x-department-id'"
              },
              "event_property_name": {
                "type": "string",
                "description": "The property name in the usage event data payload."
              },
              "source": {
                "type": "string",
                "enum": [
                  "header",
                  "query"
                ],
                "description": "Where to find this attribute in the request."
              }
            },
            "required": [
              "event_property_name",
              "look_up_value_in",
              "source"
            ]
          },
          "description": "Capture custom properties to the usage event data payload for pricing dimensions or reporting. Attributes add dimensions like provider, department or project that your billing model needs for tiered or per-dimension pricing."
        },
        "subject": {
          "type": "object",
          "properties": {
            "look_up_value_in": {
              "type": "string",
              "enum": [
                "application",
                "consumer",
                "header",
                "query"
              ],
              "description": "Where to find the customer identifier in the request.",
              "default": "consumer"
            },
            "field": {
              "type": "string",
              "description": "The header name, query parameter, consumer field, or application field that contains the customer identifier, e.g. 'x-customer-id'"
            }
          },
          "description": "The subject identifies who gets billed for each request. Choose where the policy should look for the customer identifier."
        },
        "meter_ai_token_usage": {
          "type": "boolean",
          "description": "Emit events for LLM input and output tokens on AI Gateway requests.",
          "default": true
        },
        "ingest_endpoint": {
          "type": "string",
          "description": "The HTTP endpoint where usage events are sent.",
          "x-referenceable": true
        },
        "api_token": {
          "type": "string",
          "description": "Bearer token for authenticating with the ingest endpoint.",
          "x-encrypted": true,
          "x-referenceable": true
        },
        "timeout": {
          "type": "number",
          "description": "Maximum time in milliseconds to wait for a response from the ingest endpoint.",
          "default": 10000
        }
      },
      "required": [
        "api_token",
        "ingest_endpoint"
      ]
    }
  }
}

관련 리소스

더 알아보기 (Learn more)