api_request_log

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	App app.Application
}

func (*Handler) Get

func (*Handler) GetTrace

func (*Handler) List

func (*Handler) PortalGet

func (h *Handler) PortalGet(c *app.Context, req RequestIDRequest) (PortalLogResponse, error)

func (*Handler) PortalGetTrace

func (h *Handler) PortalGetTrace(c *app.Context, req RequestIDRequest) (models.APIRequestTrace, error)

func (*Handler) PortalList

type ListRequest

type ListRequest struct {
	api.PaginationQuery
	listfilter.TimeWindowQuery
	APIServiceID  *uint  `form:"api_service_id"`
	APIRouteID    *uint  `form:"api_route_id"`
	APIUpstreamID *uint  `form:"api_upstream_id"`
	TokenID       string `form:"token_id"`
	StatusCode    string `form:"status_code"`
	RequestID     string `form:"request_id"`
}

type PortalListRequest

type PortalListRequest struct {
	api.PaginationQuery
	listfilter.TimeWindowQuery
	TokenID    string `form:"token_id"`
	StatusCode string `form:"status_code"`
	RequestID  string `form:"request_id"`
}

PortalListRequest only exposes filters that cannot select internal routing infrastructure. Portal handlers always add the authenticated user's ID.

type PortalLogResponse

type PortalLogResponse struct {
	ID        uint   `json:"id"`
	RequestID string `json:"request_id"`
	TokenID   uint   `json:"token_id"`
	TokenName string `json:"token_name"`

	APIServiceID   uint   `json:"api_service_id"`
	APIServiceName string `json:"api_service_name"`
	APIRouteID     uint   `json:"api_route_id"`
	APIRouteName   string `json:"api_route_name"`

	Protocol models.APIProtocol `json:"protocol"`
	Method   string             `json:"method"`
	Subpath  string             `json:"subpath"`

	StatusCode         int   `json:"status_code"`
	DurationMs         int   `json:"duration_ms"`
	FirstByteMs        int   `json:"first_byte_ms"`
	RequestBytes       int64 `json:"request_bytes"`
	ResponseBytes      int64 `json:"response_bytes"`
	WebSocketCloseCode *int  `json:"websocket_close_code"`

	QuotaGateDecision string `json:"quota_gate_decision"`
	ErrorStage        string `json:"error_stage"`
	ErrorCode         string `json:"error_code"`
	RateLimitDecision string `json:"rate_limit_decision"`
	RateLimitWaitMs   int    `json:"rate_limit_wait_ms"`
	UnitPrice         int64  `json:"unit_price"`
	TotalCost         int64  `json:"total_cost"`
	CreatedAt         int64  `json:"created_at"`
}

PortalLogResponse is the ordinary-user projection of an API request log. Internal upstream and Agent routing facts are intentionally absent.

type RequestIDRequest

type RequestIDRequest struct {
	RequestID string `uri:"request_id" form:"request_id" binding:"required"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL