coremetrics

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 14 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

Overview

Package coremetrics collects bounded operational measurements for administrators.

Index

Constants

View Source
const SampleInterval = 30 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	PingMS    Latency          `json:"ping_ms"`
	Pool      Pool             `json:"pool"`
	SizeBytes *int64           `json:"size_bytes" extensions:"x-nullable"`
	Series    []DatabaseBucket `json:"series"`
}

type DatabaseBucket

type DatabaseBucket struct {
	Start     time.Time `json:"start"`
	PingP95MS *float64  `json:"ping_p95_ms" extensions:"x-nullable"`
	PoolInUse *int64    `json:"pool_in_use" extensions:"x-nullable"`
}

type Execution

type Execution struct {
	SlotsInUse          *int64            `json:"slots_in_use" extensions:"x-nullable"`
	SlotsTotal          *int64            `json:"slots_total" extensions:"x-nullable"`
	QueuedTurns         *int64            `json:"queued_turns" extensions:"x-nullable"`
	WaitingForDaemon    *int64            `json:"waiting_for_daemon" extensions:"x-nullable"`
	InProgressTurns     *int64            `json:"in_progress_turns" extensions:"x-nullable"`
	OldestQueuedSeconds *float64          `json:"oldest_queued_seconds" extensions:"x-nullable"`
	ConnectedDaemons    *int64            `json:"connected_daemons" extensions:"x-nullable"`
	Interrupted         *int64            `json:"interrupted" extensions:"x-nullable"`
	Unavailable         *int64            `json:"unavailable" extensions:"x-nullable"`
	QueueWaitMS         Latency           `json:"queue_wait_ms"`
	Series              []ExecutionBucket `json:"series"`
}

type ExecutionBucket

type ExecutionBucket struct {
	Start          time.Time `json:"start"`
	Queued         *int64    `json:"queued" extensions:"x-nullable"`
	InProgress     *int64    `json:"in_progress" extensions:"x-nullable"`
	QueueWaitP95MS *float64  `json:"queue_wait_p95_ms" extensions:"x-nullable"`
}

type History

type History struct {
	Interrupted int64
	QueueWaitMS Latency
	Buckets     map[time.Time]*float64
}

type Job

type Job struct {
	ID        string     `json:"id"`
	Status    string     `json:"status"`
	LastRunAt *time.Time `json:"last_run_at" extensions:"x-nullable"`
	Processed *int64     `json:"processed" extensions:"x-nullable"`
	Failed    *int64     `json:"failed" extensions:"x-nullable"`
}

type Latency

type Latency struct {
	P50 *float64 `json:"p50" extensions:"x-nullable"`
	P95 *float64 `json:"p95" extensions:"x-nullable"`
}

type Live

type Live struct {
	SlotsInUse, SlotsTotal, ConnectedDaemons *int64
	ExecutionOwner                           *bool
	Pool                                     Pool
	Scheduler                                Job
}

type Pool

type Pool struct {
	InUse *int64 `json:"in_use" extensions:"x-nullable"`
	Idle  *int64 `json:"idle" extensions:"x-nullable"`
	Max   *int64 `json:"max" extensions:"x-nullable"`
}

type Process

type Process struct {
	MemoryBytes      *uint64         `json:"memory_bytes" extensions:"x-nullable"`
	Goroutines       *int64          `json:"goroutines" extensions:"x-nullable"`
	CPUCores         *float64        `json:"cpu_cores" extensions:"x-nullable"`
	CPULimitCores    *float64        `json:"cpu_limit_cores" extensions:"x-nullable"`
	RSSBytes         *uint64         `json:"rss_bytes" extensions:"x-nullable"`
	MemoryLimitBytes *uint64         `json:"memory_limit_bytes" extensions:"x-nullable"`
	Series           []ProcessBucket `json:"series"`
}

type ProcessBucket

type ProcessBucket struct {
	Start    time.Time `json:"start"`
	CPUCores *float64  `json:"cpu_cores" extensions:"x-nullable"`
	RSSBytes *uint64   `json:"rss_bytes" extensions:"x-nullable"`
}

type Range

type Range struct {
	Start             time.Time `json:"start"`
	End               time.Time `json:"end"`
	ResolutionSeconds int64     `json:"resolution_seconds"`
}

func Window

func Window(now time.Time, name string) (Range, error)

type Sample

type Sample struct {
	At                                   time.Time
	Queued, WaitingForDaemon, InProgress *int64
	OldestQueuedSeconds                  *float64
	PingMS                               *float64
	PoolInUse, DatabaseSize              *int64
	Healthy                              bool
	Process                              Process
}

Sample contains only measurements, never resource identities or error text.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(started time.Time, revision string, source Source) *Service

func (*Service) Read

func (s *Service) Read(ctx context.Context, name string) (View, error)

func (*Service) RecordUnavailable

func (s *Service) RecordUnavailable()

RecordUnavailable is called only when Core emits this exact rejection code. Fixed slots bound memory independently of request volume.

func (*Service) ReportJob

func (s *Service) ReportJob(id string, at time.Time, processed *int64, failed *int64, err error)

func (*Service) Run

func (s *Service) Run(ctx context.Context)

func (*Service) StopJob

func (s *Service) StopJob(id string)

type ServiceState

type ServiceState struct {
	Status         string     `json:"status"`
	Revision       *string    `json:"revision" extensions:"x-nullable"`
	StartedAt      *time.Time `json:"started_at" extensions:"x-nullable"`
	ExecutionOwner *bool      `json:"execution_owner" extensions:"x-nullable"`
}

type Source

type Source interface {
	Sample(context.Context) Sample
	History(context.Context, time.Time, time.Time, time.Duration) (History, error)
	Live() Live
}

type View

type View struct {
	Object    string       `json:"object"`
	Range     Range        `json:"range"`
	Service   ServiceState `json:"service"`
	Execution Execution    `json:"execution"`
	Database  Database     `json:"database"`
	Jobs      []Job        `json:"jobs"`
	Process   Process      `json:"process"`
}

Jump to

Keyboard shortcuts

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