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(ctx context.Context, appID string) ([]*User, error)
- func (s *AppDBStore) GetNewUserIDs(ctx context.Context, appID string, rangeFrom *time.Time, rangeTo *time.Time) ([]string, error)
- func (s *AppDBStore) GetUserCountBeforeTime(ctx context.Context, appID string, beforeTime *time.Time) (int, error)
- func (s *AppDBStore) GetUserVerifiedEmails(ctx context.Context, appID string, userIDs []string) (result map[string]string, err error)
- type AuditDBReadStore
- func (s *AuditDBReadStore) GetAnalyticCountByType(ctx context.Context, appID string, typ string, date *time.Time) (*Count, error)
- func (s *AuditDBReadStore) GetAnalyticCountsByType(ctx context.Context, appID string, typ string, rangeFrom *time.Time, ...) ([]*Count, error)
- func (s *AuditDBReadStore) GetSumOfAnalyticCountsByType(ctx context.Context, appID string, typ string, rangeFrom *time.Time, ...) (int, error)
- type AuditDBWriteStore
- type Chart
- type ChartService
- func (s *ChartService) GetActiveUserChart(ctx context.Context, appID string, periodical string, rangeFrom 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(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*Chart, error)
- func (s *ChartService) GetSignupConversionRate(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*SignupConversionRateData, error)
- func (s *ChartService) GetTotalUserCountChart(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*Chart, error)
- type Count
- type CountCollector
- func (c *CountCollector) CollectDaily(ctx context.Context, date *time.Time) (updatedCount int, err error)
- func (c *CountCollector) CollectDailyCountForApp(ctx context.Context, appID string, date time.Time, nextDay time.Time) (counts []*Count, redisKey []string, err error)
- func (c *CountCollector) CollectMonthly(ctx context.Context, date *time.Time) (updatedCount int, err error)
- func (c *CountCollector) CollectMonthlyForApp(ctx context.Context, appID string, date *time.Time) (counts []*Count, redisKeys []string, err error)
- func (c *CountCollector) CollectWeekly(ctx context.Context, date *time.Time) (updatedCount int, err error)
- func (c *CountCollector) CollectWeeklyForApp(ctx context.Context, 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(ctx context.Context, appID string) (*AppConfigSource, error)
- func (s *GlobalDBStore) GetAppIDs(ctx context.Context) (appIDs []string, err error)
- func (s *GlobalDBStore) GetAppOwners(ctx context.Context, rangeFrom *time.Time, rangeTo *time.Time) ([]*AppCollaborator, error)
- func (s *GlobalDBStore) GetCollaboratorCount(ctx context.Context, appID string) (int, error)
- type MeterAuditDBReadStore
- type MonthlyCountResult
- type OutputCSV
- type OutputGoogleSpreadsheet
- type OutputGoogleSpreadsheetMode
- type PosthogBatchRequest
- type PosthogCredentials
- type PosthogGroup
- type PosthogHTTPClient
- 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(ctx context.Context, appID config.AppID, date *time.Time) (*DailyCountResult, error)
- func (s *Service) GetMonthlyCountResult(ctx context.Context, appID config.AppID, year int, month int) (*MonthlyCountResult, error)
- func (s *Service) GetWeeklyCountResult(ctx context.Context, appID config.AppID, year int, week int) (*WeeklyCountResult, error)
- func (s *Service) SetKeysExpire(ctx context.Context, 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), "*"), NewPosthogHTTPClient, 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 (*AppDBStore) GetNewUserIDs ¶
func (*AppDBStore) GetUserCountBeforeTime ¶
func (*AppDBStore) GetUserVerifiedEmails ¶
func (s *AppDBStore) GetUserVerifiedEmails(ctx context.Context, 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 ¶
func (*AuditDBReadStore) GetAnalyticCountsByType ¶
func (s *AuditDBReadStore) GetAnalyticCountsByType( ctx context.Context, appID string, typ string, rangeFrom *time.Time, rangeTo *time.Time, ) ([]*Count, error)
GetAnalyticCountsByType get counts by type and date range the provided rangeFrom and rangeTo are inclusive
type AuditDBWriteStore ¶
type AuditDBWriteStore struct { SQLBuilder *auditdb.SQLBuilder SQLExecutor *auditdb.WriteSQLExecutor }
func (*AuditDBWriteStore) UpsertCounts ¶
func (s *AuditDBWriteStore) UpsertCounts(ctx context.Context, 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 (s *ChartService) GetActiveUserChart( ctx context.Context, appID string, periodical string, rangeFrom time.Time, rangeTo time.Time, ) (*Chart, error)
GetActiveUserChart acquires connection.
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 (s *ChartService) GetSignupByMethodsChart(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*Chart, error)
GetSignupByMethodsChart acquires connection.
func (*ChartService) GetSignupConversionRate ¶
func (s *ChartService) GetSignupConversionRate(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*SignupConversionRateData, error)
GetSignupConversionRate acquires connection.
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 (*CountCollector) CollectDailyCountForApp ¶
func (*CountCollector) CollectMonthly ¶
func (*CountCollector) CollectMonthlyForApp ¶
func (*CountCollector) CollectWeekly ¶
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(ctx context.Context, appID string) (*AppConfigSource, error)
func (*GlobalDBStore) GetAppIDs ¶
func (s *GlobalDBStore) GetAppIDs(ctx context.Context) (appIDs []string, err error)
func (*GlobalDBStore) GetAppOwners ¶
func (s *GlobalDBStore) GetAppOwners(ctx context.Context, rangeFrom *time.Time, rangeTo *time.Time) ([]*AppCollaborator, error)
func (*GlobalDBStore) GetCollaboratorCount ¶
type MeterAuditDBReadStore ¶
type MeterAuditDBReadStore interface { GetCountByActivityType(ctx context.Context, appID string, activityType string, rangeFrom *time.Time, rangeTo *time.Time) (int, error) QueryPage(ctx context.Context, appID string, opts audit.QueryPageOptions, pageArgs graphqlutil.PageArgs) ([]*audit.Log, uint64, error) }
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 PosthogHTTPClient ¶
func NewPosthogHTTPClient ¶
func NewPosthogHTTPClient() PosthogHTTPClient
type PosthogIntegration ¶
type PosthogIntegration struct { PosthogCredentials *PosthogCredentials Clock clock.Clock GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore AppDBHandle *appdb.Handle AppDBStore *AppDBStore HTTPClient PosthogHTTPClient Logger PosthogLogger ReadCounterStore ReadCounterStore }
func (*PosthogIntegration) Batch ¶
func (p *PosthogIntegration) Batch(ctx context.Context, endpoint *url.URL, events []json.RawMessage) error
func (*PosthogIntegration) SetGroupProperties ¶
func (p *PosthogIntegration) SetGroupProperties(ctx context.Context) error
func (*PosthogIntegration) SetUserProperties ¶
func (p *PosthogIntegration) SetUserProperties(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, options *ProjectWeeklyReportOptions) (data *ReportData, err error)
type ReadCounterStore ¶
type ReadCounterStore interface { GetDailyPageViewCount( ctx context.Context, appID config.AppID, pageType meter.PageType, date *time.Time, ) (pageView int, uniquePageView int, redisKeys []string, err error) GetDailyActiveUserCount(ctx context.Context, appID config.AppID, date *time.Time) (count int, redisKey string, err error) GetWeeklyActiveUserCount(ctx context.Context, appID config.AppID, year int, week int) (count int, redisKey string, err error) GetMonthlyActiveUserCount(ctx context.Context, appID config.AppID, year int, month int) (count int, redisKey string, err error) SetKeysExpire(ctx context.Context, 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(ctx context.Context, 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.