Documentation
¶
Overview ¶
Package telemetry wires traces, metrics and logs to an OTLP endpoint (ADR-008: "OTLP everywhere, no proprietary protocol").
The endpoint can come from the standard OTEL_* variables (the one deliberate exception to the AKERDOCK_* prefix, instance-config §2.4) OR from the instance settings stored in the database (encrypted, §14.2). The caller resolves which and hands a Config to Init; the settings-driven config takes effect at the next restart, since Init runs once at boot.
With no endpoint and no Prometheus scrape, nothing is exported and nothing is attempted — no background retry, no repeated warning in the logs of the (many) instances that will never run a collector.
Index ¶
- func ScopeName() string
- func SpanError(span trace.Span, err error)
- type Config
- type Metrics
- func (m *Metrics) RecordAction(ctx context.Context, action, actor, result string)
- func (m *Metrics) RecordDeployment(ctx context.Context, status string, seconds float64)
- func (m *Metrics) RecordDockerOp(ctx context.Context, method, outcome string)
- func (m *Metrics) RecordJob(ctx context.Context, jobType, status string, seconds float64)
- type Telemetry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Endpoint is the OTLP collector URL (scheme decides TLS); empty disables OTLP.
Endpoint string `json:"endpoint"`
// Protocol is "http" (default) or "grpc".
Protocol string `json:"protocol"`
// Headers are sent on every export (e.g. an auth token).
Headers map[string]string `json:"headers,omitempty"`
// Which signals to export.
Traces bool `json:"traces"`
Metrics bool `json:"metrics"`
Logs bool `json:"logs"`
// PromEnabled exposes the local /metrics scrape; from env, never persisted.
PromEnabled bool `json:"-"`
}
Config is the resolved OTLP export configuration handed to Init. It carries json tags because it is exactly what the instance settings persist (encrypted).
type Metrics ¶
type Metrics struct {
JobsCompleted metric.Int64Counter
JobDuration metric.Float64Histogram
DeploymentsTotal metric.Int64Counter
DeploymentLatency metric.Float64Histogram
// ActionsTotal counts every audited action (the chokepoint every mutation
// passes through), by action name, actor kind and result — the product-wide
// "what happened" counter.
ActionsTotal metric.Int64Counter
// DockerOps counts every typed command sent on an agent channel
// (ADR-052), by method and outcome — the migration's health signal.
DockerOps metric.Int64Counter
}
Metrics are the instruments the control plane reports. They are created once and reused: a metric created per call would leak an instrument per call.
func NewMetrics ¶
NewMetrics builds the instruments. Errors are folded into no-ops rather than returned: a broken instrument must not break a deployment.
func (*Metrics) RecordAction ¶
RecordAction reports one audited action — the single instrument behind "instrument every AkerDock action", fed from the audit chokepoint.
func (*Metrics) RecordDeployment ¶
RecordDeployment reports one terminal deployment.
func (*Metrics) RecordDockerOp ¶
RecordDockerOp reports one typed command sent on an agent channel (ADR-052): the migration's health signal, by method and outcome ("ok" or the wire error code).
type Telemetry ¶
type Telemetry struct {
Tracer trace.Tracer
Meter metric.Meter
// PromHandler serves /metrics when the scrape endpoint is enabled; nil
// otherwise, and the route stays unmounted.
PromHandler http.Handler
// contains filtered or unexported fields
}
Telemetry owns the providers and shuts them down cleanly.
func Init ¶
Init builds the providers. It never fails the boot: an unreachable collector must not stop a PaaS from deploying — telemetry is how you watch the system, not part of what the system does.