Documentation ¶
Index ¶
- func NewAdminAPI(debug bool) *echo.Echo
- func SetConfigDefaults()
- type AsyncEventSaver
- type Config
- type DailySalt
- type EchoAPI
- type EventDomains
- type EventSaver
- type EventSessions
- type Metrics
- type PgxIface
- type Picolytics
- type PicolyticsEvent
- type PicolyticsO11y
- type PostgresAutocertCache
- type Pruner
- type Salter
- type Trackers
- type UsingEmbeddedStaticFiles
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdminAPI ¶
func NewAdminAPI(debug bool) *echo.Echo
func SetConfigDefaults ¶
func SetConfigDefaults()
Types ¶
type AsyncEventSaver ¶
type AsyncEventSaver struct {
// contains filtered or unexported fields
}
func NewAsyncEventSaver ¶
func NewAsyncEventSaver(events chan PicolyticsEvent, salter Salter, validEventNames []string, o11y *PicolyticsO11y) *AsyncEventSaver
func (*AsyncEventSaver) SaveEvent ¶
func (es *AsyncEventSaver) SaveEvent(event PicolyticsEvent)
type Config ¶
type Config struct {
// injected values
GitCommit, GitBranch, AppVersion string
// db:
PgConnString string `mapstructure:"pgConnString"`
PgHost string `mapstructure:"pgHost"` // required
PgDatabase string `mapstructure:"pgDatabase"` // required
PgUser string `mapstructure:"pgUser"` // required
PgPassword string `mapstructure:"pgPassword"` // required
PgPort int `mapstructure:"pgPort"`
PgSslMode string `mapstructure:"pgSslMode"`
PgConnAttempts int `mapstructure:"pgConnAttempts"`
SkipMigrations bool `mapstructure:"skipMigrations"`
// server:
ListenAddr string `mapstructure:"listenAddr"`
AutotlsEnabled bool `mapstructure:"autotlsEnabled"`
AutotlsHost string `mapstructure:"autotlsHost"`
AutotlsStaging bool `mapstructure:"autotlsStaging"`
AdminListen string `mapstructure:"adminListen"`
StaticDir string `mapstructure:"staticDir"`
RootRedirect string `mapstructure:"rootRedirect"`
// proxy:
IPExtractor string `mapstructure:"ipExtractor"`
TrustedProxies []string `mapstructure:"trustedProxies"`
// privacy:
GeoIPFile string `mapstructure:"geoIpFile"`
SessionTimeoutMin int `mapstructure:"sessionTimeoutMin"`
// tuning:
QueueSize int `mapstructure:"queueSize"`
BatchMaxSize int `mapstructure:"batchMaxSize"`
BatchMaxMsec int `mapstructure:"batchMaxMsec"`
RequestRateLimit int `mapstructure:"requestRateLimit"`
BodyMaxSize int64 `mapstructure:"bodyMaxSize"`
StaticCacheMaxAge int `mapstructure:"staticCacheMaxAge"`
DisableHostMetrics bool `mapstructure:"disableHostMetrics"`
LogFormat string `mapstructure:"logFormat"`
PruneDays int `mapstructure:"pruneDays"`
PruneCheckHours int `mapstructure:"pruneCheckHours"`
ValidEventNames []string `mapstructure:"validEventNames"`
Debug bool `mapstructure:"debug"`
// internal config
StaticFiles fs.FS `mapstructure:"-"`
}
type DailySalt ¶
type DailySalt struct {
// contains filtered or unexported fields
}
func NewDailySalt ¶
type EchoAPI ¶
type EchoAPI struct { E *echo.Echo // contains filtered or unexported fields }
func NewEchoAPI ¶
func NewEchoAPI(config *Config, o11y *PicolyticsO11y) (EchoAPI, error)
func (*EchoAPI) HandleStatic ¶
type EventDomains ¶
type EventSaver ¶
type EventSaver interface {
SaveEvent(event PicolyticsEvent)
}
type EventSessions ¶
type PgxIface ¶
type PgxIface interface { Begin(context.Context) (pgx.Tx, error) Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) Query(context.Context, string, ...interface{}) (pgx.Rows, error) QueryRow(context.Context, string, ...interface{}) pgx.Row CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) Close() }
type Picolytics ¶
type Picolytics struct { // exported O11y *PicolyticsO11y // contains filtered or unexported fields }
func (*Picolytics) HandleShutdown ¶
func (p *Picolytics) HandleShutdown()
func (*Picolytics) Run ¶
func (p *Picolytics) Run()
func (*Picolytics) Shutdown ¶
func (p *Picolytics) Shutdown()
type PicolyticsEvent ¶
type PicolyticsEvent struct { // populated by tracker javascript Name string `json:"n"` Location string `json:"l"` Referrer string `json:"r"` LoadTime int32 `json:"lt"` TTFB int32 `json:"fb"` ScreenW int32 `json:"sw"` ScreenH int32 `json:"sh"` PixelRatio float64 `json:"pr"` PixelDepth int32 `json:"pd"` Timezone string `json:"tz"` UtmSource string `json:"utm_source"` UtmMedium string `json:"utm_medium"` UtmCampaign string `json:"utm_campaign"` UtmContent string `json:"utm_content"` UtmTerm string `json:"utm_term"` // populated by tracker handler Lang string Created time.Time // populated by tracker handler - DO NOT store in DB ClientIpDONOTSTORE string UaDONOTSTORE string // populated by parseEvent Domain, Path, VisitorID string // populated by updateUserAgentDetails Browser, BrowserVersion, Os, OsVersion, Platform, DeviceType string // populated by enrichEvent Longitude, Latitude float64 Country, Subdivision, City string Bot bool }
type PicolyticsO11y ¶
type PostgresAutocertCache ¶
type PostgresAutocertCache struct {
// contains filtered or unexported fields
}
func NewPostgresCache ¶
func NewPostgresCache(pool PgxIface) *PostgresAutocertCache
func (*PostgresAutocertCache) Delete ¶
func (c *PostgresAutocertCache) Delete(ctx context.Context, key string) error
type Trackers ¶
type Trackers struct {
// contains filtered or unexported fields
}
func NewTrackers ¶
func NewTrackers(eventSaver EventSaver, bodyMaxSize int64) *Trackers
type UsingEmbeddedStaticFiles ¶
type UsingEmbeddedStaticFiles bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.