Documentation
¶
Overview ¶
Package storage provides the storage client for the controllers package
Index ¶
- func GetExperimentResult(fetch func() ([]byte, error)) (*base.ExperimentResult, error)
- func GetExperimentResultKey(namespace, experiment string) string
- func GetMetricKey(applicationName string, version int, ...) (string, error)
- func GetMetricKeyPrefix(applicationName string, version int, signature string) string
- func GetUserKey(applicationName string, version int, signature, user string) string
- func GetUserKeyPrefix(applicationName string, version int, signature string) string
- func GetVolumeUsage(path string) (uint64, uint64, error)
- type Interface
- type MetricSummary
- type SummarizedMetric
- type VersionMetricSummary
- type VersionMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExperimentResult ¶ added in v0.18.6
func GetExperimentResult(fetch func() ([]byte, error)) (*base.ExperimentResult, error)
GetExperimentResult returns an experiment result retrieved from a key value store
func GetExperimentResultKey ¶ added in v0.18.6
func GetExperimentResultKey(namespace, experiment string) string
GetExperimentResultKey returns a performance experiment key from the inputs
func GetMetricKey ¶ added in v0.18.6
func GetMetricKey(applicationName string, version int, signature, metric, user, transaction string) (string, error)
GetMetricKey returns a metric key from the inputs
func GetMetricKeyPrefix ¶ added in v0.18.6
func GetMetricKeyPrefix(applicationName string, version int, signature string) string
GetMetricKeyPrefix returns the prefix of a metric key
func GetUserKey ¶ added in v0.18.6
func GetUserKey(applicationName string, version int, signature, user string) string
GetUserKey returns a user key from the inputs
func GetUserKeyPrefix ¶ added in v0.18.6
func GetUserKeyPrefix(applicationName string, version int, signature string) string
GetUserKeyPrefix returns the prefix of a user key
func GetVolumeUsage ¶
func GetVolumeUsage(path string) (uint64, uint64, error)
GetVolumeUsage gets the available and total capacity of a volume, in that order
Types ¶
type Interface ¶
type Interface interface {
// GetMerics returns all metrics for an app/version
// Returned result is a nested map of the metrics data
// 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]
// }
// }
GetMetrics(applicationName string, version int, signature string) (*VersionMetrics, error)
// SetMetric records a metric value
// Called by the A/B/n SDK gRPC API implementation (SDK for application clients)
// Example key: kt-metric::my-app::0::my-signature::my-metric::my-user::my-transaction-id -> my-metric-value (get the metric value with all the provided information)
SetMetric(applicationName string, version int, signature, metric, user, transaction string, metricValue float64) error
// SetUser records the name of user
// Example key: kt-users::my-app::0::my-signature::my-user -> true
SetUser(applicationName string, version int, signature, user string) error
// GetExperimentResult returns the experiment result for a particular namespace and experiment
GetExperimentResult(namespace, experiment string) (*base.ExperimentResult, error)
// SetExperimentResult records an expeirment result
// called by the A/B/n SDK gRPC API implementation (SDK for application clients)
// Example key: kt-metric::my-app::0::my-signature::my-metric::my-user::my-transaction-id -> my-metric-value (get the metric value with all the provided information)
SetExperimentResult(namespace, experiment string, data *base.ExperimentResult) error
}
Interface enables interaction with a storage entity Can be mocked in unit tests with fake implementation
type MetricSummary ¶
type MetricSummary struct {
// all transactions
SummaryOverTransactions SummarizedMetric
// cumulative metrics per user
SummaryOverUsers SummarizedMetric
}
MetricSummary contains metric summary for all metrics as well as cumulative metrics per user
type SummarizedMetric ¶
type SummarizedMetric struct {
Count uint64
Mean float64
StdDev float64
Min float64
Max float64
}
SummarizedMetric is a metric summary
type VersionMetricSummary ¶
type VersionMetricSummary struct {
NumUsers uint64
// key = metric name; value is the metric summary
MetricSummaries map[string]MetricSummary
}
VersionMetricSummary is a metric summary for a given app version
type VersionMetrics ¶
type VersionMetrics map[string]struct {
MetricsOverTransactions []float64
MetricsOverUsers []float64
}
VersionMetrics contains all the metrics over transactions and over users key = metric name
Directories
¶
Path | Synopsis |
---|---|
Package badgerdb implements the storage interface with BadgerDB
|
Package badgerdb implements the storage interface with BadgerDB |
Package client implements an implementation independent storage client
|
Package client implements an implementation independent storage client |
Package redis implements the storage interface with Redis
|
Package redis implements the storage interface with Redis |