Documentation ¶
Overview ¶
Package monitor provides a service and associated functionality for InfluxDB to self-monitor internal statistics and diagnostics.
Index ¶
- Constants
- type Config
- type Monitor
- func (m *Monitor) Close() error
- func (m *Monitor) DeregisterDiagnosticsClient(name string)
- func (m *Monitor) Diagnostics() (map[string]*diagnostics.Diagnostics, error)
- func (m *Monitor) Enabled() bool
- func (m *Monitor) Open() error
- func (m *Monitor) RegisterDiagnosticsClient(name string, client diagnostics.Client)
- func (m *Monitor) SetGlobalTag(key string, value interface{})
- func (m *Monitor) SetPointsWriter(pw PointsWriter) error
- func (m *Monitor) Statistics(tags map[string]string) ([]*Statistic, error)
- func (m *Monitor) WithLogger(log zap.Logger)
- func (m *Monitor) WritePoints(p models.Points) error
- type PointsWriter
- type RemoteWriterConfig
- type Reporter
- type Statistic
- type Statistics
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 ( // Name of the retention policy used by the monitor service. MonitorRetentionPolicy = "monitor" // Duration of the monitor retention policy. MonitorRetentionPolicyDuration = 7 * 24 * time.Hour // Default replication factor to set on the monitor retention policy. MonitorRetentionPolicyReplicaN = 1 )
Policy constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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.
func (Config) Diagnostics ¶ added in v1.3.0
func (c Config) Diagnostics() (*diagnostics.Diagnostics, error)
Diagnostics returns a diagnostics representation of a subset of the Config.
type Monitor ¶
type Monitor struct { // Build information for diagnostics. Version string Commit string Branch string BuildTime string MetaClient interface { CreateDatabaseWithRetentionPolicy(name string, spec *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error) Database(name string) *meta.DatabaseInfo } // Writer for pushing stats back into the database. PointsWriter PointsWriter Logger zap.Logger // contains filtered or unexported fields }
Monitor represents an instance of the monitor system.
func (*Monitor) DeregisterDiagnosticsClient ¶ added in v0.9.5
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.
func (*Monitor) SetGlobalTag ¶ added in v1.0.0
SetGlobalTag can be used to set tags that will appear on all points written by the Monitor.
func (*Monitor) SetPointsWriter ¶ added in v1.0.0
func (m *Monitor) SetPointsWriter(pw PointsWriter) error
SetPointsWriter can be used to set a writer for the monitoring points.
func (*Monitor) Statistics ¶
Statistics returns the combined statistics for all expvar data. The given tags are added to each of the returned statistics.
func (*Monitor) WithLogger ¶ added in v1.2.0
WithLogger sets the logger for the Monitor.
type PointsWriter ¶ added in v1.0.0
type PointsWriter interface {
WritePoints(database, retentionPolicy string, points models.Points) error
}
PointsWriter is a simplified interface for writing the points the monitor gathers.
type RemoteWriterConfig ¶ added in v1.0.0
type RemoteWriterConfig struct { RemoteAddr string NodeID string Username string Password string ClusterID uint64 }
RemoteWriterConfig represents the configuration of a remote writer.
type Reporter ¶ added in v1.0.0
type Reporter interface { // Statistics returns the statistics for the reporter, // with the given tags merged into the result. Statistics(tags map[string]string) []models.Statistic }
Reporter is an interface for gathering internal statistics.
type Statistic ¶ added in v0.9.5
Statistic represents the information returned by a single monitor client.
func (*Statistic) ValueNames ¶ added in v0.11.0
ValueNames returns a sorted list of the value names, if any.
type Statistics ¶ added in v1.0.0
type Statistics []*Statistic
Statistics is a slice of sortable statistics.
func (Statistics) Len ¶ added in v1.0.0
func (a Statistics) Len() int
Len implements sort.Interface.
func (Statistics) Less ¶ added in v1.0.0
func (a Statistics) Less(i, j int) bool
Less implements sort.Interface.
func (Statistics) Swap ¶ added in v1.0.0
func (a Statistics) Swap(i, j int)
Swap implements sort.Interface.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package diagnostics provides the diagnostics type so that other packages can provide diagnostics without depending on the monitor package.
|
Package diagnostics provides the diagnostics type so that other packages can provide diagnostics without depending on the monitor package. |