-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathstatsig_options.go
108 lines (95 loc) · 3.31 KB
/
statsig_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package statsig
import (
"net/http"
"time"
)
// Advanced options for configuring the Statsig SDK
type Options struct {
API string `json:"api"`
APIOverrides APIOverrides `json:"api_overrides"`
FallbackToStatsigAPI bool
Transport http.RoundTripper
Environment Environment `json:"environment"`
LocalMode bool `json:"localMode"`
ConfigSyncInterval time.Duration
IDListSyncInterval time.Duration
LoggingInterval time.Duration
LoggingMaxBufferSize int
BootstrapValues string
RulesUpdatedCallback func(rules string, time int64)
InitTimeout time.Duration
DataAdapter IDataAdapter
OutputLoggerOptions OutputLoggerOptions
StatsigLoggerOptions StatsigLoggerOptions
EvaluationCallbacks EvaluationCallbacks
DisableCDN bool // Disables use of CDN for downloading config specs
UserPersistentStorage IUserPersistentStorage
IPCountryOptions IPCountryOptions
UAParserOptions UAParserOptions
}
func (o *Options) GetSDKEnvironmentTier() string {
if o.Environment.Tier != "" {
return o.Environment.Tier
}
return "production"
}
type APIOverrides struct {
DownloadConfigSpecs string `json:"download_config_specs"`
GetIDLists string `json:"get_id_lists"`
LogEvent string `json:"log_event"`
}
type EvaluationCallbacks struct {
GateEvaluationCallback func(name string, result bool, exposure *ExposureEvent)
ConfigEvaluationCallback func(name string, result DynamicConfig, exposure *ExposureEvent)
ExperimentEvaluationCallback func(name string, result DynamicConfig, exposure *ExposureEvent)
LayerEvaluationCallback func(name string, param string, result DynamicConfig, exposure *ExposureEvent)
ExposureCallback func(name string, exposure *ExposureEvent)
IncludeDisabledExposures bool
}
type OutputLoggerOptions struct {
LogCallback func(message string, err error)
EnableDebug bool
DisableInitDiagnostics bool
DisableSyncDiagnostics bool
}
type StatsigLoggerOptions struct {
DisableInitDiagnostics bool
DisableSyncDiagnostics bool
DisableApiDiagnostics bool
DisableAllLogging bool
}
type IPCountryOptions struct {
Disabled bool // Fully disable IP to country lookup
LazyLoad bool // Load in background
EnsureLoaded bool // Wait until loaded when needed
}
type UAParserOptions struct {
Disabled bool // Fully disable UA parser
LazyLoad bool // Load in background
EnsureLoaded bool // Wait until loaded when needed
}
// See https://docs.statsig.com/guides/usingEnvironments
type Environment struct {
Tier string `json:"tier"`
Params map[string]string `json:"params"`
}
// options for getClientInitializeResponse
type GCIROptions struct {
IncludeLocalOverrides bool
ClientKey string
TargetAppID string
HashAlgorithm string
IncludeConfigType bool
ConfigTypesToInclude []ConfigType
}
type ConfigType = string
const (
FeatureGateType ConfigType = "feature_gate"
HoldoutType ConfigType = "holdout"
SegmentType ConfigType = "segment"
DynamicConfigType ConfigType = "dynamic_config"
ExperimentType ConfigType = "experiment"
AutotuneType ConfigType = "autotune"
LayerType ConfigType = "layer"
UnknownType ConfigType = "unknown"
)