mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
docs(swagger): update API documentation for log endpoints
Add new response types and parameters for logs API: - Add GroupedStatsItem and GroupedStatsResponse definitions - Add ListLogsResponse and LogView definitions for detailed log records - Add group_by enum parameter (model/day/month) to stats endpoint - Update endpoint descriptions to clarify response types and request_body inclusion - Update response schema references to use correct types
This commit is contained in:
140
docs/docs.go
140
docs/docs.go
@@ -861,7 +861,7 @@ const docTemplate = `{
|
|||||||
"AdminAuth": []
|
"AdminAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "List request logs with basic filtering/pagination",
|
"description": "List request logs with basic filtering/pagination. Returns full log records including request_body.",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -923,7 +923,7 @@ const docTemplate = `{
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/internal_api.ListMasterLogsResponse"
|
"$ref": "#/definitions/internal_api.ListLogsResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"500": {
|
"500": {
|
||||||
@@ -991,7 +991,7 @@ const docTemplate = `{
|
|||||||
"AdminAuth": []
|
"AdminAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Aggregate log stats with basic filtering",
|
"description": "Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse.",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1011,13 +1011,24 @@ const docTemplate = `{
|
|||||||
"description": "unix seconds",
|
"description": "unix seconds",
|
||||||
"name": "until",
|
"name": "until",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"model",
|
||||||
|
"day",
|
||||||
|
"month"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "group by dimension: model, day, month. Returns GroupedStatsResponse when specified.",
|
||||||
|
"name": "group_by",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "Grouped stats (when group_by is specified)",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/internal_api.LogStatsResponse"
|
"$ref": "#/definitions/internal_api.GroupedStatsResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"500": {
|
"500": {
|
||||||
@@ -4175,6 +4186,46 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.GroupedStatsItem": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"avg_latency_ms": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"count": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"date": {
|
||||||
|
"description": "For group_by=day",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"description": "For group_by=model",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"month": {
|
||||||
|
"description": "For group_by=month",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tokens_in": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tokens_out": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"internal_api.GroupedStatsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/internal_api.GroupedStatsItem"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.IssueChildKeyRequest": {
|
"internal_api.IssueChildKeyRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -4215,6 +4266,26 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.ListLogsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/internal_api.LogView"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"limit": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"offset": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.ListMasterLogsResponse": {
|
"internal_api.ListMasterLogsResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -4259,6 +4330,65 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.LogView": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"audit_reason": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"client_ip": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"error_message": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"key_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"latency_ms": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"provider_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"provider_type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"request_body": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"request_size": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"response_size": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"status_code": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tokens_in": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tokens_out": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.ManageMasterRequest": {
|
"internal_api.ManageMasterRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
@@ -855,7 +855,7 @@
|
|||||||
"AdminAuth": []
|
"AdminAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "List request logs with basic filtering/pagination",
|
"description": "List request logs with basic filtering/pagination. Returns full log records including request_body.",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -917,7 +917,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/internal_api.ListMasterLogsResponse"
|
"$ref": "#/definitions/internal_api.ListLogsResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"500": {
|
"500": {
|
||||||
@@ -985,7 +985,7 @@
|
|||||||
"AdminAuth": []
|
"AdminAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Aggregate log stats with basic filtering",
|
"description": "Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse.",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -1005,13 +1005,24 @@
|
|||||||
"description": "unix seconds",
|
"description": "unix seconds",
|
||||||
"name": "until",
|
"name": "until",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"model",
|
||||||
|
"day",
|
||||||
|
"month"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "group by dimension: model, day, month. Returns GroupedStatsResponse when specified.",
|
||||||
|
"name": "group_by",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "Grouped stats (when group_by is specified)",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/internal_api.LogStatsResponse"
|
"$ref": "#/definitions/internal_api.GroupedStatsResponse"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"500": {
|
"500": {
|
||||||
@@ -4169,6 +4180,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.GroupedStatsItem": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"avg_latency_ms": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"count": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"date": {
|
||||||
|
"description": "For group_by=day",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"description": "For group_by=model",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"month": {
|
||||||
|
"description": "For group_by=month",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tokens_in": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tokens_out": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"internal_api.GroupedStatsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/internal_api.GroupedStatsItem"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.IssueChildKeyRequest": {
|
"internal_api.IssueChildKeyRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -4209,6 +4260,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.ListLogsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"items": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/internal_api.LogView"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"limit": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"offset": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"total": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.ListMasterLogsResponse": {
|
"internal_api.ListMasterLogsResponse": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -4253,6 +4324,65 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"internal_api.LogView": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"audit_reason": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"client_ip": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"created_at": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"error_message": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"key_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"latency_ms": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"provider_id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"provider_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"provider_type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"request_body": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"request_size": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"response_size": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"status_code": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tokens_in": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"tokens_out": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"internal_api.ManageMasterRequest": {
|
"internal_api.ManageMasterRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|||||||
@@ -417,6 +417,33 @@ definitions:
|
|||||||
deleted_count:
|
deleted_count:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
internal_api.GroupedStatsItem:
|
||||||
|
properties:
|
||||||
|
avg_latency_ms:
|
||||||
|
type: number
|
||||||
|
count:
|
||||||
|
type: integer
|
||||||
|
date:
|
||||||
|
description: For group_by=day
|
||||||
|
type: string
|
||||||
|
model:
|
||||||
|
description: For group_by=model
|
||||||
|
type: string
|
||||||
|
month:
|
||||||
|
description: For group_by=month
|
||||||
|
type: string
|
||||||
|
tokens_in:
|
||||||
|
type: integer
|
||||||
|
tokens_out:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
|
internal_api.GroupedStatsResponse:
|
||||||
|
properties:
|
||||||
|
items:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/internal_api.GroupedStatsItem'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
internal_api.IssueChildKeyRequest:
|
internal_api.IssueChildKeyRequest:
|
||||||
properties:
|
properties:
|
||||||
allow_ips:
|
allow_ips:
|
||||||
@@ -443,6 +470,19 @@ definitions:
|
|||||||
tokens:
|
tokens:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
internal_api.ListLogsResponse:
|
||||||
|
properties:
|
||||||
|
items:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/internal_api.LogView'
|
||||||
|
type: array
|
||||||
|
limit:
|
||||||
|
type: integer
|
||||||
|
offset:
|
||||||
|
type: integer
|
||||||
|
total:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
internal_api.ListMasterLogsResponse:
|
internal_api.ListMasterLogsResponse:
|
||||||
properties:
|
properties:
|
||||||
items:
|
items:
|
||||||
@@ -472,6 +512,45 @@ definitions:
|
|||||||
total:
|
total:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
internal_api.LogView:
|
||||||
|
properties:
|
||||||
|
audit_reason:
|
||||||
|
type: string
|
||||||
|
client_ip:
|
||||||
|
type: string
|
||||||
|
created_at:
|
||||||
|
type: integer
|
||||||
|
error_message:
|
||||||
|
type: string
|
||||||
|
group:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
key_id:
|
||||||
|
type: integer
|
||||||
|
latency_ms:
|
||||||
|
type: integer
|
||||||
|
model:
|
||||||
|
type: string
|
||||||
|
provider_id:
|
||||||
|
type: integer
|
||||||
|
provider_name:
|
||||||
|
type: string
|
||||||
|
provider_type:
|
||||||
|
type: string
|
||||||
|
request_body:
|
||||||
|
type: string
|
||||||
|
request_size:
|
||||||
|
type: integer
|
||||||
|
response_size:
|
||||||
|
type: integer
|
||||||
|
status_code:
|
||||||
|
type: integer
|
||||||
|
tokens_in:
|
||||||
|
type: integer
|
||||||
|
tokens_out:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
internal_api.ManageMasterRequest:
|
internal_api.ManageMasterRequest:
|
||||||
properties:
|
properties:
|
||||||
action:
|
action:
|
||||||
@@ -1426,7 +1505,8 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- admin
|
- admin
|
||||||
get:
|
get:
|
||||||
description: List request logs with basic filtering/pagination
|
description: List request logs with basic filtering/pagination. Returns full
|
||||||
|
log records including request_body.
|
||||||
parameters:
|
parameters:
|
||||||
- description: limit (default 50, max 200)
|
- description: limit (default 50, max 200)
|
||||||
in: query
|
in: query
|
||||||
@@ -1466,7 +1546,7 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/internal_api.ListMasterLogsResponse'
|
$ref: '#/definitions/internal_api.ListLogsResponse'
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
@@ -1478,7 +1558,9 @@ paths:
|
|||||||
- admin
|
- admin
|
||||||
/admin/logs/stats:
|
/admin/logs/stats:
|
||||||
get:
|
get:
|
||||||
description: Aggregate log stats with basic filtering
|
description: Aggregate log stats with basic filtering. Use group_by param for
|
||||||
|
grouped statistics (model/day/month). Without group_by returns LogStatsResponse;
|
||||||
|
with group_by returns GroupedStatsResponse.
|
||||||
parameters:
|
parameters:
|
||||||
- description: unix seconds
|
- description: unix seconds
|
||||||
in: query
|
in: query
|
||||||
@@ -1488,13 +1570,22 @@ paths:
|
|||||||
in: query
|
in: query
|
||||||
name: until
|
name: until
|
||||||
type: integer
|
type: integer
|
||||||
|
- description: 'group by dimension: model, day, month. Returns GroupedStatsResponse
|
||||||
|
when specified.'
|
||||||
|
enum:
|
||||||
|
- model
|
||||||
|
- day
|
||||||
|
- month
|
||||||
|
in: query
|
||||||
|
name: group_by
|
||||||
|
type: string
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: Grouped stats (when group_by is specified)
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/internal_api.LogStatsResponse'
|
$ref: '#/definitions/internal_api.GroupedStatsResponse'
|
||||||
"500":
|
"500":
|
||||||
description: Internal Server Error
|
description: Internal Server Error
|
||||||
schema:
|
schema:
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ func (h *MasterHandler) masterLogBase(masterID uint) (*gorm.DB, error) {
|
|||||||
|
|
||||||
// ListLogs godoc
|
// ListLogs godoc
|
||||||
// @Summary List logs (admin)
|
// @Summary List logs (admin)
|
||||||
// @Description List request logs with basic filtering/pagination
|
// @Description List request logs with basic filtering/pagination. Returns full log records including request_body.
|
||||||
// @Tags admin
|
// @Tags admin
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Security AdminAuth
|
// @Security AdminAuth
|
||||||
@@ -167,7 +167,7 @@ func (h *MasterHandler) masterLogBase(masterID uint) (*gorm.DB, error) {
|
|||||||
// @Param group query string false "route group"
|
// @Param group query string false "route group"
|
||||||
// @Param model query string false "model"
|
// @Param model query string false "model"
|
||||||
// @Param status_code query int false "status code"
|
// @Param status_code query int false "status code"
|
||||||
// @Success 200 {object} ListMasterLogsResponse
|
// @Success 200 {object} ListLogsResponse
|
||||||
// @Failure 500 {object} gin.H
|
// @Failure 500 {object} gin.H
|
||||||
// @Router /admin/logs [get]
|
// @Router /admin/logs [get]
|
||||||
func (h *Handler) ListLogs(c *gin.Context) {
|
func (h *Handler) ListLogs(c *gin.Context) {
|
||||||
@@ -346,14 +346,15 @@ func (h *Handler) deleteLogsBefore(cutoff time.Time, keyID uint, modelName strin
|
|||||||
|
|
||||||
// LogStats godoc
|
// LogStats godoc
|
||||||
// @Summary Log stats (admin)
|
// @Summary Log stats (admin)
|
||||||
// @Description Aggregate log stats with basic filtering. Use group_by param for grouped statistics.
|
// @Description Aggregate log stats with basic filtering. Use group_by param for grouped statistics (model/day/month). Without group_by returns LogStatsResponse; with group_by returns GroupedStatsResponse.
|
||||||
// @Tags admin
|
// @Tags admin
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Security AdminAuth
|
// @Security AdminAuth
|
||||||
// @Param since query int false "unix seconds"
|
// @Param since query int false "unix seconds"
|
||||||
// @Param until query int false "unix seconds"
|
// @Param until query int false "unix seconds"
|
||||||
// @Param group_by query string false "group by dimension: model, day, month"
|
// @Param group_by query string false "group by dimension: model, day, month. Returns GroupedStatsResponse when specified." Enums(model, day, month)
|
||||||
// @Success 200 {object} LogStatsResponse
|
// @Success 200 {object} LogStatsResponse "Default aggregated stats (when group_by is not specified)"
|
||||||
|
// @Success 200 {object} GroupedStatsResponse "Grouped stats (when group_by is specified)"
|
||||||
// @Failure 500 {object} gin.H
|
// @Failure 500 {object} gin.H
|
||||||
// @Router /admin/logs/stats [get]
|
// @Router /admin/logs/stats [get]
|
||||||
func (h *Handler) LogStats(c *gin.Context) {
|
func (h *Handler) LogStats(c *gin.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user