iter8-tools / iter8

Kubernetes release optimizer
https://iter8.tools
Apache License 2.0
256 stars 34 forks source link

Create BadgerDB database as part of the persistent storage for traffic controller #1478

Closed Alan-Cha closed 1 year ago

Alan-Cha commented 1 year ago

The source of truth about current number of versions for an app, and the current signature of each app version, is the controller. A/B/n service will invoke the controller funcs/methods to get this info, and use it to invoke the storage client funcs/methods.

Example

MetricName: sales user u1; transaction t1: 30 user u1; transaction t2: 20 user u1; transaction t3: 20

user u2; transaction t4: 50

user u3: transaction t5: 0.5 user u3: transaction t6: 1.5

summaryOverTransactions = { Count: 6 Mean: (30 + 20 + 20 + 50 + 0.5 + 1.5)/6 StdDev: ... Min: 0.5 Max: 50 }

// metric values are added for a given user summaryOverUsers = { Count: 3 Mean: (30 + 20 + 20 + 50 + 0.5 + 1.5)/3 StdDev: ... Min: 2.0 Max: 70 }

Data structures

// MetricSummaryBy is a summarization 
type MetricSummaryBy struct {
  Count uint
  Mean float64
  StdDev float64
  Min float64
  Max float64 
}

// MetricSummary
type MetricSummary struct {
  summaryOverUsers SummarizedMetric
  summaryOverTransactions SummarizedMetric
}

// VersionMetricSummary is a summarization of metrics for a given version
type VersionMetricSummary struct {
  numUsers uint64
  // key = metric name; value is the summary value of the metric
  metricSummaries map[string]MetricSummary
}
// this will use GetAppMetricNames, to fetch the metric values ... and summarize them into the VersionMetricSummary data structure
func (cl Client) GetSummaryMetrics(applicationName string, version int, signature string) (*storageclient.VersionMetricSummary, error) {}
kalantar commented 1 year ago

initial implementation done in https://github.com/iter8-tools/iter8/pull/1490