Documentation
¶
Overview ¶
Package telemetry is the metrics Pando exports about itself (R-399, issue #126): pushed over OTLP to a collector the operator names, stored, graphed and alerted on there and nowhere in Pando (R-016, R-245).
Every recording goes through a function here that takes typed, bounded values — an outcome, a route pattern, a kind of principal — and no free-form attributes. That is R-400's mechanism: there is no way to hand this package a user ID, a token ID or an app ID, so no metric can carry one, and TestR400_NoMetricNamesAPersonTokenOrApp checks what comes out.
Until Install is called every function records into a no-op, which is what an install with no endpoint configured runs on.
Index ¶
- Constants
- Variables
- func Build(ctx context.Context, o Outcome, d time.Duration)
- func Deploy(ctx context.Context, o Outcome, d time.Duration)
- func Detection(ctx context.Context, o Outcome, d time.Duration)
- func HTTPRequest(ctx context.Context, method, route string, status int, d time.Duration)
- func Install(provider metric.MeterProvider, sources Sources) error
- func ProxyRequest(ctx context.Context, allowed bool, kind string)
- func Reconcile(ctx context.Context, o Outcome, d time.Duration)
- func Reset()
- func RetentionPass(ctx context.Context, job RetentionJob, o Outcome, d time.Duration)
- func RetentionRemoved(ctx context.Context, kind string, n int64)
- func Start(ctx context.Context, cfg config.Metrics, process Process, sources Sources) (func(context.Context) error, error)
- type AdapterHealth
- type Outcome
- type Process
- type RetentionJob
- type Sources
Constants ¶
const ScopeName = "github.com/trypando/pando"
ScopeName is the instrumentation scope every Pando metric is recorded under.
Variables ¶
var AttributeKeys = []string{
keyOutcome, keyDecision, keyPrincipalKind, keyCategory, keyAdapter, keyKind, keyJob,
keyMethod, keyRoute, keyStatus, keyConnState,
}
AttributeKeys is every attribute key a Pando metric may carry (R-400).
Functions ¶
func HTTPRequest ¶
HTTPRequest records one request to Pando's own API or console. route is the router's pattern, such as /api/v1/apps/{id}, never the path: a path carries IDs (R-400). Empty means no route matched.
func Install ¶
func Install(provider metric.MeterProvider, sources Sources) error
Install records every metric from here on into provider, and registers sources to be read at each collection. It replaces whatever was installed before, which tests rely on.
func ProxyRequest ¶
ProxyRequest records one request to an app through the proxy. kind is the kind of principal — user, token, anonymous — never which one (R-400), and no app is named: the count is install-wide.
func RetentionPass ¶
RetentionPass records one pass of a retention job.
func RetentionRemoved ¶
RetentionRemoved records rows of one kind the retention job removed. kind is the kind of row, such as deployments or sessions.
func Start ¶
func Start(ctx context.Context, cfg config.Metrics, process Process, sources Sources) (func(context.Context) error, error)
Start exports metrics over OTLP as cfg says, and returns what stops it, flushing what was recorded since the last push. With no endpoint configured it does nothing and returns a no-op.
Types ¶
type AdapterHealth ¶
type AdapterHealth struct {
Category string // an adapter category, such as runtime
ID string // the adapter's configured ID, such as docker
Healthy bool
}
AdapterHealth is one adapter's last health check.
type Process ¶
type Process struct {
Version string // the build's version
// Replica is this replica's ID, as the console's list of replicas
// shows it: service.instance.id.
Replica string
// Hostname is the container's or pod's: host.name.
Hostname string
}
Process names this Pando process to the collector. Neither field is a person, a token or an app (R-400).
type RetentionJob ¶
type RetentionJob string
RetentionJob is which retention job passed.
const ( // RetentionAudit archives and drops months of the audit log (R-347). RetentionAudit RetentionJob = "audit" // RetentionRows removes old rows from every other table (R-224). RetentionRows RetentionJob = "rows" )
type Sources ¶
type Sources struct {
// Pool is the database pool's connections: in use, idle and the most
// it may open.
Pool func() (used, idle, max int64)
// Detections is how many detections this replica is running now.
Detections func() int64
// Adapters is each adapter's health as last checked, true for healthy.
Adapters func() []AdapterHealth
}
Sources are the readings taken when metrics are collected, rather than recorded as things happen. Any may be nil.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package telemetrytest reads back what Pando recorded, for tests asserting that a piece of work is measured (R-399).
|
Package telemetrytest reads back what Pando recorded, for tests asserting that a piece of work is measured (R-399). |