storage

package
v0.18.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package storage provides the storage client for the controllers package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 {
	// 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]
	//		}
	//	}
	GetMetrics(applicationName string, version int, signature string) (*VersionMetrics, error)

	// 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

	// Example key: kt-users::my-app::0::my-signature::my-user -> true
	SetUser(applicationName string, version int, signature, user string) error

	// get ExperimentResult for a particular namespace and experiment
	GetExperimentResult(namespace, experiment string) (*base.ExperimentResult, error)

	// 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 storageclient interface with BadgerDB
Package badgerdb implements the storageclient interface with BadgerDB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL