Documentation
¶
Index ¶
- Constants
- Variables
- type EndpointStatusCodes
- type ForResource
- type ForTimeSlice
- type ProxyEndpointLatencies
- type ProxyEndpointLatenciesImpl
- type ProxyEndpointTelemetry
- type ProxySegmentStorage
- type ProxySegmentStorageImpl
- func (s *ProxySegmentStorageImpl) ChangeNumber(segment string) (int64, error)
- func (s *ProxySegmentStorageImpl) ChangesSince(name string, since int64) (*dtos.SegmentChangesDTO, error)
- func (s *ProxySegmentStorageImpl) CountRemovedKeys(segmentName string) int
- func (s *ProxySegmentStorageImpl) Keys(segmentName string) *set.ThreadUnsafeSet
- func (s *ProxySegmentStorageImpl) NamesAndCount() map[string]int
- func (s *ProxySegmentStorageImpl) SegmentContainsKey(segmentName string, key string) (bool, error)
- func (s *ProxySegmentStorageImpl) SegmentKeysCount() int64
- func (s *ProxySegmentStorageImpl) SegmentsFor(key string) ([]string, error)
- func (s *ProxySegmentStorageImpl) SetChangeNumber(segment string, changeNumber int64) error
- func (s *ProxySegmentStorageImpl) Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, ...) error
- type ProxySplitStorage
- type ProxySplitStorageImpl
- func (p *ProxySplitStorageImpl) All() []dtos.SplitDTO
- func (p *ProxySplitStorageImpl) ChangeNumber() (int64, error)
- func (p *ProxySplitStorageImpl) ChangesSince(since int64) (*dtos.SplitChangesDTO, error)
- func (p *ProxySplitStorageImpl) Count() int
- func (p *ProxySplitStorageImpl) FetchMany(names []string) map[string]*dtos.SplitDTO
- func (p *ProxySplitStorageImpl) KillLocally(splitName string, defaultTreatment string, changeNumber int64)
- func (p *ProxySplitStorageImpl) RegisterOlderCn(payload *dtos.SplitChangesDTO)
- func (p *ProxySplitStorageImpl) Remove(name string)
- func (p *ProxySplitStorageImpl) SegmentNames() *set.ThreadUnsafeSet
- func (p *ProxySplitStorageImpl) SetChangeNumber(cn int64) error
- func (p *ProxySplitStorageImpl) Split(name string) *dtos.SplitDTO
- func (p *ProxySplitStorageImpl) SplitNames() []string
- func (p *ProxySplitStorageImpl) TrafficTypeExists(tt string) bool
- func (p *ProxySplitStorageImpl) Update(toAdd []dtos.SplitDTO, toRemove []dtos.SplitDTO, changeNumber int64)
- type ProxyTelemetryFacade
- type ProxyTelemetryFacadeImpl
- type ProxyTelemetryPeeker
- type TimeSliceData
- type TimeslicedProxyEndpointTelemetry
- type TimeslicedProxyEndpointTelemetryImpl
- func (t *TimeslicedProxyEndpointTelemetryImpl) IncrEndpointStatus(endpoint int, status int)
- func (t *TimeslicedProxyEndpointTelemetryImpl) RecordEndpointLatency(endpoint int, latency time.Duration)
- func (t *TimeslicedProxyEndpointTelemetryImpl) TimeslicedReport() TimeSliceData
- func (t *TimeslicedProxyEndpointTelemetryImpl) TotalMetricsReport() map[string]ForResource
Constants ¶
const ( AuthEndpoint = iota SplitChangesEndpoint SegmentChangesEndpoint MySegmentsEndpoint ImpressionsBulkEndpoint ImpressionsBulkBeaconEndpoint ImpressionsCountEndpoint ImpressionsCountBeaconEndpoint EventsBulkEndpoint EventsBulkBeaconEndpoint TelemetryConfigEndpoint TelemetryRuntimeEndpoint LegacyTimeEndpoint LegacyTimesEndpoint LegacyCounterEndpoint LegacyCountersEndpoint LegacyGaugeEndpoint )
Local telemetry constants
const ( HistoricTelemetryGranularityMinute = iota HistoricTelemetryGranularityHour HistoricTelemetryGranularityDay )
Granularity selection constants to be used upon component instantiation
Variables ¶
var ErrSegmentNotFound = errors.New("segment not found")
ErrSegmentNotFound is returned when the segment whose changes we're querying isn't cached
var ErrSummaryNotCached = errors.New("summary for requested change number not cached")
ErrSummaryNotCached is returned when a summary is not cached for a requested change number
Functions ¶
This section is empty.
Types ¶
type EndpointStatusCodes ¶
type EndpointStatusCodes struct {
// contains filtered or unexported fields
}
EndpointStatusCodes keeps track of http status codes generated by the proxy endpoints
func (*EndpointStatusCodes) IncrEndpointStatus ¶
func (e *EndpointStatusCodes) IncrEndpointStatus(endpoint int, status int)
IncrEndpointStatus increments the count of a specific status code for a specific endpoint
func (*EndpointStatusCodes) PeekEndpointStatus ¶
func (e *EndpointStatusCodes) PeekEndpointStatus(endpoint int) map[int]int64
PeekEndpointStatus increments the count of a specific status code for a specific endpoint
type ForResource ¶ added in v5.0.4
type ForResource struct {
Latencies []int64 `json:"latencies"`
StatusCodes map[int]int64 `json:"statusCodes"`
RequestCount int `json:"requestCount"`
}
ForResource bundles latencies & status code for a specific timeslice
type ForTimeSlice ¶ added in v5.0.4
type ForTimeSlice struct {
TimeSlice int64 `json:"timeslice"`
Resources map[string]ForResource `json:"resources"`
}
ForTimeSlice stores all the data for a certain time-slice
type ProxyEndpointLatencies ¶
type ProxyEndpointLatencies interface {
PeekEndpointLatency(endpoint int) []int64
RecordEndpointLatency(endpoint int, latency time.Duration)
}
ProxyEndpointLatencies defines an interface to access proxy server endpoint latencies numbers
type ProxyEndpointLatenciesImpl ¶
type ProxyEndpointLatenciesImpl struct {
// contains filtered or unexported fields
}
ProxyEndpointLatenciesImpl keep track of the latency introudiced by each proxy endpoint
func (*ProxyEndpointLatenciesImpl) PeekEndpointLatency ¶
func (p *ProxyEndpointLatenciesImpl) PeekEndpointLatency(endpoint int) []int64
PeekEndpointLatency records a (bucketed) latency for a specific endpoint
func (*ProxyEndpointLatenciesImpl) RecordEndpointLatency ¶
func (p *ProxyEndpointLatenciesImpl) RecordEndpointLatency(endpoint int, latency time.Duration)
RecordEndpointLatency records a (bucketed) latency for a specific endpoint
type ProxyEndpointTelemetry ¶
type ProxyEndpointTelemetry interface {
ProxyTelemetryPeeker
RecordEndpointLatency(endpoint int, latency time.Duration)
IncrEndpointStatus(endpoint int, status int)
}
ProxyEndpointTelemetry defines the interface that endpoints use to capture latency & status codes
type ProxySegmentStorage ¶
type ProxySegmentStorage interface {
ChangesSince(name string, since int64) (*dtos.SegmentChangesDTO, error)
SegmentsFor(key string) ([]string, error)
CountRemovedKeys(segmentName string) int
}
ProxySegmentStorage defines the set of methods that are required for the proxy server to respond to resquests from sdk clients
type ProxySegmentStorageImpl ¶
type ProxySegmentStorageImpl struct {
// contains filtered or unexported fields
}
ProxySegmentStorageImpl implements the ProxySegmentStorage interface
func NewProxySegmentStorage ¶
func NewProxySegmentStorage(db persistent.DBWrapper, logger logging.LoggerInterface, restoreFromBackup bool) *ProxySegmentStorageImpl
NewProxySegmentStorage for proxy
func (*ProxySegmentStorageImpl) ChangeNumber ¶
func (s *ProxySegmentStorageImpl) ChangeNumber(segment string) (int64, error)
ChangeNumber storage
func (*ProxySegmentStorageImpl) ChangesSince ¶
func (s *ProxySegmentStorageImpl) ChangesSince(name string, since int64) (*dtos.SegmentChangesDTO, error)
ChangesSince returns the `segmentChanges` like payload to from a certain CN to the last snapshot This method has one drawback. ALL the historically removed keys are always returned as part of the `removed` array, regardless whether the `since` parameter is old enough to require such removal or not. We should eventually see if it's worth taking an approach similar to the one in splits or not
func (*ProxySegmentStorageImpl) CountRemovedKeys ¶
func (s *ProxySegmentStorageImpl) CountRemovedKeys(segmentName string) int
CountRemovedKeys method
func (*ProxySegmentStorageImpl) Keys ¶
func (s *ProxySegmentStorageImpl) Keys(segmentName string) *set.ThreadUnsafeSet
Keys method
func (*ProxySegmentStorageImpl) NamesAndCount ¶ added in v5.0.4
func (s *ProxySegmentStorageImpl) NamesAndCount() map[string]int
NamesAndCount returns a map of segment names to key count
func (*ProxySegmentStorageImpl) SegmentContainsKey ¶
func (s *ProxySegmentStorageImpl) SegmentContainsKey(segmentName string, key string) (bool, error)
SegmentContainsKey method
func (*ProxySegmentStorageImpl) SegmentKeysCount ¶
func (s *ProxySegmentStorageImpl) SegmentKeysCount() int64
SegmentKeysCount returns 0
func (*ProxySegmentStorageImpl) SegmentsFor ¶
func (s *ProxySegmentStorageImpl) SegmentsFor(key string) ([]string, error)
SegmentsFor returns the list of segments a key belongs to
func (*ProxySegmentStorageImpl) SetChangeNumber ¶
func (s *ProxySegmentStorageImpl) SetChangeNumber(segment string, changeNumber int64) error
SetChangeNumber method
func (*ProxySegmentStorageImpl) Update ¶
func (s *ProxySegmentStorageImpl) Update(name string, toAdd *set.ThreadUnsafeSet, toRemove *set.ThreadUnsafeSet, changeNumber int64) error
Update method
type ProxySplitStorage ¶
type ProxySplitStorage interface {
ChangesSince(since int64) (*dtos.SplitChangesDTO, error)
RegisterOlderCn(payload *dtos.SplitChangesDTO)
}
ProxySplitStorage defines the interface of a storage that can be used for serving splitChanges payloads for different requested `since` parameters
type ProxySplitStorageImpl ¶
type ProxySplitStorageImpl struct {
// contains filtered or unexported fields
}
ProxySplitStorageImpl implements the ProxySplitStorage interface and the SplitProducer interface
func NewProxySplitStorage ¶
func NewProxySplitStorage(db persistent.DBWrapper, logger logging.LoggerInterface, restoreBackup bool) *ProxySplitStorageImpl
NewProxySplitStorage instantiates a new proxy storage that wraps an in-memory snapshot of the last known, flag configuration, a changes summaries containing recipes to update SDKs with different CNs, and a persistent storage for snapshot purposes
func (*ProxySplitStorageImpl) All ¶
func (p *ProxySplitStorageImpl) All() []dtos.SplitDTO
All call is forwarded to the snapshot
func (*ProxySplitStorageImpl) ChangeNumber ¶
func (p *ProxySplitStorageImpl) ChangeNumber() (int64, error)
ChangeNumber returns the current change number
func (*ProxySplitStorageImpl) ChangesSince ¶
func (p *ProxySplitStorageImpl) ChangesSince(since int64) (*dtos.SplitChangesDTO, error)
ChangesSince builds a SplitChanges payload to from `since` to the latest known CN
func (*ProxySplitStorageImpl) Count ¶ added in v5.0.4
func (p *ProxySplitStorageImpl) Count() int
Count returns the number of cached splits
func (*ProxySplitStorageImpl) FetchMany ¶
func (p *ProxySplitStorageImpl) FetchMany(names []string) map[string]*dtos.SplitDTO
FetchMany call is forwarded to the snapshot
func (*ProxySplitStorageImpl) KillLocally ¶
func (p *ProxySplitStorageImpl) KillLocally(splitName string, defaultTreatment string, changeNumber int64)
KillLocally marks a split as killed in the current storage
func (*ProxySplitStorageImpl) RegisterOlderCn ¶
func (p *ProxySplitStorageImpl) RegisterOlderCn(payload *dtos.SplitChangesDTO)
RegisterOlderCn registers payload associated to a fetch request for an old `since` for which we don't have a recipe
func (*ProxySplitStorageImpl) Remove ¶
func (p *ProxySplitStorageImpl) Remove(name string)
Remove deletes a split by name
func (*ProxySplitStorageImpl) SegmentNames ¶
func (p *ProxySplitStorageImpl) SegmentNames() *set.ThreadUnsafeSet
SegmentNames call is forwarded to the snapshot
func (*ProxySplitStorageImpl) SetChangeNumber ¶
func (p *ProxySplitStorageImpl) SetChangeNumber(cn int64) error
SetChangeNumber updates the change number
func (*ProxySplitStorageImpl) Split ¶
func (p *ProxySplitStorageImpl) Split(name string) *dtos.SplitDTO
Split call is forwarded to the snapshot
func (*ProxySplitStorageImpl) SplitNames ¶
func (p *ProxySplitStorageImpl) SplitNames() []string
SplitNames call is forwarded to the snapshot
func (*ProxySplitStorageImpl) TrafficTypeExists ¶
func (p *ProxySplitStorageImpl) TrafficTypeExists(tt string) bool
TrafficTypeExists call is forwarded to the snapshot
type ProxyTelemetryFacade ¶
type ProxyTelemetryFacade interface {
storage.TelemetryStorage
storage.TelemetryPeeker
ProxyEndpointTelemetry
}
ProxyTelemetryFacade defines the set of methods required to accept local telemetry as well as runtime telemetry
type ProxyTelemetryFacadeImpl ¶
type ProxyTelemetryFacadeImpl struct {
ProxyEndpointLatenciesImpl
EndpointStatusCodes
*inmemory.TelemetryStorage
}
ProxyTelemetryFacadeImpl exposes local telemetry functionality
func NewProxyTelemetryFacade ¶
func NewProxyTelemetryFacade() *ProxyTelemetryFacadeImpl
NewProxyTelemetryFacade instantiates a local telemetry facade
type ProxyTelemetryPeeker ¶
type ProxyTelemetryPeeker interface {
PeekEndpointLatency(resource int) []int64
PeekEndpointStatus(resource int) map[int]int64
}
ProxyTelemetryPeeker is able to peek at locally captured metrics
type TimeSliceData ¶ added in v5.0.4
type TimeSliceData []ForTimeSlice
TimeSliceData splits the latest metrics in N entries of fixed x-seconds width timeslices
type TimeslicedProxyEndpointTelemetry ¶ added in v5.0.4
type TimeslicedProxyEndpointTelemetry interface {
ProxyTelemetryFacade
TimeslicedReport() TimeSliceData
TotalMetricsReport() map[string]ForResource
}
TimeslicedProxyEndpointTelemetry is a proxy telemetry facade (yet another) that bundles global data and historic data by timeslice (for observability purposes)
type TimeslicedProxyEndpointTelemetryImpl ¶ added in v5.0.4
type TimeslicedProxyEndpointTelemetryImpl struct {
ProxyTelemetryFacade
// contains filtered or unexported fields
}
TimeslicedProxyEndpointTelemetryImpl is an implementation of `TimeslicedProxyEnxpointTelemetry`
func NewTimeslicedProxyEndpointTelemetry ¶ added in v5.0.4
func NewTimeslicedProxyEndpointTelemetry(wrapped ProxyTelemetryFacade, width int64, maxTimeSlices int) *TimeslicedProxyEndpointTelemetryImpl
NewTimeslicedProxyEndpointTelemetry constructs a new timesliced proxy-endpoint telemetry
func (*TimeslicedProxyEndpointTelemetryImpl) IncrEndpointStatus ¶ added in v5.0.4
func (t *TimeslicedProxyEndpointTelemetryImpl) IncrEndpointStatus(endpoint int, status int)
IncrEndpointStatus increments the status code count for a specific endpont/status code (global + historic records are updated)
func (*TimeslicedProxyEndpointTelemetryImpl) RecordEndpointLatency ¶ added in v5.0.4
func (t *TimeslicedProxyEndpointTelemetryImpl) RecordEndpointLatency(endpoint int, latency time.Duration)
RecordEndpointLatency increments the latency bucket for a specific endpoint (global + historic records are updated)
func (*TimeslicedProxyEndpointTelemetryImpl) TimeslicedReport ¶ added in v5.0.4
func (t *TimeslicedProxyEndpointTelemetryImpl) TimeslicedReport() TimeSliceData
TimeslicedReport returns a report of the latest metrics split into N time-slices
func (*TimeslicedProxyEndpointTelemetryImpl) TotalMetricsReport ¶ added in v5.0.5
func (t *TimeslicedProxyEndpointTelemetryImpl) TotalMetricsReport() map[string]ForResource