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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8bb772638c
Коммит
1aadd36644
64
vendor/github.com/splitio/go-split-commons/v2/push/parser.go
сгенерированный
поставляемый
Обычный файл
64
vendor/github.com/splitio/go-split-commons/v2/push/parser.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,64 @@
|
||||
package push
|
||||
|
||||
import (
|
||||
"github.com/splitio/go-toolkit/v3/common"
|
||||
"github.com/splitio/go-toolkit/v3/logging"
|
||||
)
|
||||
|
||||
const (
|
||||
update = "update"
|
||||
errorType = "error"
|
||||
occupancy = "[meta]occupancy"
|
||||
)
|
||||
|
||||
// NotificationParser struct
|
||||
type NotificationParser struct {
|
||||
logger logging.LoggerInterface
|
||||
}
|
||||
|
||||
// NewNotificationParser creates notifcation parser
|
||||
func NewNotificationParser(logger logging.LoggerInterface) *NotificationParser {
|
||||
return &NotificationParser{
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
||||
// Parse parses incoming event from streaming
|
||||
func (n *NotificationParser) Parse(event map[string]interface{}) IncomingEvent {
|
||||
incomingEvent := IncomingEvent{
|
||||
id: common.AsStringOrNil(event["id"]),
|
||||
encoding: common.AsStringOrNil(event["encoding"]),
|
||||
data: common.AsStringOrNil(event["data"]),
|
||||
name: common.AsStringOrNil(event["name"]),
|
||||
clientID: common.AsStringOrNil(event["clientId"]),
|
||||
channel: common.AsStringOrNil(event["channel"]),
|
||||
message: common.AsStringOrNil(event["message"]),
|
||||
href: common.AsStringOrNil(event["href"]),
|
||||
}
|
||||
|
||||
timestamp := common.AsFloat64OrNil(event["timestamp"])
|
||||
if timestamp != nil {
|
||||
incomingEvent.timestamp = common.Int64Ref(int64(*timestamp))
|
||||
}
|
||||
code := common.AsFloat64OrNil(event["code"])
|
||||
if code != nil {
|
||||
incomingEvent.code = common.IntRef(int(*code))
|
||||
}
|
||||
statusCode := common.AsFloat64OrNil(event["statusCode"])
|
||||
if statusCode != nil {
|
||||
incomingEvent.statusCode = common.IntRef(int(*statusCode))
|
||||
}
|
||||
|
||||
if incomingEvent.code != nil && incomingEvent.statusCode != nil {
|
||||
incomingEvent.event = errorType
|
||||
return incomingEvent
|
||||
}
|
||||
|
||||
if incomingEvent.name != nil && *incomingEvent.name == occupancy {
|
||||
incomingEvent.event = occupancy
|
||||
return incomingEvent
|
||||
}
|
||||
|
||||
incomingEvent.event = update
|
||||
return incomingEvent
|
||||
}
|
||||
Ссылка в новой задаче
Block a user