log

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxLogsListDays = 365

MaxLogsListDays 限制 logs list 的时间窗最大天数 — 防扫表上限。

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct{}

func (*Handler) GetTrace

func (h *Handler) GetTrace(c *app.Context, req TraceRequest) ([]*models.UsageLogTrace, error)

func (*Handler) Insights added in v0.0.2

func (h *Handler) Insights(c *app.Context, req InsightsRequest) (InsightsResponse, error)

Insights 返回 logs 维度的洞察:

  1. totals: total/failed/p95/最慢请求 + 三条 24h spark;
  2. error_by_stage: 失败请求按 stage 分布 (admin-only;user scope 该字段为空)。

窗口超过 logs insights 的本地日容差时返回 400 RangeOutOfBounds (gran=hour 上限 7 天)。

func (*Handler) List

type InsightsRequest added in v0.0.2

type InsightsRequest struct {
	Start int64 `form:"start"`
	End   int64 `form:"end"`
}

InsightsRequest 是 /v1/logs/insights 入参。 start/end 为 unix 秒;end 缺省 now, start 缺省 end-86400。 注意:logs/insights 不接收 gran 参数 —— spark 固定 hour 粒度的最后 24 小时。

type InsightsResponse added in v0.0.2

type InsightsResponse struct {
	Totals       dao.LogsTotals  `json:"totals"`
	ErrorByStage []dao.ErrBucket `json:"error_by_stage"`
}

InsightsResponse 是 /v1/logs/insights 返回。 Totals 包含 total/failed/p95/最慢请求和三条 24-slot spark; ErrorByStage 是 stage 维度的失败分布 (admin-only,user scope 该字段为空)。

type ListRequest

type ListRequest struct {
	api.PaginationQuery
	listfilter.TimeWindowQuery
	UserID           string `form:"user_id"`
	TokenID          string `form:"token_id"`
	ChannelID        string `form:"channel_id"`
	ModelName        string `form:"model_name"`
	Status           string `form:"status"`
	PrivateChannelID string `form:"private_channel_id"`
	RequestID        string `form:"request_id"`
}

type TraceRequest

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

Jump to

Keyboard shortcuts

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