Documentation ¶
Index ¶
- Variables
- func CheckIndex(i string) (int, int, error)
- func GetJetIDParents(jetID string) []string
- type DBStats
- type Metrics
- type PostgresCollector
- type PostgresCollectorConfig
- type Storage
- func (s *Storage) CompletePulse(pulseNumber int64) error
- func (s *Storage) GetIncompletePulses() ([]models.Pulse, error)
- func (s *Storage) GetJetDropByID(id models.JetDropID) (models.JetDrop, []models.JetDrop, []models.JetDrop, error)
- func (s *Storage) GetJetDrops(pulse models.Pulse) ([]models.JetDrop, error)
- func (s *Storage) GetJetDropsByJetID(jetID string, ...) ([]models.JetDrop, int, error)
- func (s *Storage) GetJetDropsWithParams(pulse models.Pulse, fromJetDropID *models.JetDropID, limit int, offset int) ([]models.JetDrop, int, error)
- func (s *Storage) GetLifeline(objRef []byte, fromIndex *string, ...) ([]models.Record, int, error)
- func (s *Storage) GetNextCompletePulseFilterByPrototypeReference(prevPulse int64, prototypes [][]byte) (models.Pulse, error)
- func (s *Storage) GetNextSavedPulse(fromPulseNumber models.Pulse, completedOnly bool) (models.Pulse, error)
- func (s *Storage) GetPulse(pulseNumber int64) (models.Pulse, error)
- func (s *Storage) GetPulseByPrev(prevPulse models.Pulse) (models.Pulse, error)
- func (s *Storage) GetPulses(fromPulse *int64, ...) ([]models.Pulse, int, error)
- func (s *Storage) GetRecord(ref models.Reference) (models.Record, error)
- func (s *Storage) GetRecordsByJetDrop(jetDropID models.JetDropID, fromIndex, recordType *string, limit, offset int) ([]models.Record, int, error)
- func (s *Storage) GetSequentialPulse() (models.Pulse, error)
- func (s *Storage) SaveJetDropData(jetDrop models.JetDrop, records []models.Record, pulseNumber int64) error
- func (s *Storage) SavePulse(pulse models.Pulse) error
- func (s *Storage) SequencePulse(pulseNumber int64) error
Constants ¶
This section is empty.
Variables ¶
var ( SaveJetDropDataDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_SaveJetDropDataDuration", Help: "The duration of the SaveJetDropData function execution", Objectives: quntitile, }) SavePulseDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_SavePulseDuration", Help: "The duration of the SavePulse function execution", Objectives: quntitile, }) CompletePulseDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_CompletePulseDuration", Help: "The duration of the CompletePulse function execution", Objectives: quntitile, }) SequencePulseDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_SequencePulseDuration", Help: "The duration of the SequencePulse function execution", Objectives: quntitile, }) GetRecordDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetRecordDuration", Help: "The duration of the GetRecord function execution", Objectives: quntitile, }) GetLifelineDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetLifelineDuration", Help: "The duration of the GetLifeline function execution", Objectives: quntitile, }) GetPulseDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetPulseDuration", Help: "The duration of the GetPulse function execution", Objectives: quntitile, }) GetPulsesDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetPulsesDuration", Help: "The duration of the GetPulses function execution", Objectives: quntitile, }) GetRecordsByJetDropDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetRecordsByJetDropDuration", Help: "The duration of the GetRecordsByJetDrop function execution", Objectives: quntitile, }) GetIncompletePulsesDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetIncompletePulsesDuration", Help: "The duration of the GetIncompletePulses function execution", Objectives: quntitile, }) GetPulseByPrevDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetPulseByPrevDuration", Help: "The duration of the GetPulseByPrev function execution", Objectives: quntitile, }) GetSequentialPulseDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetSequentialPulseDuration", Help: "The duration of the GetSequentialPulse function execution", Objectives: quntitile, }) GetNextSavedPulseDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetNextSavedPulseDuration", Help: "The duration of the GetNextSavedPulse function execution", Objectives: quntitile, }) GetJetDropsDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetJetDropsDuration", Help: "The duration of the GetJetDrops function execution", Objectives: quntitile, }) GetJetDropsWithParamsDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetJetDropsWithParamsDuration", Help: "The duration of the GetJetDropsWithParams function execution", Objectives: quntitile, }) GetJetDropByIDDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetJetDropByIDDuration", Help: "The duration of the GetJetDropByID function execution", Objectives: quntitile, }) GetJetDropsByJetIDDuration = prometheus.NewSummary(prometheus.SummaryOpts{ Name: "gbe_storage_stats_GetJetDropsByJetIDDuration", Help: "The duration of the GetJetDropsByJetID function execution", Objectives: quntitile, }) )
Functions ¶
func GetJetIDParents ¶
GetJetIDParents returns parents of the jet id "0010" -> [” 0 00 001 0010]
Types ¶
type DBStats ¶
type DBStats struct { *gorm.DB MaxOpenConnections prometheus.Gauge // Maximum number of open connections to the database. // Pool status OpenConnections prometheus.Gauge // The number of established connections both in use and idle. InUse prometheus.Gauge // The number of connections currently in use. Idle prometheus.Gauge // The number of idle connections. // Counters WaitCount prometheus.Gauge // The total number of connections waited for. WaitDuration prometheus.Gauge // The total time blocked waiting for a new connection. MaxIdleClosed prometheus.Gauge // The total number of connections closed due to SetMaxIdleConns. MaxLifetimeClosed prometheus.Gauge // The total number of connections closed due to SetConnMaxLifetime. }
func (*DBStats) Collectors ¶
func (stats *DBStats) Collectors() (collector []prometheus.Collector)
Collectors returns collector in stats
func (*DBStats) Metrics ¶
func (stats *DBStats) Metrics(p *metrics.Prometheus) []prometheus.Collector
type Metrics ¶
type Metrics struct{}
The storage function metrics
func (Metrics) Metrics ¶
func (s Metrics) Metrics(p *metrics.Prometheus) []prometheus.Collector
type PostgresCollector ¶
type PostgresCollector struct { *PostgresCollectorConfig *gorm.DB Logger log.Logger // contains filtered or unexported fields }
func NewPostgresCollector ¶
func NewPostgresCollector(config *PostgresCollectorConfig, db *gorm.DB) *PostgresCollector
func (*PostgresCollector) Metrics ¶
func (pg *PostgresCollector) Metrics(p *metrics.Prometheus) []prometheus.Collector
func (*PostgresCollector) Refresh ¶
func (pg *PostgresCollector) Refresh()
type PostgresCollectorConfig ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStorage ¶
NewStorage returns implementation of interfaces.Storage
func (*Storage) CompletePulse ¶
CompletePulse update pulse with provided number to completeness in db.
func (*Storage) GetIncompletePulses ¶
GetIncompletePulses returns pulses that are not complete from db.
func (*Storage) GetJetDropByID ¶
func (*Storage) GetJetDrops ¶
GetJetDrops returns jetDrops for provided pulse from db.
func (*Storage) GetJetDropsByJetID ¶
func (*Storage) GetJetDropsWithParams ¶
func (*Storage) GetLifeline ¶
func (s *Storage) GetLifeline(objRef []byte, fromIndex *string, pulseNumberLt, pulseNumberGt, timestampLte, timestampGte *int64, limit, offset int, sortByIndexAsc bool) ([]models.Record, int, error)
GetLifeline returns records for provided object reference, ordered by pulse number and order fields.
func (*Storage) GetNextCompletePulseFilterByPrototypeReference ¶
func (*Storage) GetNextSavedPulse ¶
func (s *Storage) GetNextSavedPulse(fromPulseNumber models.Pulse, completedOnly bool) (models.Pulse, error)
GetNextSavedPulse returns first pulse with pulse number bigger then fromPulseNumber from db.
func (*Storage) GetPulseByPrev ¶
GetPulseByPrev returns pulse with provided prev pulse number from db.
func (*Storage) GetPulses ¶
func (s *Storage) GetPulses(fromPulse *int64, timestampLte, timestampGte, pulseNumberLte, pulseNumberLt, pulseNumberGte, pulseNumberGt *int64, sortByAsc bool, limit, offset int) ([]models.Pulse, int, error)
GetPulses returns pulses from db.
func (*Storage) GetRecordsByJetDrop ¶
func (s *Storage) GetRecordsByJetDrop(jetDropID models.JetDropID, fromIndex, recordType *string, limit, offset int) ([]models.Record, int, error)
GetRecordsByJetDrop returns records for provided jet drop, ordered by order field.
func (*Storage) GetSequentialPulse ¶
GetSequentialPulse returns max pulse that have is_sequential as true from db.
func (*Storage) SaveJetDropData ¶
func (s *Storage) SaveJetDropData(jetDrop models.JetDrop, records []models.Record, pulseNumber int64) error
SaveJetDropData saves provided jetDrop and records to db in one transaction. increase jet_drop_amount and record_amount
func (*Storage) SequencePulse ¶
SequencePulse update pulse with provided number to sequential in db.