Documentation
¶
Index ¶
- func RequestUsageQuery(dbName, where string) string
- func ServersQuery(dbName, where string) string
- func WhereClause(scope QueryScope, extraConditions ...string) (string, []any)
- type ActorUsage
- type DecisionUsage
- type PrincipalScope
- type QueryScope
- type RecentActivity
- type RequestUsage
- type ServerUsage
- type Service
- type TimePoint
- type ToolUsage
- type Totals
- type UsageFacets
- type UsageFilters
- type UsageResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestUsageQuery ¶
func ServersQuery ¶
func WhereClause ¶
func WhereClause(scope QueryScope, extraConditions ...string) (string, []any)
Types ¶
type ActorUsage ¶
type DecisionUsage ¶
type PrincipalScope ¶
func PrincipalOwnedScope ¶
func PrincipalOwnedScope(p passport.Principal) PrincipalScope
type QueryScope ¶
type QueryScope struct {
AgentID string
Since time.Time
WindowDays int
Limit int
Namespaces []string
TeamIDs []string
Server string
Decision string
ToolName string
Until time.Time
RPCMethod string
PolicyVersion string
Scope string
HTTPStatus string
Admin bool
}
func (QueryScope) Filters ¶
func (scope QueryScope) Filters() UsageFilters
type RecentActivity ¶
type RecentActivity struct {
Timestamp time.Time `json:"timestamp"`
Server string `json:"server,omitempty"`
Namespace string `json:"namespace,omitempty"`
TeamID string `json:"team_id,omitempty"`
HumanID string `json:"human_id,omitempty"`
AgentID string `json:"agent_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Decision string `json:"decision,omitempty"`
ToolName string `json:"tool_name,omitempty"`
EventType string `json:"event_type,omitempty"`
}
type RequestUsage ¶
type RequestUsage struct {
Server string `json:"server"`
Namespace string `json:"namespace"`
TeamID string `json:"team_id,omitempty"`
RPCMethod string `json:"rpc_method"`
ToolName string `json:"tool_name,omitempty"`
Decision string `json:"decision"`
PolicyVersion string `json:"policy_version,omitempty"`
Events uint64 `json:"events"`
HTTPFailures uint64 `json:"http_failures"`
P95LatencyMS float64 `json:"p95_latency_ms"`
LastSeen time.Time `json:"last_seen"`
TraceID string `json:"trace_id,omitempty"`
}
RequestUsage groups actual gateway events; no tool arguments or results are returned.
type ServerUsage ¶
type ServerUsage struct {
Server string `json:"server"`
Namespace string `json:"namespace"`
TeamID string `json:"team_id,omitempty"`
Events uint64 `json:"events"`
Allowed uint64 `json:"allowed"`
Denied uint64 `json:"denied"`
UniqueHumans uint64 `json:"unique_humans"`
UniqueAgents uint64 `json:"unique_agents"`
LastSeen time.Time `json:"last_seen"`
}
type Service ¶
type Service struct {
DB clickhouse.Conn
DBName string
Resolver identity.Resolver
}
func (*Service) HandleAdminUsage ¶
func (s *Service) HandleAdminUsage(w http.ResponseWriter, r *http.Request)
func (*Service) HandleUserUsage ¶
func (s *Service) HandleUserUsage(w http.ResponseWriter, r *http.Request)
type Totals ¶
type Totals struct {
Events uint64 `json:"events"`
Allowed uint64 `json:"allowed"`
Denied uint64 `json:"denied"`
UniqueServers uint64 `json:"unique_servers"`
UniqueHumans uint64 `json:"unique_humans"`
UniqueAgents uint64 `json:"unique_agents"`
UniqueSessions uint64 `json:"unique_sessions"`
HTTPFailures uint64 `json:"http_failures"`
ServerErrors uint64 `json:"server_errors"`
AverageLatencyMS float64 `json:"average_latency_ms"`
P95LatencyMS float64 `json:"p95_latency_ms"`
BytesIn uint64 `json:"bytes_in"`
BytesOut uint64 `json:"bytes_out"`
}
type UsageFacets ¶
type UsageFilters ¶
type UsageFilters struct {
AgentID string `json:"agent_id,omitempty"`
Namespaces []string `json:"namespaces,omitempty"`
TeamIDs []string `json:"team_ids,omitempty"`
Server string `json:"server,omitempty"`
Decision string `json:"decision,omitempty"`
ToolName string `json:"tool_name,omitempty"`
RPCMethod string `json:"rpc_method,omitempty"`
PolicyVersion string `json:"policy_version,omitempty"`
Scope string `json:"scope,omitempty"`
HTTPStatus string `json:"http_status,omitempty"`
}
type UsageResponse ¶
type UsageResponse struct {
Totals Totals `json:"totals"`
Servers []ServerUsage `json:"servers"`
Actors []ActorUsage `json:"actors"`
Tools []ToolUsage `json:"tools"`
Decisions []DecisionUsage `json:"decisions"`
Series []TimePoint `json:"series,omitempty"`
Recent []RecentActivity `json:"recent,omitempty"`
WindowDays int `json:"window_days"`
Filters UsageFilters `json:"filters,omitempty"`
Requests []RequestUsage `json:"requests,omitempty"`
Facets *UsageFacets `json:"facets,omitempty"`
BucketSeconds int `json:"bucket_seconds"`
WindowStart time.Time `json:"window_start"`
WindowEnd time.Time `json:"window_end"`
}
Click to show internal directories.
Click to hide internal directories.