Documentation
¶
Overview ¶
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. We cannot vendor the agent in since the agent vendors loki in, which would cause a cyclic dependency. NOTE: many changes have been made to the original code for our use-case.
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. We cannot vendor the agent in since the agent vendors loki in, which would cause a cyclic dependency. NOTE: many changes have been made to the original code for our use-case.
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. We cannot vendor the agent in since the agent vendors loki in, which would cause a cyclic dependency. NOTE: many changes have been made to the original code for our use-case.
This directory was copied and adapted from https://github.com/grafana/agent/tree/main/pkg/metrics. We cannot vendor the agent in since the agent vendors loki in, which would cause a cyclic dependency. NOTE: many changes have been made to the original code for our use-case.
Index ¶
- Variables
- func SubDirectory(base string) string
- type Metrics
- type Storage
- func (w *Storage) Appender(_ context.Context) storage.Appender
- func (w *Storage) Close() error
- func (w *Storage) Directory() string
- func (w *Storage) SetWriteNotified(writeNotified wlog.WriteNotified)
- func (*Storage) StartTime() (int64, error)
- func (w *Storage) Truncate(mint int64) error
- func (w *Storage) WriteStalenessMarkers(remoteTsFunc func() int64) error
Constants ¶
This section is empty.
Variables ¶
var ErrWALClosed = fmt.Errorf("WAL storage closed")
ErrWALClosed is an error returned when a WAL operation can't run because the storage has already been closed.
Functions ¶
func SubDirectory ¶
func SubDirectory(base string) string
SubDirectory returns the subdirectory within a Storage directory used for the Prometheus WAL.
Types ¶
type Metrics ¶
type Metrics struct {
NumActiveSeries prometheus.Gauge
NumDeletedSeries prometheus.Gauge
TotalCreatedSeries prometheus.Counter
TotalRemovedSeries prometheus.Counter
TotalAppendedSamples prometheus.Counter
TotalAppendedExemplars prometheus.Counter
TotalCorruptions prometheus.Counter
TotalFailedRepairs prometheus.Counter
TotalSucceededRepairs prometheus.Counter
ReplayDuration prometheus.Histogram
DiskSize prometheus.Gauge
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(r prometheus.Registerer) *Metrics
func (*Metrics) Unregister ¶
func (m *Metrics) Unregister()
type Storage ¶
type Storage struct {
// Embed Queryable/ChunkQueryable for compatibility, but don't actually implement it.
storage.Queryable
storage.ChunkQueryable
// contains filtered or unexported fields
}
Storage implements storage.Storage, and just writes to the WAL.
func NewStorage ¶
func NewStorage(logger log.Logger, metrics *Metrics, registerer prometheus.Registerer, path string, enableReplay bool) (*Storage, error)
NewStorage makes a new Storage.
func (*Storage) Appender ¶
func (w *Storage) Appender(_ context.Context) storage.Appender
Appender returns a new appender against the storage.
func (*Storage) Close ¶
func (w *Storage) Close() error
Close closes the storage and all its underlying resources.
func (*Storage) Directory ¶
func (w *Storage) Directory() string
Directory returns the path where the WAL storage is held.
func (*Storage) SetWriteNotified ¶
func (w *Storage) SetWriteNotified(writeNotified wlog.WriteNotified)
func (*Storage) StartTime ¶
func (*Storage) StartTime() (int64, error)
StartTime always returns 0, nil. It is implemented for compatibility with Prometheus, but is unused in the agent.
func (*Storage) Truncate ¶
func (w *Storage) Truncate(mint int64) error
Truncate removes all data from the WAL prior to the timestamp specified by mint.
func (*Storage) WriteStalenessMarkers ¶
func (w *Storage) WriteStalenessMarkers(remoteTsFunc func() int64) error
WriteStalenessMarkers appends a staleness sample for all active series.