api_request_log

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	UserID        string `form:"user_id"`
	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 LogResponse added in v0.0.23

type LogResponse struct {
	models.APIRequestLog
	HasTrace bool `json:"has_trace"`
}

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"`
	HasTrace          bool   `json:"has_trace"`
	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