Documentation ¶
Index ¶
- Constants
- Variables
- func GetDateListByRangeInclusive(rangeFrom time.Time, rangeTo time.Time, periodical periodicalutil.Type) []time.Time
- type AppCollaborator
- type AppConfigSource
- type AppDBStore
- func (s *AppDBStore) GetAllUsers(appID string) ([]*User, error)
- func (s *AppDBStore) GetNewUserIDs(appID string, rangeFrom *time.Time, rangeTo *time.Time) ([]string, error)
- func (s *AppDBStore) GetUserCountBeforeTime(appID string, beforeTime *time.Time) (int, error)
- func (s *AppDBStore) GetUserVerifiedEmails(appID string, userIDs []string) (result map[string]string, err error)
- type AuditDBReadStore
- func (s *AuditDBReadStore) GetAnalyticCountByType(appID string, typ string, date *time.Time) (*Count, error)
- func (s *AuditDBReadStore) GetAnalyticCountsByType(appID string, typ string, rangeFrom *time.Time, rangeTo *time.Time) ([]*Count, error)
- func (s *AuditDBReadStore) GetSumOfAnalyticCountsByType(appID string, typ string, rangeFrom *time.Time, rangeTo *time.Time) (int, error)
- type AuditDBWriteStore
- type Chart
- type ChartService
- func (s *ChartService) GetActiveUserChart(appID string, periodical string, rangeFrom time.Time, rangeTo time.Time) (*Chart, error)
- func (s *ChartService) GetBoundedRange(periodical periodicalutil.Type, rangeFrom time.Time, rangeTo time.Time) (newRangeFrom time.Time, newRangeTo time.Time, err error)
- func (s *ChartService) GetSignupByMethodsChart(appID string, rangeFrom time.Time, rangeTo time.Time) (*Chart, error)
- func (s *ChartService) GetSignupConversionRate(appID string, rangeFrom time.Time, rangeTo time.Time) (*SignupConversionRateData, error)
- func (s *ChartService) GetTotalUserCountChart(appID string, rangeFrom time.Time, rangeTo time.Time) (*Chart, error)
- type Count
- type CountCollector
- func (c *CountCollector) CollectDaily(date *time.Time) (updatedCount int, err error)
- func (c *CountCollector) CollectDailyCountForApp(appID string, date time.Time, nextDay time.Time) (counts []*Count, redisKey []string, err error)
- func (c *CountCollector) CollectMonthly(date *time.Time) (updatedCount int, err error)
- func (c *CountCollector) CollectMonthlyForApp(appID string, date *time.Time) (counts []*Count, redisKeys []string, err error)
- func (c *CountCollector) CollectWeekly(date *time.Time) (updatedCount int, err error)
- func (c *CountCollector) CollectWeeklyForApp(appID string, date *time.Time) (counts []*Count, redisKeys []string, err error)
- type CountResult
- type DailyCountResult
- type DailySignupCountTypeByMethod
- type DataPoint
- type GlobalDBStore
- func (s *GlobalDBStore) GetAppConfigSource(appID string) (*AppConfigSource, error)
- func (s *GlobalDBStore) GetAppIDs() (appIDs []string, err error)
- func (s *GlobalDBStore) GetAppOwners(rangeFrom *time.Time, rangeTo *time.Time) ([]*AppCollaborator, error)
- func (s *GlobalDBStore) GetCollaboratorCount(appID string) (int, error)
- type MeterAuditDBReadStore
- type MonthlyCountResult
- type OutputCSV
- type OutputGoogleSpreadsheet
- type OutputGoogleSpreadsheetMode
- type PosthogBatchRequest
- type PosthogCredentials
- type PosthogGroup
- type PosthogIntegration
- type PosthogLogger
- type ProjectHourlyReport
- type ProjectHourlyReportOptions
- type ProjectMonthlyReport
- type ProjectMonthlyReportOptions
- type ProjectWeeklyReport
- type ProjectWeeklyReportOptions
- type ReadCounterStore
- type ReportData
- type Service
- func (s *Service) GetDailyCountResult(appID config.AppID, date *time.Time) (*DailyCountResult, error)
- func (s *Service) GetMonthlyCountResult(appID config.AppID, year int, month int) (*MonthlyCountResult, error)
- func (s *Service) GetWeeklyCountResult(appID config.AppID, year int, week int) (*WeeklyCountResult, error)
- func (s *Service) SetKeysExpire(keys []string, expiration time.Duration) error
- type SignupConversionRateData
- type SignupCountResult
- type User
- type UserWeeklyReport
- type UserWeeklyReportOptions
- type WeeklyCountResult
Constants ¶
View Source
const ( CumulativeUserCountType = "cumulative.user" MonthlyActiveUserCountType = "monthly.active_user" WeeklyActiveUserCountType = "weekly.active_user" DailyActiveUserCountType = "daily.active_user" DailySignupCountType = "daily.signup" DailySignupPageViewCountType = "daily.page_view.signup" DailySignupUniquePageViewCountType = "daily.unique_page_view.signup" DailyLoginPageViewCountType = "daily.page_view.login" DailyLoginUniquePageViewCountType = "daily.unique_page_view.login" // nolint: gosec DailySignupWithLoginIDCountType = "daily.signup.login_id.%s" DailySignupWithOAuthCountType = "daily.signup.oauth.%s" DailySignupAnonymouslyCountType = "daily.signup.anonymous" )
Variables ¶
View Source
var DailySignupCountTypeByMethods = []*DailySignupCountTypeByMethod{}
View Source
var DependencySet = wire.NewSet( wire.Struct(new(GlobalDBStore), "*"), wire.Struct(new(AppDBStore), "*"), wire.Struct(new(AuditDBReadStore), "*"), wire.Struct(new(AuditDBWriteStore), "*"), wire.Struct(new(UserWeeklyReport), "*"), wire.Struct(new(ProjectHourlyReport), "*"), wire.Struct(new(ProjectWeeklyReport), "*"), wire.Struct(new(ProjectMonthlyReport), "*"), wire.Struct(new(CountCollector), "*"), wire.Struct(new(ChartService), "*"), wire.Struct(new(Service), "*"), wire.Struct(new(PosthogIntegration), "*"), NewPosthogLogger, )
View Source
var ErrAnalyticCountNotFound = errors.New("analytic count not found")
Functions ¶
Types ¶
type AppCollaborator ¶
type AppConfigSource ¶
type AppDBStore ¶
type AppDBStore struct { SQLBuilder *appdb.SQLBuilder SQLExecutor *appdb.SQLExecutor }
func (*AppDBStore) GetAllUsers ¶
func (s *AppDBStore) GetAllUsers(appID string) ([]*User, error)
func (*AppDBStore) GetNewUserIDs ¶
func (*AppDBStore) GetUserCountBeforeTime ¶
func (*AppDBStore) GetUserVerifiedEmails ¶
func (s *AppDBStore) GetUserVerifiedEmails(appID string, userIDs []string) (result map[string]string, err error)
GetUserVerifiedEmails returns userID to email map
type AuditDBReadStore ¶
type AuditDBReadStore struct { SQLBuilder *auditdb.SQLBuilder SQLExecutor *auditdb.ReadSQLExecutor }
func (*AuditDBReadStore) GetAnalyticCountByType ¶
type AuditDBWriteStore ¶
type AuditDBWriteStore struct { SQLBuilder *auditdb.SQLBuilder SQLExecutor *auditdb.WriteSQLExecutor }
func (*AuditDBWriteStore) UpsertCounts ¶
func (s *AuditDBWriteStore) UpsertCounts(counts []*Count) error
UpsertCounts upsert counts in batches
type ChartService ¶
type ChartService struct { Database *auditdb.ReadHandle AuditStore *AuditDBReadStore Clock clock.Clock AnalyticConfig *config.AnalyticConfig }
ChartService provides method for the portal to get data for charts
func (*ChartService) GetActiveUserChart ¶
func (*ChartService) GetBoundedRange ¶
func (s *ChartService) GetBoundedRange( periodical periodicalutil.Type, rangeFrom time.Time, rangeTo time.Time, ) (newRangeFrom time.Time, newRangeTo time.Time, err error)
GetBoundedRange returns if the given range is valid and the bounded range The range is bounded by the analytic epoch ane the current date
func (*ChartService) GetSignupByMethodsChart ¶
func (*ChartService) GetSignupConversionRate ¶
func (s *ChartService) GetSignupConversionRate(appID string, rangeFrom time.Time, rangeTo time.Time) (*SignupConversionRateData, error)
func (*ChartService) GetTotalUserCountChart ¶
type Count ¶
type CountCollector ¶
type CountCollector struct { GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AppDBHandle *appdb.Handle AppDBStore *AppDBStore AuditDBReadHandle *auditdb.ReadHandle AuditDBReadStore *AuditDBReadStore AuditDBWriteHandle *auditdb.WriteHandle MeterAuditDBStore MeterAuditDBReadStore AuditDBWriteStore *AuditDBWriteStore AnalyticService *Service }
func (*CountCollector) CollectDaily ¶
func (c *CountCollector) CollectDaily(date *time.Time) (updatedCount int, err error)
func (*CountCollector) CollectDailyCountForApp ¶
func (*CountCollector) CollectMonthly ¶
func (c *CountCollector) CollectMonthly(date *time.Time) (updatedCount int, err error)
func (*CountCollector) CollectMonthlyForApp ¶
func (*CountCollector) CollectWeekly ¶
func (c *CountCollector) CollectWeekly(date *time.Time) (updatedCount int, err error)
func (*CountCollector) CollectWeeklyForApp ¶
type CountResult ¶
type CountResult struct {
RedisKeys []string
}
CountResult includes the redis keys of the report Expiration should be set to those keys after storing the count to the db
type DailyCountResult ¶
type GlobalDBStore ¶
type GlobalDBStore struct { SQLBuilder *globaldb.SQLBuilder SQLExecutor *globaldb.SQLExecutor }
func (*GlobalDBStore) GetAppConfigSource ¶
func (s *GlobalDBStore) GetAppConfigSource(appID string) (*AppConfigSource, error)
func (*GlobalDBStore) GetAppIDs ¶
func (s *GlobalDBStore) GetAppIDs() (appIDs []string, err error)
func (*GlobalDBStore) GetAppOwners ¶
func (s *GlobalDBStore) GetAppOwners(rangeFrom *time.Time, rangeTo *time.Time) ([]*AppCollaborator, error)
func (*GlobalDBStore) GetCollaboratorCount ¶
func (s *GlobalDBStore) GetCollaboratorCount(appID string) (int, error)
type MeterAuditDBReadStore ¶
type MonthlyCountResult ¶
type MonthlyCountResult struct { *CountResult ActiveUser int }
type OutputCSV ¶
func (*OutputCSV) OutputReport ¶
func (o *OutputCSV) OutputReport(ctx context.Context, data *ReportData) error
type OutputGoogleSpreadsheet ¶
type OutputGoogleSpreadsheet struct { GoogleOAuthClientCredentialsJSONFilePath string GoogleOAuthTokenFilePath string SpreadsheetOutputMode OutputGoogleSpreadsheetMode SpreadsheetID string SpreadsheetRange string }
func (*OutputGoogleSpreadsheet) OutputReport ¶
func (o *OutputGoogleSpreadsheet) OutputReport(ctx context.Context, data *ReportData) error
type OutputGoogleSpreadsheetMode ¶
type OutputGoogleSpreadsheetMode string
const ( OutputGoogleSpreadsheetModeDefault OutputGoogleSpreadsheetMode = "" OutputGoogleSpreadsheetModeAppend OutputGoogleSpreadsheetMode = "append" OutputGoogleSpreadsheetModeOverwrite OutputGoogleSpreadsheetMode = "overwrite" )
type PosthogBatchRequest ¶
type PosthogBatchRequest struct { APIKey string `json:"api_key"` Batch []json.RawMessage `json:"batch,omitempty"` }
type PosthogCredentials ¶
type PosthogGroup ¶
type PosthogIntegration ¶
type PosthogIntegration struct { PosthogCredentials *PosthogCredentials Clock clock.Clock GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AppDBHandle *appdb.Handle AppDBStore *AppDBStore Logger PosthogLogger ReadCounterStore ReadCounterStore }
func (*PosthogIntegration) Batch ¶
func (p *PosthogIntegration) Batch(endpoint *url.URL, events []json.RawMessage) error
func (*PosthogIntegration) SetGroupProperties ¶
func (p *PosthogIntegration) SetGroupProperties() error
func (*PosthogIntegration) SetUserProperties ¶
func (p *PosthogIntegration) SetUserProperties(portalAppID string) error
type PosthogLogger ¶
func NewPosthogLogger ¶
func NewPosthogLogger(lf *log.Factory) PosthogLogger
type ProjectHourlyReport ¶
type ProjectHourlyReport struct { GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AppDBHandle *appdb.Handle AppDBStore *AppDBStore }
func (*ProjectHourlyReport) Run ¶
func (r *ProjectHourlyReport) Run(options *ProjectHourlyReportOptions) (data *ReportData, err error)
type ProjectMonthlyReport ¶
type ProjectMonthlyReport struct { GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AuditDBHandle *auditdb.ReadHandle AuditDBStore *AuditDBReadStore }
func (*ProjectMonthlyReport) Run ¶
func (r *ProjectMonthlyReport) Run(options *ProjectMonthlyReportOptions) (data *ReportData, err error)
type ProjectWeeklyReport ¶
type ProjectWeeklyReport struct { GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AppDBHandle *appdb.Handle AppDBStore *AppDBStore AuditDBHandle *auditdb.ReadHandle MeterAuditDBStore MeterAuditDBReadStore AuditDBStore *AuditDBReadStore }
func (*ProjectWeeklyReport) Run ¶
func (r *ProjectWeeklyReport) Run(options *ProjectWeeklyReportOptions) (data *ReportData, err error)
type ReadCounterStore ¶
type ReadCounterStore interface { GetDailyPageViewCount( appID config.AppID, pageType meter.PageType, date *time.Time, ) (pageView int, uniquePageView int, redisKeys []string, err error) GetDailyActiveUserCount(appID config.AppID, date *time.Time) (count int, redisKey string, err error) GetWeeklyActiveUserCount(appID config.AppID, year int, week int) (count int, redisKey string, err error) GetMonthlyActiveUserCount(appID config.AppID, year int, month int) (count int, redisKey string, err error) SetKeysExpire(keys []string, expiration time.Duration) error }
type ReportData ¶
type ReportData struct { Header []interface{} Values [][]interface{} }
type Service ¶
type Service struct {
ReadCounter ReadCounterStore
}
func (*Service) GetDailyCountResult ¶
func (*Service) GetMonthlyCountResult ¶
func (*Service) GetWeeklyCountResult ¶
type SignupCountResult ¶
type UserWeeklyReport ¶
type UserWeeklyReport struct { GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AppDBHandle *appdb.Handle AppDBStore *AppDBStore }
func (*UserWeeklyReport) Run ¶
func (r *UserWeeklyReport) Run(options *UserWeeklyReportOptions) (data *ReportData, err error)
type UserWeeklyReportOptions ¶
type WeeklyCountResult ¶
type WeeklyCountResult struct { *CountResult ActiveUser int }
Source Files ¶
- appdb_store.go
- auditdb_read_store.go
- auditdb_write_store.go
- chart_service.go
- count.go
- count_collector.go
- deps.go
- errors.go
- globaldb_store.go
- model.go
- output_csv.go
- output_google_spreadsheet.go
- posthog.go
- project_hourly_report.go
- project_monthly_report.go
- project_weekly_report.go
- service.go
- time.go
- user_weekly_report.go
Click to show internal directories.
Click to hide internal directories.