Documentation ¶
Index ¶
- Constants
- func DiagnosticsFromMap(m map[string]interface{}) *diagnostics.Diagnostics
- type Config
- type Monitor
- func (m *Monitor) Close()
- func (m *Monitor) DeregisterDiagnosticsClient(name string)
- func (m *Monitor) Diagnostics() (map[string]*diagnostics.Diagnostics, error)
- func (m *Monitor) Open() error
- func (m *Monitor) RegisterDiagnosticsClient(name string, client diagnostics.Client)
- func (m *Monitor) SetLogger(l *log.Logger)
- func (m *Monitor) Statistics(tags map[string]string) ([]*Statistic, error)
- type Statistic
Constants ¶
const ( // DefaultStoreEnabled is whether the system writes gathered information in // an InfluxDB system for historical analysis. DefaultStoreEnabled = true // DefaultStoreDatabase is the name of the database where gathered information is written DefaultStoreDatabase = "_internal" // DefaultStoreInterval is the period between storing gathered information. DefaultStoreInterval = 10 * time.Second )
const ( MonitorRetentionPolicy = "monitor" MonitorRetentionPolicyDuration = 7 * 24 * time.Hour )
Policy constants.
Variables ¶
This section is empty.
Functions ¶
func DiagnosticsFromMap ¶ added in v0.12.0
func DiagnosticsFromMap(m map[string]interface{}) *diagnostics.Diagnostics
DiagnosticsFromMap returns a Diagnostics from a map.
Types ¶
type Config ¶
type Config struct { StoreEnabled bool `toml:"store-enabled"` StoreDatabase string `toml:"store-database"` StoreInterval toml.Duration `toml:"store-interval"` }
Config represents the configuration for the monitor service.
type Monitor ¶
type Monitor struct { // Build information for diagnostics. Version string Commit string Branch string BuildTime string MetaClient interface { ClusterID() uint64 CreateDatabase(name string) (*meta.DatabaseInfo, error) CreateRetentionPolicy(database string, rpi *meta.RetentionPolicyInfo) (*meta.RetentionPolicyInfo, error) SetDefaultRetentionPolicy(database, name string) error DropRetentionPolicy(database, name string) error } NodeID uint64 // Writer for pushing stats back into the database. // This causes a circular dependency if it depends on cluster directly so it // is wrapped in a simpler interface. PointsWriter interface { WritePoints(database, retentionPolicy string, points models.Points) error } Logger *log.Logger // contains filtered or unexported fields }
Monitor represents an instance of the monitor system.
func (*Monitor) DeregisterDiagnosticsClient ¶
DeregisterDiagnosticsClient deregisters a diagnostics client by name.
func (*Monitor) Diagnostics ¶
func (m *Monitor) Diagnostics() (map[string]*diagnostics.Diagnostics, error)
Diagnostics fetches diagnostic information for each registered diagnostic client. It skips any clients that return an error when retrieving their diagnostics.
func (*Monitor) Open ¶
Open opens the monitoring system, using the given clusterID, node ID, and hostname for identification purpose.
func (*Monitor) RegisterDiagnosticsClient ¶
func (m *Monitor) RegisterDiagnosticsClient(name string, client diagnostics.Client)
RegisterDiagnosticsClient registers a diagnostics client with the given name and tags.
type Statistic ¶
type Statistic struct { Name string `json:"name"` Tags map[string]string `json:"tags"` Values map[string]interface{} `json:"values"` }
Statistic represents the information returned by a single monitor client.
func (*Statistic) ValueNames ¶ added in v0.12.0
valueNames returns a sorted list of the value names, if any.