analytics

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package analytics defines the dashboard snapshot independently of HTTP DTOs.

Index

Constants

View Source
const MaxCount int64 = 1<<53 - 1

Variables

This section is empty.

Functions

func Invalid

func Invalid(name string) error

Types

type Bucket

type Bucket struct {
	From      time.Time    `json:"from"`
	To        time.Time    `json:"to"`
	RunsCount int64        `json:"runs_count"`
	ByStatus  StatusCounts `json:"by_status"`
}

type Namespace added in v0.2.3

type Namespace struct {
	Namespace      *string      `json:"namespace"`
	RunsCount      int64        `json:"runs_count"`
	ByStatus       StatusCounts `json:"by_status"`
	Usage          Usage        `json:"usage"`
	RuntimeSeconds float64      `json:"runtime_seconds"`
}

Namespace holds the period totals of runs whose session has this namespace.

type Overview

type Overview struct {
	AsOf      time.Time `json:"as_of"`
	From      time.Time `json:"from"`
	To        time.Time `json:"to"`
	Bucket    string    `json:"bucket"`
	Timezone  string    `json:"timezone"`
	Namespace *string   `json:"namespace"`
	Current   struct {
		ActiveSessions int64 `json:"active_sessions"`
	} `json:"current"`
	Period struct {
		RunsCount      int64        `json:"runs_count"`
		ByStatus       StatusCounts `json:"by_status"`
		Usage          Usage        `json:"usage"`
		RuntimeSeconds float64      `json:"runtime_seconds"`
	} `json:"period"`
	Series     []Bucket    `json:"series"`
	Namespaces []Namespace `json:"namespaces"`
}

type Query

type Query struct {
	AsOf      time.Time
	From      time.Time
	To        time.Time
	Bucket    string
	Timezone  string
	Namespace *string
}

type Request

type Request struct {
	Window    string
	From      *time.Time
	To        *time.Time
	Bucket    string
	Timezone  string
	Namespace *string
}

func (Request) Resolve

func (r Request) Resolve(asOf time.Time) (Query, error)

type StatusCounts

type StatusCounts struct {
	Accepted   int64 `json:"accepted"`
	Starting   int64 `json:"starting"`
	Running    int64 `json:"running"`
	Cancelling int64 `json:"cancelling"`
	Finalizing int64 `json:"finalizing"`
	Completed  int64 `json:"completed"`
	Failed     int64 `json:"failed"`
	Cancelled  int64 `json:"cancelled"`
}

func (*StatusCounts) Add

func (s *StatusCounts) Add(v StatusCounts)

type Usage

type Usage struct {
	InputTokens           string `json:"input_tokens"`
	CachedInputTokens     string `json:"cached_input_tokens"`
	OutputTokens          string `json:"output_tokens"`
	ReasoningOutputTokens string `json:"reasoning_output_tokens"`
	TotalTokens           string `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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