Documentation ¶
Overview ¶
Package prom exposes metrics on synapse-node
Index ¶
Constants ¶
const ChainIDVar = "chain_id"
ChainIDVar is the variable used for the chain id.
const NodeIDName = "node_id"
NodeIDName is the name of the node id.
const NodeIDVar = "node_id"
NodeIDVar is the variable used for node id.
const PrometheusDataSourceName = "Prometheus"
PrometheusDataSourceName is the name of the data source in grafana to use for prometheus.
const TimeSeriesFormat = "time_series"
TimeSeriesFormat is the format used for timeseries (in sdk.target).
const TimeSeriesGraphType = "timeseries"
TimeSeriesGraphType is the graph type used for timeseries.
Variables ¶
This section is empty.
Functions ¶
func CreateBoardJSONHandler ¶
CreateBoardJSONHandler creates a handler that returns the json for a grafana dashboard.
func MetricToTitle ¶
MetricToTitle formats a metric as a title.
func WrapMetricJobQuery ¶
WrapMetricJobQuery wraps the metric in a query around job.
Types ¶
type Config ¶
type Config struct { // PushGateway url to use (if any) PushGateway string `toml:"PushGateway"` // Enabled Whether or not to enable metrics Enabled bool `toml:"Enabled"` // GrafanaHost to push dashboards to (none will be pushed if disabled) GrafanaHost string `toml:"GrafanaHost"` // GrafanaKey to use to push dashboards GrafanaKey string `toml:"GrafanaKey"` }
Config contains the configuration for the metrics handler.
type ErrorLogger ¶
type ErrorLogger struct {
*log.ZapEventLogger
}
ErrorLogger is the error logger used for prometheus http.
func NewPromLogger ¶
func NewPromLogger(logClient *log.ZapEventLogger) ErrorLogger
NewPromLogger creates a new prometheus error logger.
func (ErrorLogger) Log ¶
func (p ErrorLogger) Log(keyvals ...interface{}) error
Log prints the output of prom to the logger.
func (ErrorLogger) Println ¶
func (p ErrorLogger) Println(v ...interface{})
Println prints the output of prom to the error logger.
type Graphable ¶
type Graphable interface { Instrumentable // GetGraphs gets the graphs associated with this object. GetGraphs() []*sdk.Panel }
Graphable is an interface that exposes a way for metrics to be registered with a the metric handler. It allows the responsibility. of placing the graphs to be used by the client.
type Instrumentable ¶
type Instrumentable interface { // GetMetrics gets the metrics associated with this object. GetMetrics(labels map[string]string) []prometheus.Collector }
Instrumentable is a type that exports some (or none as an array) prometheus metrics.
type MetricHandler ¶
type MetricHandler struct {
// contains filtered or unexported fields
}
MetricHandler stores metrics and handles exposing them.
func NewMetricHandler ¶
func NewMetricHandler(nodeID string, cfg *Config) *MetricHandler
NewMetricHandler creates a new metrics handler.
func (*MetricHandler) Handler ¶
func (m *MetricHandler) Handler() http.Handler
Handler gets the http handler for the metrics handler. This can be used in combination with or instead of the push gateway.
func (*MetricHandler) PutDashboard ¶
PutDashboard creates a dashboard. TODO replace by title/verify grafana config.
func (*MetricHandler) RegisterMetrics ¶
func (m *MetricHandler) RegisterMetrics(cs ...prometheus.Collector)
RegisterMetrics registers metrics in the registry.