Documentation
¶
Overview ¶
Package badgerdb implements the storageclient interface with BadgerDB
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalOptions ¶
AdditionalOptions are additional options for setting up BadgerDB
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the BadgerDB
func GetClient ¶
func GetClient(opts badger.Options, additionalOptions AdditionalOptions) (*Client, error)
GetClient gets a client for the BadgerDB
func (Client) GetMetrics ¶
func (cl Client) GetMetrics(applicationName string, version int, signature string) (*storage.VersionMetrics, error)
GetMetrics returns a nested map of the metrics data for a particular application, version, and signature Example:
{ "my-metric": { "MetricsOverTransactions": [1, 1, 3, 4, 5] "MetricsOverUsers": [2, 7, 5] } }
NOTE: for users that have not produced any metrics (for example, via lookup()), GetMetrics() will add 0s for the extra users in metricsOverUsers
Example, given 5 total users:
{ "my-metric": { "MetricsOverTransactions": [1, 1, 3, 4, 5] "MetricsOverUsers": [2, 7, 5, 0, 0] } }
func (Client) SetMetric ¶
func (cl Client) SetMetric(applicationName string, version int, signature, metric, user, transaction string, metricValue float64) error
SetMetric sets a metric based on the app name, version, signature, metric type, user name, transaction ID, and metric value with BadgerDB Example key: kt-metric::my-app::0::my-signature::my-metric::my-user::my-transaction-id -> my-metric-value