Documentation
¶
Overview ¶
Package metrics exposes VM- and browser-level metrics in the Prometheus text exposition format, intended to be scraped by an external collector and aggregated across VMs. Metrics carry no per-session or per-user labels; instance identity is expected to be attached (and later aggregated away) by the scraper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultUMAHistograms = []UMAHistogram{
{Name: "PageLoad.PaintTiming.NavigationToFirstContentfulPaint", Bounds: boundsPageLoadMs},
{Name: "PageLoad.PaintTiming.NavigationToLargestContentfulPaint2", Bounds: boundsPageLoadMs},
{Name: "PageLoad.DocumentTiming.NavigationToDOMContentLoadedEventFired", Bounds: boundsPageLoadMs},
{Name: "PageLoad.DocumentTiming.NavigationToLoadEventFired", Bounds: boundsPageLoadMs},
{Name: "PageLoad.ParseTiming.NavigationToParseStart", Bounds: boundsPageLoadMs},
{Name: "PageLoad.InteractiveTiming.UserInteractionLatency.HighPercentile2.MaxEventDuration", Bounds: boundsInteractionMs},
{Name: "PageLoad.InteractiveTiming.FirstInputDelay4", Bounds: boundsInteractionMs},
{Name: "PageLoad.InteractiveTiming.NumInteractions", Bounds: boundsCount},
{Name: "PageLoad.LayoutInstability.MaxCumulativeShiftScore.SessionWindow.Gap1000ms.Max5000ms2", Bounds: boundsShiftScore},
{Name: "PageLoad.Cpu.TotalUsage", Bounds: boundsCPUMs},
{Name: "Startup.FirstWebContents.NonEmptyPaint3", Bounds: boundsPageLoadMs},
{Name: "Memory.GPU.PeakMemoryUsage2.Scroll", Bounds: boundsMB},
}
DefaultUMAHistograms is the curated set of Chrome UMA histograms exposed on the metrics endpoint. Units are milliseconds unless noted. Histograms with no samples yet are simply absent from the output.
Only histograms recorded in the browser process are eligible: Browser.getHistograms cannot see renderer/GPU-process histograms (e.g. EventLatency.*, Graphics.Smoothness.*, Blink.*) because those only merge into the browser's recorder when a UMA log is staged or chrome://histograms is opened, neither of which happens on our images.
Functions ¶
func Handler ¶
Handler serves GET /metrics. Scrapes are serialized: concurrent requests wait rather than probing Chrome and nvidia-smi in parallel. Each collector writes into its own buffer that is appended only on success, so a failure never leaves a partially written metric family in the response.
Types ¶
type ChromeCollector ¶
type ChromeCollector struct {
// contains filtered or unexported fields
}
ChromeCollector reads browser-wide metrics over CDP: UMA histograms via Browser.getHistograms plus the browser version and open page count. All commands are browser-level — nothing attaches to pages or injects into sessions, so scrapes are invisible to automation running in the browser.
func NewChromeCollector ¶
func NewChromeCollector(upstream DevToolsUpstream) *ChromeCollector
func (*ChromeCollector) Collect ¶
func (c *ChromeCollector) Collect(ctx context.Context, w *Writer) error
func (*ChromeCollector) Name ¶
func (c *ChromeCollector) Name() string
type Collector ¶
type Collector interface {
// Name identifies the collector in error logs.
Name() string
// Collect appends samples to w. On error the collector's entire
// output is discarded — partially written metric families never reach
// the scraper — and the other collectors' output is still served.
Collect(ctx context.Context, w *Writer) error
}
Collector renders one group of metrics for a single scrape.
type DevToolsUpstream ¶
type DevToolsUpstream interface {
Current() string
}
DevToolsUpstream reports the current browser-level DevTools WebSocket URL. Satisfied by devtoolsproxy.UpstreamManager.
type GPUCollector ¶
type GPUCollector struct {
// contains filtered or unexported fields
}
GPUCollector reports GPU presence and, when a GPU is attached, vGPU license state and utilization read from nvidia-smi. On VMs without the NVIDIA driver it emits only kernel_gpu_present 0.
func NewGPUCollector ¶
func NewGPUCollector() *GPUCollector
func (*GPUCollector) Name ¶
func (c *GPUCollector) Name() string
type OTLPCollector ¶
type OTLPCollector struct {
// contains filtered or unexported fields
}
OTLPCollector reports OTLP export health: records dropped under backpressure, failed export requests, and records successfully exported. All are process-lifetime counters with no labels; the scraper attaches instance identity.
func NewOTLPCollector ¶
func NewOTLPCollector(src OTLPSource) *OTLPCollector
func (*OTLPCollector) Name ¶
func (c *OTLPCollector) Name() string
type OTLPSource ¶
OTLPSource exposes the OTLP export sink's lifetime counters. Implemented by *events.OTLPMetrics.
type SystemCollector ¶
type SystemCollector struct {
// contains filtered or unexported fields
}
SystemCollector reports VM-level resource metrics from /proc plus aggregate stats for the Chromium process tree.
func NewSystemCollector ¶
func NewSystemCollector() *SystemCollector
func (*SystemCollector) Collect ¶
func (c *SystemCollector) Collect(ctx context.Context, w *Writer) error
func (*SystemCollector) Name ¶
func (c *SystemCollector) Name() string
type UMAHistogram ¶
UMAHistogram is one curated Chrome histogram plus the fixed bucket boundaries it is re-bucketed onto for exposition.