* feat(backend): moved sql requests related to sessions table to one place * feat(backend): refactoring in db.Saver handler * feat(backend): hude refactoring in db/postgres module * fix(backend): workable feature flags * fix(backend): workable integrations * fix(backend): workable sessions and projects modules * fix(backend): added missed projects module to sessions * feat(backend): renaming * feat(backend): moved session struct to sessions module and split methods into interface, cache and storage levels * feat(backend): moved project struct to projects module * feat(backend): added projects model * feat(backend): implemented new in memory cache for sessions and projects * feat(backend): implemented new cache in projects * feat(backend): there are 2 methods in cache module now: Get() and GetAndRefresh() * feat(backend): added cache update operations * fix(backend): fixed import cycle * fix(backend): fixed panic in db message handler * fix(backend): fixed panic in projects module * fix(backend): fixed panic in sessions.GetDuration * feat(backend): added direct call to get session duration if session is already in cache * feat(backend): used pg pool everywhere except db service * fix(backend): added missing part after rebase * fix(backend): removed old sessions file * feat(backend): added refactored redis client with produce/consume options * feat(backend): added cache layer for projects * fix(backend): added missing redis config * fix(backend): added missing method for producer * feat(backend): cache integration for sessions * feat(backend): temporary method to get session directly from db * feat(backend): adapt EE version of message handler * fix(backend): fixed issue in fts realisation * fix(backend): added redis cache to sessions module * fix(backend): set 0 duration or hesitation time for inputs without focus event * feat(backend): added cache for session updates and failover mechanism for batch.Insert() operation * feat(backend): debug log * feat(backend): more debug log * feat(backend): removed debug log * fix(backend): fixed an issue of tracking input events with empty label * fix(backend): disabled debug log in projects cache * fix(backend): renamed session updater * fix(backend): fixed closed pool issue in DB service * fix(backend): fixed dead lock in db Stop() method * fix(backend): fixed panic in heuristics service * feat(backend): enabled redis cache in projects * feat(backend): clear cache on each update operation * feat(backend): fully integrated cache layer with auto switch * feat(backend): small refactoring in session updates * fix(backend): fixed wrong events counter issue * feat(backend): enabled full cache support in ender and http services * fix(backend/ee): added missed import * feat(backend): added second cache layer for db to speed up the service * feat(backend): disable redis cache * feat(backend): moved redis cache to ee
87 lines
2 KiB
Go
87 lines
2 KiB
Go
package sessions
|
|
|
|
type Session struct {
|
|
SessionID uint64
|
|
Timestamp uint64
|
|
ProjectID uint32
|
|
TrackerVersion string
|
|
RevID string
|
|
UserUUID string
|
|
UserOS string
|
|
UserOSVersion string
|
|
UserDevice string
|
|
UserCountry string
|
|
UserState string
|
|
UserCity string
|
|
Referrer *string
|
|
ReferrerBase *string
|
|
Duration *uint64
|
|
PagesCount int
|
|
EventsCount int
|
|
ErrorsCount int
|
|
IssueTypes []string
|
|
IssueScore int
|
|
UserID *string
|
|
UserAnonymousID *string
|
|
Metadata1 *string
|
|
Metadata2 *string
|
|
Metadata3 *string
|
|
Metadata4 *string
|
|
Metadata5 *string
|
|
Metadata6 *string
|
|
Metadata7 *string
|
|
Metadata8 *string
|
|
Metadata9 *string
|
|
Metadata10 *string
|
|
Platform string
|
|
UserAgent string
|
|
UserBrowser string
|
|
UserBrowserVersion string
|
|
UserDeviceType string
|
|
UserDeviceMemorySize uint64
|
|
UserDeviceHeapSize uint64
|
|
SaveRequestPayload bool
|
|
EncryptionKey string
|
|
}
|
|
|
|
func (s *Session) SetMetadata(keyNo uint, value string) {
|
|
switch keyNo {
|
|
case 1:
|
|
s.Metadata1 = &value
|
|
case 2:
|
|
s.Metadata2 = &value
|
|
case 3:
|
|
s.Metadata3 = &value
|
|
case 4:
|
|
s.Metadata4 = &value
|
|
case 5:
|
|
s.Metadata5 = &value
|
|
case 6:
|
|
s.Metadata6 = &value
|
|
case 7:
|
|
s.Metadata7 = &value
|
|
case 8:
|
|
s.Metadata8 = &value
|
|
case 9:
|
|
s.Metadata9 = &value
|
|
case 10:
|
|
s.Metadata10 = &value
|
|
}
|
|
}
|
|
|
|
type UnStartedSession struct {
|
|
ProjectKey string
|
|
TrackerVersion string
|
|
DoNotTrack bool
|
|
Platform string
|
|
UserAgent string
|
|
UserOS string
|
|
UserOSVersion string
|
|
UserBrowser string
|
|
UserBrowserVersion string
|
|
UserDevice string
|
|
UserDeviceType string
|
|
UserCountry string
|
|
UserState string
|
|
UserCity string
|
|
}
|