tsweb, derp: add expvar http.Handler for Prometheus's format
And add some opinions. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
89a2c3eb04
commit
e371520cc5
23
metrics/metrics.go
Normal file
23
metrics/metrics.go
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package metrics contains expvar & Prometheus types and code used by
|
||||
// Tailscale for monitoring.
|
||||
package metrics
|
||||
|
||||
import "expvar"
|
||||
|
||||
// Map is a string-to-Var map variable that satisfies the expvar.Var
|
||||
// interface.
|
||||
//
|
||||
// Semantically, this is mapped by tsweb's Prometheus exporter as a
|
||||
// collection of unrelated variables exported with a common prefix.
|
||||
//
|
||||
// This lets us have tsweb recognize *expvar.Map for different
|
||||
// purposes in the future. (Or perhaps all uses of expvar.Map will
|
||||
// require explicit types like this one, declaring how we want tsweb
|
||||
// to export it to Prometheus.)
|
||||
type Set struct {
|
||||
expvar.Map
|
||||
}
|
Reference in New Issue
Block a user