Documentation ¶
Index ¶
- Constants
- type ArgsRPC
- type NaNError
- type PrometheusStorage
- type PushgatewayStorage
- type ReaderIndex
- type Result
- type Results
- type ResultsRPC
- type Storage
- func (s *Storage) AddExternalStorage(e externalStorage)
- func (s *Storage) Close()
- func (s *Storage) Get(query string, time time.Time) Result
- func (s *Storage) GetAll(query string) []Result
- func (s *Storage) GetLabels(query string) []string
- func (s *Storage) GetRange(query string, startTime, endTime time.Time) []Result
- func (s *Storage) GetToIndex(query string, index *ReaderIndex) []Result
- func (s *Storage) GetValueIndex(query, filter string) int
- func (s *Storage) NewReaderIndex(query string) *ReaderIndex
- func (s *Storage) Next(query string, reader *ReaderIndex) (next Result)
- func (s *Storage) NextOrEmpty(query string, reader *ReaderIndex) (next Result)
- func (s *Storage) Put(query, value string, persistence bool, values ...interface{}) (result Result, err error)
- func (s *Storage) PutLabels(query string, labels []string)
- func (s *Storage) Show(query string)
- type Values
Constants ¶
const ( DUMMY_OUTBOUND_ADDR = "8.8.8.8:80" // Some outbound address for dummy requests. PROMETHEUS_JOB = "cryptarch" // What to apply for the Prometheus job. PROMETHEUS_METRICS_ENDPOINT = "/results" // Endpoint where Prometheus metrics are presented. PROMETHEUS_METRICS_HELP = "Produced by Cryptarch." // Help text for all Prometheus metrics. PROMETHEUS_METRIC_LABEL = "cryptarch_label" // What Prometheus label to use for the Cryptarch label. PROMETHEUS_METRIC_PREFIX = "cryptarch" // Prefix for all Prometheus metrics. )
const ( MAX_EXTERNAL_STORAGES = 128 // Maximum external storage integrations. MAX_RESULTS = 128 // Maximum number of result series that may be maintained. PUT_EVENT_CHANNEL_SIZE = 128 // Size of put channels, controlling the amount of waiting results. STORAGE_FILE_DIR = "cryptarch" // Directory in user cache to use for storage. STORAGE_FILE_NAME = "storage.json" // Filename to use for actual storage. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NaNError ¶
type NaNError struct {
// Value attempted to be used
Value interface{}
}
Error indicating a number is expected but was not provided.
type PrometheusStorage ¶
type PrometheusStorage struct {
// contains filtered or unexported fields
}
func NewPrometheusStorage ¶
func NewPrometheusStorage(address string) PrometheusStorage
Create a new storage for Prometheus.
type PushgatewayStorage ¶
type PushgatewayStorage struct {
// contains filtered or unexported fields
}
Prometheus Pushgateway specific external storage system.
func NewPushgatewayStorage ¶
func NewPushgatewayStorage(address string) PushgatewayStorage
Create a new storage for Pushgateway.
type ReaderIndex ¶
type ReaderIndex int
Reader indexes control where a consumer has last read a result.
func (*ReaderIndex) Dec ¶
func (i *ReaderIndex) Dec()
Decrement a reader index, to re-read the last read.
func (*ReaderIndex) Inc ¶
func (i *ReaderIndex) Inc()
Incremement a reader index, likely after a read.
func (*ReaderIndex) Set ¶
func (i *ReaderIndex) Set(newI int)
Sets a redaer index to a specified value.
type Result ¶
type Result struct { Time time.Time // Time the result was created. Value string // Raw value of the result. Values Values // Tokenized value of the result. }
Individual result.
type Results ¶
type Results struct { // Meta field for result values acting as a name, corresponding by index. In the event that no // explicit labels are defined, the indexes are the labels. Labels []string // Stored results. Results []Result }
Collection of results.
type ResultsRPC ¶
type ResultsRPC struct {
Results *Results
}
type Storage ¶
type Storage struct { Results map[string]*Results // Map of queries to results. // contains filtered or unexported fields }
Collection of results mapped to their queries.
func NewStorage ¶
Initializes a new storage, loading in any saved storage data.
func (*Storage) AddExternalStorage ¶
func (s *Storage) AddExternalStorage(e externalStorage)
Adds an external storage.
func (*Storage) Close ¶
func (s *Storage) Close()
Closes a storage. Should be called after all storage operations cease.
func (*Storage) GetToIndex ¶
func (s *Storage) GetToIndex(query string, index *ReaderIndex) []Result
Given results up to a reader index (a.k.a. "playback").
func (*Storage) GetValueIndex ¶
Given a filter, return the corresponding value index.
func (*Storage) NewReaderIndex ¶
func (s *Storage) NewReaderIndex(query string) *ReaderIndex
Initialize a new reader index. Will attempt to set the initial value to the end of existing results, if results already exist.
func (*Storage) Next ¶
func (s *Storage) Next(query string, reader *ReaderIndex) (next Result)
Retrieve the next result from a put event channel, blocking if none exists.
func (*Storage) NextOrEmpty ¶
func (s *Storage) NextOrEmpty(query string, reader *ReaderIndex) (next Result)
Retrieve the next result from a put event channel, returning an empty result if nothing exists.
func (*Storage) Put ¶
func (s *Storage) Put( query, value string, persistence bool, values ...interface{}, ) (result Result, err error)
Put a new result.