MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)

* Add feature flag managment system using split.io and remove viper.

* Fixing tests.

* Attempt to fix postgres tests.

* Fix watch filepath for advanced logging.

* Review fixes.

* Some error wrapping.

* Remove unessisary store interface.

* Desanitize SplitKey

* Simplify.

* Review feedback.

* Rename split mlog adatper to split logger.

* fsInner

* Style.

* Restore oldcfg test.

* Downgrading non-actionable feature flag errors to warnings.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Christopher Speller
2020-10-29 15:54:39 -07:00
коммит произвёл GitHub
родитель 8bb772638c
Коммит 1aadd36644
423 изменённых файлов: 37646 добавлений и 20257 удалений

43
vendor/github.com/splitio/go-split-commons/v2/util/metrics.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,43 @@
package util
var latencyBuckets = [23]float64{
1.00,
1.50,
2.25,
3.38,
5.06,
7.59,
11.39,
17.09,
25.63,
38.44,
57.67,
86.50,
129.75,
194.62,
291.93,
437.89,
656.84,
985.26,
1477.89,
2216.84,
3325.26,
4987.89,
7481.83,
}
// Bucket returns the bucket where the received latency falls
func Bucket(latency int64) int {
floatLatency := float64(latency) / 1000 // Convert to millisencods
index := 0
for index < len(latencyBuckets) && floatLatency > latencyBuckets[index] {
index++
}
if index == len(latencyBuckets) {
return index - 1
}
return index
}

30
vendor/github.com/splitio/go-split-commons/v2/util/mode.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,30 @@
package util
import (
"strings"
"github.com/splitio/go-split-commons/v2/conf"
)
// ShouldAddPreviousTime returns if previous time should be set up or not depending on operationMode
func ShouldAddPreviousTime(managerConfig conf.ManagerConfig) bool {
switch strings.ToLower(managerConfig.OperationMode) {
case conf.ProducerSync:
fallthrough
case conf.Standalone:
return true
default:
return false
}
}
// ShouldBeOptimized returns if should dedupe impressions or not depending on configs
func ShouldBeOptimized(managerConfig conf.ManagerConfig) bool {
if !ShouldAddPreviousTime(managerConfig) {
return false
}
if strings.ToLower(managerConfig.ImpressionsMode) == conf.ImpressionsModeOptimized {
return true
}
return false
}

11
vendor/github.com/splitio/go-split-commons/v2/util/time.go сгенерированный поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,11 @@
package util
import "time"
const dedupWindowSizeMs = 3600 * 1000
// TruncateTimeFrame truncates de time frame received with the time window
func TruncateTimeFrame(timestampInNs int64) int64 {
timestampInMs := timestampInNs / int64(time.Millisecond)
return timestampInMs - (timestampInMs % dedupWindowSizeMs)
}