model

package
v0.0.0-...-a245e04 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUGGESTION_LIMIT_CONSTANT       = 8
	EVENTS_OBJECTS_ADVISORY_LOCK_ID = 1337
	InternalMetricCategory          = "__internal"
	AWS_REGION_US_EAST_2            = "us-east-2"
)
View Source
const (
	SESSIONS_TBL                    = "sessions"
	METRIC_GROUPS_NAME_SESSION_UNIQ = "metric_groups_name_session_uniq"
	DASHBOARD_METRIC_FILTERS_UNIQ   = "dashboard_metric_filters_uniq"
)
View Source
const PARTITION_SESSION_ID = 30000000

Variables

View Source
var (
	DB     *gorm.DB
	HashID *hashids.HashID

	F = false
	T = true
)
View Source
var AdminRole = struct {
	ADMIN  string
	MEMBER string
}{
	ADMIN:  "ADMIN",
	MEMBER: "MEMBER",
}
View Source
var AlertType = struct {
	// deprecated alerts
	ERROR            string
	NEW_USER         string
	TRACK_PROPERTIES string
	USER_PROPERTIES  string
	ERROR_FEEDBACK   string
	RAGE_CLICK       string
	NEW_SESSION      string
	LOG              string
	// new alerts
	SESSIONS string
	ERRORS   string
	LOGS     string
	TRACES   string
	METRICS  string
}{

	ERROR:            "ERROR_ALERT",
	NEW_USER:         "NEW_USER_ALERT",
	TRACK_PROPERTIES: "TRACK_PROPERTIES_ALERT",
	USER_PROPERTIES:  "USER_PROPERTIES_ALERT",
	ERROR_FEEDBACK:   "ERROR_FEEDBACK_ALERT",
	RAGE_CLICK:       "RAGE_CLICK_ALERT",
	NEW_SESSION:      "NEW_SESSION_ALERT",
	LOG:              "LOG",

	SESSIONS: "SESSIONS_ALERT",
	ERRORS:   "ERRORS_ALERT",
	LOGS:     "LOGS_ALERT",
	TRACES:   "TRACES_ALERT",
	METRICS:  "METRICS_ALERT",
}

TODO(et) - replace this with generated SessionAlertType

View Source
var ContextKeys = struct {
	IP             contextString
	UserAgent      contextString
	AcceptLanguage contextString
	UID            contextString
	OAuthClientID  contextString
	// The email for the current user. If the email is a @highlight.run, the email will need to be verified, otherwise `Email` will be an empty string.
	Email          contextString
	AcceptEncoding contextString
	ZapierToken    contextString
	ZapierProject  contextString
	SessionId      contextString
}{
	IP:             "ip",
	UserAgent:      "userAgent",
	AcceptLanguage: "acceptLanguage",
	UID:            "uid",
	Email:          "email",
	AcceptEncoding: "acceptEncoding",
	ZapierToken:    "parsedToken",
	ZapierProject:  "project",
	SessionId:      "sessionId",
}
View Source
var ErrorType = struct {
	FRONTEND string
	BACKEND  string
}{
	FRONTEND: "Frontend",
	BACKEND:  "Backend",
}
View Source
var Fingerprint = struct {
	StackFrameCode     FingerprintType
	StackFrameMetadata FingerprintType
	JsonResult         FingerprintType
}{
	StackFrameCode:     "CODE",
	StackFrameMetadata: "META",
	JsonResult:         "JSON",
}
View Source
var SessionCommentTypes = struct {
	// Comments created by a Highlight user on the Highlight app.
	ADMIN string
	// Comments created by a Highlight customer, comes from feedback from their app.
	FEEDBACK string
}{
	ADMIN:    "ADMIN",
	FEEDBACK: "FEEDBACK",
}

Functions

func EnableAllWorkspaceSettings

func EnableAllWorkspaceSettings(ctx context.Context, db *gorm.DB) error

EnableAllWorkspaceSettings updates all rows to enable enterprise workspace features

func FromVerboseID

func FromVerboseID(verboseId string) (int, error)

func GetAttributesColumn

func GetAttributesColumn(mappings []ColumnMapping, key string) string

func GetEmailsToNotify

func GetEmailsToNotify(emails *string) ([]*string, error)

func MarshalStringArray

func MarshalStringArray(sa pq.StringArray) graphql.Marshaler

func MarshalTimestamp

func MarshalTimestamp(t time.Time) graphql.Marshaler

func MigrateDB

func MigrateDB(ctx context.Context, DB *gorm.DB) (bool, error)

func SendBillingNotifications

func SendBillingNotifications(ctx context.Context, db *gorm.DB, mailClient *sendgrid.Client, emailType Email.EmailType, workspace *Workspace) error

func SendWelcomeSlackMessage

func SendWelcomeSlackMessage(ctx context.Context, obj IAlert, input *SendWelcomeSlackMessageInput) error

func SetupDB

func SetupDB(ctx context.Context, dbName string) (*gorm.DB, error)

func UnmarshalStringArray

func UnmarshalStringArray(i interface{}) (pq.StringArray, error)

func UnmarshalTimestamp

func UnmarshalTimestamp(v interface{}) (time.Time, error)

Types

type AWSMarketplaceCustomer

type AWSMarketplaceCustomer struct {
	Model
	WorkspaceID          int `gorm:"uniqueIndex"`
	CustomerIdentifier   *string
	CustomerAWSAccountID *string
	ProductCode          *string
}

type Admin

type Admin struct {
	Model
	Name                      *string
	FirstName                 *string
	LastName                  *string
	HubspotContactID          *int
	Email                     *string
	AboutYouDetailsFilled     *bool
	Phone                     *string
	NumberOfSessionsViewed    *int
	NumberOfErrorGroupsViewed *int
	NumberOfLogsViewed        *int
	EmailVerified             *bool            `gorm:"default:false"`
	PhotoURL                  *string          `json:"photo_url"`
	UID                       *string          `gorm:"uniqueIndex"`
	Organizations             []Organization   `gorm:"many2many:organization_admins;"`
	SessionComments           []SessionComment `gorm:"many2many:session_comment_admins;"`
	ErrorComments             []ErrorComment   `gorm:"many2many:error_comment_admins;"`
	Workspaces                []Workspace      `gorm:"many2many:workspace_admins;"`
	SlackIMChannelID          *string
	// How/where this user was referred from to sign up to Highlight.
	Referral *string `json:"referral"`
	// This is the role the Admin has specified. This is their role in their organization, not within Highlight. This should not be used for authorization checks.
	UserDefinedRole         *string `json:"user_defined_role"`
	UserDefinedTeamSize     *string `json:"user_defined_team_size"`
	UserDefinedPersona      *string `json:"user_defined_persona"`
	HeardAbout              *string `json:"heard_about"`
	PhoneHomeContactAllowed *bool   `json:"phone_home_contact_allowed"`
}

type Alert

type Alert struct {
	Model
	ProjectID         int
	MetricId          string
	Name              string
	ProductType       modelInputs.ProductType
	FunctionType      modelInputs.MetricAggregator
	FunctionColumn    *string
	Query             *string
	GroupByKey        *string
	Disabled          bool                `gorm:"default:false"`
	LastAdminToEditID int                 `gorm:"last_admin_to_edit_id"`
	Destinations      []*AlertDestination `gorm:"foreignKey:AlertID"`
	Default           bool                `gorm:"default:false"` // alert created during setup flow

	// fields for threshold alert
	BelowThreshold     *bool
	ThresholdValue     *float64
	ThresholdWindow    *int
	ThresholdCooldown  *int
	ThresholdType      modelInputs.ThresholdType
	ThresholdCondition modelInputs.ThresholdCondition
}

type AlertDeprecated

type AlertDeprecated struct {
	ProjectID            int
	ExcludedEnvironments *string
	CountThreshold       int
	ThresholdWindow      *int // TODO(geooot): [HIG-2351] make this not a pointer or change graphql struct field to be nullable
	ChannelsToNotify     *string
	EmailsToNotify       *string
	Name                 string
	Type                 *string `gorm:"index"`
	LastAdminToEditID    int     `gorm:"last_admin_to_edit_id"`
	Frequency            int     `gorm:"default:15"` // time in seconds
	Disabled             *bool   `gorm:"default:false"`
	Default              bool    `gorm:"default:false"` // alert created during setup flow
}

func (*AlertDeprecated) GetChannelsToNotify

func (obj *AlertDeprecated) GetChannelsToNotify() ([]*modelInputs.SanitizedSlackChannel, error)

func (*AlertDeprecated) GetDailyErrorEventFrequency

func (obj *AlertDeprecated) GetDailyErrorEventFrequency(db *gorm.DB, id int) ([]*int64, error)

func (*AlertDeprecated) GetDailyLogEventFrequency

func (obj *AlertDeprecated) GetDailyLogEventFrequency(db *gorm.DB, id int) ([]*int64, error)

func (*AlertDeprecated) GetDailySessionEventFrequency

func (obj *AlertDeprecated) GetDailySessionEventFrequency(db *gorm.DB, id int) ([]*int64, error)

func (*AlertDeprecated) GetEmailsToNotify

func (obj *AlertDeprecated) GetEmailsToNotify() ([]*string, error)

func (*AlertDeprecated) GetExcludedEnvironments

func (obj *AlertDeprecated) GetExcludedEnvironments() ([]*string, error)

func (*AlertDeprecated) GetName

func (obj *AlertDeprecated) GetName() string

type AlertDestination

type AlertDestination struct {
	Model
	AlertID         int
	DestinationType modelInputs.AlertDestinationType
	TypeID          string
	TypeName        string
	Authorization   *string // webhooks may have this
}

type AlertIntegrations

type AlertIntegrations struct {
	DiscordChannelsToNotify        DiscordChannels        `gorm:"type:jsonb;default:'[]'" json:"discord_channels_to_notify"`
	MicrosoftTeamsChannelsToNotify MicrosoftTeamsChannels `gorm:"type:jsonb;default:'[]'" json:"microsoft_teams_channels_to_notify"`
	WebhookDestinations            WebhookDestinations    `gorm:"type:jsonb;default:'[]'" json:"webhook_destinations"`
}

type AllWorkspaceSettings

type AllWorkspaceSettings struct {
	Model
	WorkspaceID    int  `gorm:"uniqueIndex"`
	AIApplication  bool `gorm:"default:true"`
	AIInsights     bool `gorm:"default:false"`
	AIQueryBuilder bool `gorm:"default:false"`

	// use embeddings to group errors in this workspace
	ErrorEmbeddingsGroup bool `gorm:"default:true"`
	// use embeddings to tag error groups in this workspace
	ErrorEmbeddingsTagGroup bool `gorm:"default:true"`

	ErrorEmbeddingsThreshold  float64 `gorm:"default:0.2"`
	ReplaceAssets             bool    `gorm:"default:false"`
	StoreIP                   bool    `gorm:"default:false"`
	CanShowBillingIssueBanner bool    `gorm:"default:true"`

	EnableUnlimitedDashboards bool `gorm:"default:false"`
	EnableUnlimitedProjects   bool `gorm:"default:false"`
	EnableUnlimitedRetention  bool `gorm:"default:false"`
	EnableUnlimitedSeats      bool `gorm:"default:false"`

	EnableBillingLimits      bool `gorm:"default:false"` // old plans grandfathered in to true
	EnableGrafanaDashboard   bool `gorm:"default:false"`
	EnableIngestSampling     bool `gorm:"default:false"`
	EnableProjectLevelAccess bool `gorm:"default:false"`
	EnableSessionExport      bool `gorm:"default:false"`

	EnableDataDeletion    bool `gorm:"default:true"`
	EnableNetworkTraces   bool `gorm:"default:true"`
	EnableUnlistedSharing bool `gorm:"default:true"`

	EnableJiraIntegration  bool `gorm:"default:false"`
	EnableTeamsIntegration bool `gorm:"default:false"`

	EnableLogTraceIngestion bool `gorm:"default:false"`
}

type BillingEmailHistory

type BillingEmailHistory struct {
	Model
	Active      bool
	WorkspaceID int
	Type        Email.EmailType
}

type ColumnMapping

type ColumnMapping struct {
	Prefix string
	Column string
}

type CommentFollower

type CommentFollower struct {
	Model
	SessionCommentID int `gorm:"index"`
	ErrorCommentID   int `gorm:"index"`

	AdminId          int
	SlackChannelName string
	SlackChannelID   string
	HasMuted         *bool
}

type CommentReply

type CommentReply struct {
	Model
	SessionCommentID int `gorm:"index"`
	ErrorCommentID   int `gorm:"index"`

	Admins  []Admin `gorm:"many2many:comment_reply_admins;"`
	AdminId int
	Text    string
}

type CommentSlackThread

type CommentSlackThread struct {
	Model
	SessionCommentID int `gorm:"index"`
	ErrorCommentID   int `gorm:"index"`

	SlackChannelID string
	ThreadTS       string
}

type DailyErrorCount

type DailyErrorCount struct {
	Model
	Date      *time.Time `json:"date"`
	Count     int64      `json:"count"`
	ProjectID int        `json:"project_id"`
	ErrorType string     `gorm:"default:FRONTEND"`
}

type DailySessionCount

type DailySessionCount struct {
	Model
	Date      *time.Time `json:"date"`
	Count     int64      `json:"count"`
	ProjectID int        `json:"project_id"`
}

type Dashboard

type Dashboard struct {
	Model
	ProjectID         int `gorm:"index;not null;"`
	Name              string
	LastAdminToEditID *int
	Layout            *string
	Metrics           []*DashboardMetric `gorm:"foreignKey:DashboardID;"`
	IsDefault         *bool
}

type DashboardMetric

type DashboardMetric struct {
	Model
	DashboardID              int `gorm:"index;not null;"`
	Name                     string
	Description              string
	ComponentType            *modelInputs.MetricViewComponentType
	ChartType                *modelInputs.DashboardChartType
	Aggregator               *modelInputs.MetricAggregator `gorm:"default:P50"`
	MaxGoodValue             *float64
	MaxNeedsImprovementValue *float64
	PoorValue                *float64
	Units                    *string
	HelpArticle              *string
	MinValue                 *float64
	MinPercentile            *float64
	MaxValue                 *float64
	MaxPercentile            *float64
	Filters                  []*DashboardMetricFilter `gorm:"foreignKey:MetricID"`
	Groups                   pq.StringArray           `gorm:"type:text[]"`
}

type DashboardMetricFilter

type DashboardMetricFilter struct {
	Model
	MetricID        int
	MetricMonitorID int
	Tag             string
	Op              modelInputs.MetricTagFilterOp `gorm:"default:equals"`
	Value           string
}

type DateRange

type DateRange struct {
	StartDate time.Time
	EndDate   time.Time
}

type DeleteSessionsTask

type DeleteSessionsTask struct {
	TaskID    string `gorm:"index:idx_task_id_batch_id"`
	BatchID   string `gorm:"index:idx_task_id_batch_id"`
	SessionID int
}

type DiscordChannel

type DiscordChannel struct {
	Name string
	ID   string
}

type DiscordChannels

type DiscordChannels []*DiscordChannel

func (*DiscordChannels) Scan

func (dc *DiscordChannels) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (DiscordChannels) Value

func (dc DiscordChannels) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type EmailOptOut

type EmailOptOut struct {
	Model
	AdminID   int                             `gorm:"uniqueIndex:email_opt_out_admin_category_idx"`
	Category  modelInputs.EmailOptOutCategory `gorm:"uniqueIndex:email_opt_out_admin_category_idx"`
	ProjectID *int                            `gorm:"uniqueIndex:email_opt_out_admin_category_project_idx"`
}

type EmailSignup

type EmailSignup struct {
	Model
	Email               string `gorm:"uniqueIndex"`
	ApolloData          string
	ApolloDataShortened string
}

type EnhancedUserDetails

type EnhancedUserDetails struct {
	Model
	Email       *string `gorm:"uniqueIndex"`
	PersonJSON  *string
	CompanyJSON *string
}

type ErrorAlert

type ErrorAlert struct {
	Model
	AlertDeprecated
	RegexGroups *string
	Query       string
	AlertIntegrations
}

func (*ErrorAlert) GetRegexGroups

func (obj *ErrorAlert) GetRegexGroups() ([]*string, error)

type ErrorAlertEvent

type ErrorAlertEvent struct {
	ID            int64 `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	ErrorAlertID  int   `gorm:"index:idx_error_alert_event"`
	ErrorObjectID int   `gorm:"index:idx_error_alert_event"`
	SentAt        time.Time
}

type ErrorComment

type ErrorComment struct {
	Model
	Admins        []Admin `gorm:"many2many:error_comment_admins;"`
	ProjectID     int     `json:"project_id"`
	AdminId       int
	ErrorId       int
	ErrorSecureId string `gorm:"index;not null;default:''"`
	Text          string
	Attachments   []*ExternalAttachment `gorm:"foreignKey:ErrorCommentID"`
	Replies       []*CommentReply       `gorm:"foreignKey:ErrorCommentID"`
	Followers     []*CommentFollower    `gorm:"foreignKey:ErrorCommentID"`
	Threads       []*CommentSlackThread `gorm:"foreignKey:ErrorCommentID"`
}

type ErrorFingerprint

type ErrorFingerprint struct {
	Model
	ProjectID    int
	ErrorGroupId int
	Type         FingerprintType
	Value        string
	Index        int
}

type ErrorGroup

type ErrorGroup struct {
	Model
	// The ID used publicly for the URL on the client; used for sharing
	SecureID         string `json:"secure_id" gorm:"uniqueIndex;not null;default:secure_id_generator()"`
	ProjectID        int    `json:"project_id"`
	Event            string
	Type             string
	Trace            string //DEPRECATED, USE STACKTRACE INSTEAD
	StackTrace       string
	MappedStackTrace *string
	State            modelInputs.ErrorState `json:"state" gorm:"default:OPEN"`
	SnoozedUntil     *time.Time             `json:"snoozed_until"`
	Fingerprints     []*ErrorFingerprint
	FieldGroup       *string
	Environments     string
	IsPublic         bool                                 `gorm:"default:false"`
	ErrorFrequency   []int64                              `gorm:"-"`
	ErrorMetrics     []*modelInputs.ErrorDistributionItem `gorm:"-"`
	FirstOccurrence  *time.Time                           `gorm:"-"`
	LastOccurrence   *time.Time                           `gorm:"-"`
	ErrorObjects     []ErrorObject
	ServiceName      string

	// manually migrate as gorm wants to make this have a default value otherwise
	ErrorTagID *int      `gorm:"-:migration"`
	ErrorTag   *ErrorTag `gorm:"-:migration"`

	// Represents the admins that have viewed this session.
	ViewedByAdmins []Admin `json:"viewed_by_admins" gorm:"many2many:error_group_admins_views;"`
	Viewed         *bool   `json:"viewed"`
}

func (*ErrorGroup) GetSlackAttachment

func (e *ErrorGroup) GetSlackAttachment(attachment *slack.Attachment) error

type ErrorGroupActivityLog

type ErrorGroupActivityLog struct {
	Model
	ErrorGroupID int `gorm:"index"`
	AdminID      int // when this is 0, it means the system generated the event
	Admin        *Admin
	EventType    ErrorGroupEventType
	EventData    JSONB
}

type ErrorGroupAdminsView

type ErrorGroupAdminsView struct {
	ErrorGroupID int       `gorm:"primaryKey"`
	AdminID      int       `gorm:"primaryKey"`
	ViewedAt     time.Time `gorm:"default:NOW()"`
}

type ErrorGroupEmbeddings

type ErrorGroupEmbeddings struct {
	Model
	ProjectID         int `gorm:"uniqueIndex:idx_project_id_error_group_id"`
	ErrorGroupID      int `gorm:"uniqueIndex:idx_project_id_error_group_id"`
	Count             int
	GteLargeEmbedding Vector `gorm:"type:vector(1024)"` // 1024 dimensions in the thenlper/gte-large model
}

type ErrorGroupEventType

type ErrorGroupEventType string
const (
	ErrorGroupResolvedEvent ErrorGroupEventType = "ErrorGroupResolved"
	ErrorGroupIgnoredEvent  ErrorGroupEventType = "ErrorGroupIgnored"
	ErrorGroupOpenedEvent   ErrorGroupEventType = "ErrorGroupOpened"
)

type ErrorGroupingMethod

type ErrorGroupingMethod string
const (
	ErrorGroupingMethodClassic             ErrorGroupingMethod = "Classic"
	ErrorGroupingMethodAdaEmbeddingV2      ErrorGroupingMethod = "AdaV2"
	ErrorGroupingMethodGteLargeEmbeddingV2 ErrorGroupingMethod = "thenlper/gte-large"
	ErrorGroupingMethodGteLargeEmbeddingV3 ErrorGroupingMethod = "thenlper/gte-large.v3"
)

type ErrorInstance

type ErrorInstance struct {
	ErrorObject ErrorObject `json:"error_object"`
	NextID      *int        `json:"next_id"`
	PreviousID  *int        `json:"previous_id"`
}

type ErrorObject

type ErrorObject struct {
	Model
	ID                      int  `gorm:"primary_key;type:integer;autoIncrement;index:idx_error_group_id_id,priority:2,option:CONCURRENTLY" json:"id" deep:"-"`
	ProjectID               int  `json:"project_id"`
	SessionID               *int `gorm:"type:integer"`
	TraceID                 *string
	SpanID                  *string
	LogCursor               *string `gorm:"index:idx_error_object_log_cursor,option:CONCURRENTLY"`
	ErrorGroupID            int     `gorm:"index:idx_error_group_id_id,priority:1,option:CONCURRENTLY;type:integer"`
	ErrorGroupIDAlternative int     // the alternative algorithm for grouping the object
	ErrorGroupingMethod     ErrorGroupingMethod
	ErrorGroup              ErrorGroup
	Event                   string
	Type                    string
	URL                     string
	Source                  string
	LineNumber              int `gorm:"type:integer"`
	ColumnNumber            int `gorm:"type:integer"`
	OS                      string
	Browser                 string
	Trace                   *string `json:"trace"` //DEPRECATED, USE STACKTRACE INSTEAD
	StackTrace              *string `json:"stack_trace"`
	MappedStackTrace        *string
	Timestamp               time.Time `json:"timestamp"`
	Payload                 *string   `json:"payload"`
	Environment             string
	RequestID               *string // From X-Highlight-Request header
	IsBeacon                bool    `gorm:"default:false"`
	ServiceName             string
	ServiceVersion          string
}

type ErrorObjectEmbeddings

type ErrorObjectEmbeddings struct {
	Model
	ProjectID         int
	ErrorObjectID     int
	CombinedEmbedding Vector `gorm:"type:vector(1536)"` // 1536 dimensions in the AdaEmbeddingV2 model
	GteLargeEmbedding Vector `gorm:"type:vector(1024)"` // 1024 dimensions in the thenlper/gte-large model
}

type ErrorResults

type ErrorResults struct {
	ErrorGroups []ErrorGroup
	TotalCount  int64
}

type ErrorTag

type ErrorTag struct {
	Model
	Title       string `gorm:"uniqueIndex;not null"`
	Description string
	Embedding   Vector `gorm:"type:vector(1024)"` // 1024 dimensions in the thenlper/gte-large
}

type ErrorsHistogram

type ErrorsHistogram struct {
	BucketTimes  []time.Time `json:"bucket_times"`
	ErrorObjects []int64     `json:"error_objects"`
}

type EventChunk

type EventChunk struct {
	Model
	SessionID  int `gorm:"index"`
	ChunkIndex int
	Timestamp  int64
}

type EventsCursor

type EventsCursor struct {
	EventIndex       int
	EventObjectIndex *int
}

For a given session, an EventCursor is the address of an event in the list of events, that can be used for incremental fetching. The EventIndex must always be specified, with the EventObjectIndex optionally specified for optimization purposes.

type EventsObject

type EventsObject struct {
	Model
	ID        int `json:"id"` // Shadow Model.ID to avoid creating a pkey constraint
	SessionID int
	Events    string
	IsBeacon  bool `gorm:"default:false"`
}

func (*EventsObject) Contents

func (m *EventsObject) Contents() string

type ExternalAttachment

type ExternalAttachment struct {
	Model
	IntegrationType modelInputs.IntegrationType

	ExternalID string
	Title      string

	SessionCommentID int `gorm:"index"`
	ErrorCommentID   int `gorm:"index"`

	Removed bool `gorm:"default:false"`
}

type Field

type Field struct {
	Int64Model
	// 'user_property', 'session_property'.
	Type string `gorm:"uniqueIndex:idx_fields_type_name_value_project_id"`
	// 'email', 'identifier', etc.
	Name string `gorm:"uniqueIndex:idx_fields_type_name_value_project_id"`
	// 'email@email.com'
	Value     string    `gorm:"uniqueIndex:idx_fields_type_name_value_project_id"`
	ProjectID int       `json:"project_id" gorm:"uniqueIndex:idx_fields_type_name_value_project_id"`
	Sessions  []Session `gorm:"many2many:session_fields;"`
	Timestamp time.Time `json:"timestamp"`
}

type FingerprintType

type FingerprintType string

type Graph

type Graph struct {
	Model
	VisualizationID   int `gorm:"index"`
	Type              string
	Title             string
	Description       string
	ProductType       modelInputs.ProductType
	Query             string
	Metric            string
	FunctionType      modelInputs.MetricAggregator
	GroupByKeys       pq.StringArray `gorm:"type:text[]"`
	BucketByKey       *string
	BucketCount       *int
	BucketInterval    *int
	Limit             *int
	LimitFunctionType *modelInputs.MetricAggregator
	LimitMetric       *string
	FunnelSteps       *string `gorm:"type:jsonb"`
	Display           *string
	NullHandling      *string
	Expressions       *string `gorm:"type:jsonb"`
}

type HasSecret

type HasSecret interface {
	GetSecret() *string
}

type IAlert

type IAlert interface {
	GetChannelsToNotify() ([]*modelInputs.SanitizedSlackChannel, error)
	GetName() string
}

type Int64Model

type Int64Model struct {
	ID        int64      `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	CreatedAt time.Time  `json:"created_at" deep:"-"`
	UpdatedAt time.Time  `json:"updated_at" deep:"-"`
	DeletedAt *time.Time `json:"deleted_at" deep:"-"`
}

type IntegrationProjectMapping

type IntegrationProjectMapping struct {
	// idx_integration_project_mapping_integration_type_external_id is used to find a project for a given integration by its external id
	IntegrationType modelInputs.IntegrationType `gorm:"index:idx_integration_project_mapping_integration_type_external_id"`
	ProjectID       int
	ExternalID      string `gorm:"index:idx_integration_project_mapping_integration_type_external_id"`
}

type IntegrationWorkspaceMapping

type IntegrationWorkspaceMapping struct {
	IntegrationType modelInputs.IntegrationType `gorm:"primary_key;not null"`
	WorkspaceID     int                         `gorm:"primary_key;not null"`
	AccessToken     string                      `gorm:"not null"`
	RefreshToken    string
	Expiry          time.Time
}

type JSONB

type JSONB map[string]interface{}

Implement JSONB interface

func (*JSONB) Scan

func (j *JSONB) Scan(value interface{}) error

func (JSONB) Value

func (j JSONB) Value() (driver.Value, error)

type LengthRange

type LengthRange struct {
	Min float64
	Max float64
}

type LogAdminsView

type LogAdminsView struct {
	ID       int       `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	ViewedAt time.Time `gorm:"default:NOW()"`
	AdminID  int       `gorm:"primaryKey"`
}

type LogAlert

type LogAlert struct {
	Model
	AlertDeprecated
	Query          string
	BelowThreshold bool
	AlertIntegrations
}

type LogAlertEvent

type LogAlertEvent struct {
	ID         int64     `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	LogAlertID int       `gorm:"index:idx_log_alert_event"`
	Query      string    `gorm:"index:idx_log_alert_event"`
	StartDate  time.Time `gorm:"index:idx_log_alert_event"`
	EndDate    time.Time `gorm:"index:idx_log_alert_event"`
	SentAt     time.Time
}

type MarkBackendSetupType

type MarkBackendSetupType = string
const (
	// Generic is temporary and can be removed once all messages are processed.
	MarkBackendSetupTypeGeneric MarkBackendSetupType = "generic"
	MarkBackendSetupTypeSession MarkBackendSetupType = "session"
	MarkBackendSetupTypeError   MarkBackendSetupType = "error"
	MarkBackendSetupTypeLogs    MarkBackendSetupType = "logs"
	MarkBackendSetupTypeTraces  MarkBackendSetupType = "traces"
)

type MatchedErrorObject

type MatchedErrorObject struct {
	ErrorObject
	Score float64 `json:"score"`
}

type MessagesObject

type MessagesObject struct {
	Model
	ID        int `json:"id"` // Shadow Model.ID to avoid creating a pkey constraint
	SessionID int
	Messages  string
	IsBeacon  bool `gorm:"default:false"`
}

func (*MessagesObject) Contents

func (m *MessagesObject) Contents() string

type Metric

type Metric struct {
	CreatedAt     time.Time `json:"created_at" deep:"-"`
	MetricGroupID int       `gorm:"index"`
	Name          string
	Value         float64
	Category      string
}

type MetricGroup

type MetricGroup struct {
	ID        int `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	GroupName string
	SessionID int
	ProjectID int
	Metrics   []*Metric `gorm:"foreignKey:MetricGroupID;"`
}

type MetricMonitor

type MetricMonitor struct {
	Model
	ProjectID         int `gorm:"index;not null;"`
	Name              string
	Aggregator        modelInputs.MetricAggregator `gorm:"default:P50"`
	PeriodMinutes     *int                         // apply aggregator function on PeriodMinutes lookback
	Threshold         float64
	Units             *string // Threshold value is in these Units.
	MetricToMonitor   string
	ChannelsToNotify  *string                  `gorm:"channels_to_notify"`
	EmailsToNotify    *string                  `gorm:"emails_to_notify"`
	LastAdminToEditID int                      `gorm:"last_admin_to_edit_id"`
	Disabled          *bool                    `gorm:"default:false"`
	Filters           []*DashboardMetricFilter `gorm:"foreignKey:MetricMonitorID"`
	AlertIntegrations
}

func (*MetricMonitor) GetChannelsToNotify

func (obj *MetricMonitor) GetChannelsToNotify() ([]*modelInputs.SanitizedSlackChannel, error)

func (*MetricMonitor) GetId

func (obj *MetricMonitor) GetId() int

func (*MetricMonitor) GetName

func (obj *MetricMonitor) GetName() string

type MicrosoftTeamsChannel

type MicrosoftTeamsChannel struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type MicrosoftTeamsChannels

type MicrosoftTeamsChannels []*MicrosoftTeamsChannel

func (*MicrosoftTeamsChannels) Scan

func (dc *MicrosoftTeamsChannels) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (MicrosoftTeamsChannels) Value

func (dc MicrosoftTeamsChannels) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type MicrosoftTeamsTeam

type MicrosoftTeamsTeam struct {
	ID string `json:"id"`
}

type Model

type Model struct {
	ID        int        `gorm:"primary_key;type:integer;autoIncrement" json:"id" deep:"-"`
	CreatedAt time.Time  `json:"created_at" deep:"-"`
	UpdatedAt time.Time  `json:"updated_at" deep:"-"`
	DeletedAt *time.Time `json:"deleted_at" deep:"-"`
}

type OAuthClientStore

type OAuthClientStore struct {
	ID        string         `gorm:"primary_key;default:uuid_generate_v4()"`
	CreatedAt time.Time      `json:"created_at" deep:"-"`
	Secret    string         `gorm:"uniqueIndex;not null"`
	Domains   pq.StringArray `gorm:"not null;type:text[]"`
	AppName   string

	AdminID int
	Admin   *Admin

	Operations []*OAuthOperation `gorm:"foreignKey:ClientID"`
}

type OAuthOperation

type OAuthOperation struct {
	Model
	ClientID                   string
	AuthorizedGraphQLOperation string
	MinuteRateLimit            int64 `gorm:"default:600"`
}

type Object

type Object interface {
	Contents() string
}

type Organization

type Organization struct {
	Model
	Name         *string
	BillingEmail *string
	Secret       *string    `json:"-"`
	Admins       []Admin    `gorm:"many2many:organization_admins;"`
	TrialEndDate *time.Time `json:"trial_end_date"`
	// Slack API Interaction.
	SlackAccessToken      *string
	SlackWebhookURL       *string
	SlackWebhookChannel   *string
	SlackWebhookChannelID *string
	SlackChannels         *string
	// Manual monthly session limit override
	MonthlySessionLimit *int
}

type Param

type Param struct {
	Action string `json:"action"`
	Type   string `json:"type"`
	Value  struct {
		Text  string `json:"text"`
		Value string `json:"value"`
	} `json:"value"`
}

Params used for reading from search requests.

func DecodeAndValidateParams

func DecodeAndValidateParams(params []interface{}) ([]*Param, error)

type PricingProductType

type PricingProductType string
const (
	PricingProductTypeBase     PricingProductType = "BASE"
	PricingProductTypeMembers  PricingProductType = "MEMBERS"
	PricingProductTypeSessions PricingProductType = "SESSIONS"
	PricingProductTypeErrors   PricingProductType = "ERRORS"
	PricingProductTypeLogs     PricingProductType = "LOGS"
	PricingProductTypeTraces   PricingProductType = "TRACES"
)

type PricingSubscriptionInterval

type PricingSubscriptionInterval string
const (
	PricingSubscriptionIntervalMonthly PricingSubscriptionInterval = "MONTHLY"
	PricingSubscriptionIntervalAnnual  PricingSubscriptionInterval = "ANNUAL"
)

type Project

type Project struct {
	Model
	Name              *string
	ZapierAccessToken *string
	BillingEmail      *string
	Secret            *string    `json:"-"`
	TrialEndDate      *time.Time `json:"trial_end_date"`
	// Manual monthly session limit override
	MonthlySessionLimit *int
	WorkspaceID         int
	Workspace           *Workspace
	FreeTier            bool           `gorm:"default:false"`
	ExcludedUsers       pq.StringArray `json:"excluded_users" gorm:"type:text[]"`
	ErrorFilters        pq.StringArray `gorm:"type:text[]"`
	ErrorJsonPaths      pq.StringArray `gorm:"type:text[]"`

	// BackendSetup will be true if this is the session where HighlightBackend is run for the first time
	BackendSetup *bool         `json:"backend_setup"`
	SetupEvent   []*SetupEvent `gorm:"foreignKey:ProjectID"`

	// Maximum time window considered for a rage click event
	RageClickWindowSeconds int `gorm:"default:5"`
	// Maximum distance between clicks for a rage click event
	RageClickRadiusPixels int `gorm:"default:8"`
	// Minimum count of clicks in a rage click event
	RageClickCount int `gorm:"default:5"`

	// Applies to all browser extensions
	// TODO - rename to FilterBrowserExtension #5811
	FilterChromeExtension *bool `gorm:"default:false"`
}

func (*Project) BeforeCreate

func (u *Project) BeforeCreate(tx *gorm.DB) (err error)

func (*Project) GetSecret

func (project *Project) GetSecret() *string

func (*Project) VerboseID

func (u *Project) VerboseID() string

type ProjectAssetTransform

type ProjectAssetTransform struct {
	ProjectID         int    `gorm:"primary_key:not null"`
	SourceScheme      string `gorm:"primary_key:not null"`
	DestinationScheme string
	DestinationHost   string
}

type ProjectFilterSettings

type ProjectFilterSettings struct {
	Model
	Project                           *Project
	ProjectID                         int
	FilterSessionsWithoutError        bool    `gorm:"default:false"`
	AutoResolveStaleErrorsDayInterval int     `gorm:"default:0"`
	SessionSamplingRate               float64 `gorm:"default:1"`
	ErrorSamplingRate                 float64 `gorm:"default:1"`
	LogSamplingRate                   float64 `gorm:"default:1"`
	TraceSamplingRate                 float64 `gorm:"default:1"`
	SessionMinuteRateLimit            *int64
	ErrorMinuteRateLimit              *int64
	LogMinuteRateLimit                *int64
	TraceMinuteRateLimit              *int64
	SessionExclusionQuery             *string
	ErrorExclusionQuery               *string
	LogExclusionQuery                 *string
	TraceExclusionQuery               *string
}

type RageClickEvent

type RageClickEvent struct {
	Model
	ProjectID       int    `deep:"-"`
	SessionSecureID string `deep:"-"`
	TotalClicks     int
	StartTimestamp  time.Time `deep:"-"`
	EndTimestamp    time.Time `deep:"-"`
}

type RawPayloadType

type RawPayloadType string
const (
	PayloadTypeEvents          RawPayloadType = "raw-events"
	PayloadTypeResources       RawPayloadType = "raw-resources"
	PayloadTypeWebSocketEvents RawPayloadType = "raw-web-socket-events"
)

type RegistrationData

type RegistrationData struct {
	Model
	WorkspaceID int
	TeamSize    *string
	Role        *string
	UseCase     *string
	HeardAbout  *string
	Pun         *string
}

type ResourcesObject

type ResourcesObject struct {
	Model
	ID        int `json:"id"` // Shadow Model.ID to avoid creating a pkey constraint
	SessionID int
	Resources string
	IsBeacon  bool `gorm:"default:false"`
}

func (*ResourcesObject) Contents

func (r *ResourcesObject) Contents() string

type ResthookSubscription

type ResthookSubscription struct {
	Model
	ProjectID int     `json:"project_id"`
	Event     *string `json:"event"`
	TargetUrl *string `json:"target_url"`
}

type Retryable

type Retryable struct {
	Model
	Type        RetryableType
	PayloadType string
	PayloadID   string
	Payload     JSONB `gorm:"type:jsonb"`
	Error       string
}

type RetryableType

type RetryableType string
const (
	RetryableOpensearchError RetryableType = "OPENSEARCH_ERROR"
)

type SavedAsset

type SavedAsset struct {
	ProjectID   int    `gorm:"uniqueIndex:idx_saved_assets_project_id_original_url_date;index:idx_project_id_hash_val"`
	OriginalUrl string `gorm:"uniqueIndex:idx_saved_assets_project_id_original_url_date"`
	Date        string `gorm:"uniqueIndex:idx_saved_assets_project_id_original_url_date"`
	HashVal     string `gorm:"index:idx_project_id_hash_val"`
}

type SavedSegment

type SavedSegment struct {
	Model
	Name       string
	EntityType modelInputs.SavedSegmentEntityType `gorm:"index:idx_saved_segment,priority:2"`
	Params     string                             `json:"params"`
	ProjectID  int                                `gorm:"index:idx_saved_segment,priority:1" json:"project_id"`
}

type SearchParams

type SearchParams struct {
	Query *string `json:"query"`
}

type SendWelcomeSlackMessageInput

type SendWelcomeSlackMessageInput struct {
	Workspace            *Workspace
	Admin                *Admin
	OperationName        string
	OperationDescription string
	ID                   int
	Project              *Project
	IncludeEditLink      bool
	URLSlug              string
}

type Service

type Service struct {
	Model
	ProjectID          int                       `gorm:"not null;uniqueIndex:idx_project_id_name"`
	Name               string                    `gorm:"not null;uniqueIndex:idx_project_id_name"`
	Status             modelInputs.ServiceStatus `gorm:"not null;default:created"`
	GithubRepoPath     *string
	BuildPrefix        *string
	GithubPrefix       *string
	ErrorDetails       pq.StringArray `gorm:"type:text[]"`
	ProcessName        *string
	ProcessVersion     *string
	ProcessDescription *string
}

type Session

type Session struct {
	Model
	// The ID used publicly for the URL on the client; used for sharing
	SecureID string `json:"secure_id" gorm:"uniqueIndex;not null;default:secure_id_generator()"`
	// For associating unidentified sessions with a user after identification
	ClientID string `json:"client_id" gorm:"not null;default:''"`
	// Whether a session has been identified.
	Identified  bool `json:"identified" gorm:"default:false;not null"`
	Fingerprint int  `json:"fingerprint"`
	// User provided identifier (see IdentifySession)
	Identifier string  `json:"identifier"`
	ProjectID  int     `json:"project_id"`
	Email      *string `json:"email"`
	// Location data based off user ip (see InitializeSession)
	IP        string  `json:"ip"`
	City      string  `json:"city"`
	State     string  `json:"state"`
	Postal    string  `json:"postal"`
	Country   string  `json:"country"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	// Details based off useragent (see Initialize Session)
	OSName         string `json:"os_name"`
	OSVersion      string `json:"os_version"`
	BrowserName    string `json:"browser_name"`
	BrowserVersion string `json:"browser_version"`
	Language       string `json:"language"`
	// Tells us if 'beforeunload' was fired on the client - note this is not necessarily fired on every session end
	HasUnloaded bool `gorm:"default:false"`
	// Tells us if the session has been parsed by a worker.
	Processed           *bool `json:"processed"`
	HasComments         bool  `json:"has_comments" gorm:"default:false"`
	HasRageClicks       *bool `json:"has_rage_clicks"`
	HasErrors           *bool `json:"has_errors"`
	HasOutOfOrderEvents bool  `gorm:"default:false"`
	// The timestamp of the first payload received after the session got processed (if applicable)
	ResumedAfterProcessedTime *time.Time `json:"resumed_after_processed_time"`
	// The length of a session.
	Length         int64    `json:"length"`
	ActiveLength   int64    `json:"active_length"`
	Fields         []*Field `json:"fields" gorm:"many2many:session_fields;"`
	Environment    string   `json:"environment"`
	AppVersion     *string  `json:"app_version"`
	ServiceName    string
	UserObject     JSONB  `json:"user_object" gorm:"type:jsonb"`
	UserProperties string `json:"user_properties"`
	// Whether this is the first session created by this user.
	FirstTime               *bool      `json:"first_time" gorm:"default:false"`
	PayloadUpdatedAt        *time.Time `json:"payload_updated_at"`
	LastUserInteractionTime time.Time  `json:"last_user_interaction_time"`
	// Set if the last payload was a beacon; cleared on the next non-beacon payload
	BeaconTime *time.Time `json:"beacon_time"`
	// Custom properties
	Viewed                         *bool   `json:"viewed"`
	Starred                        *bool   `json:"starred"`
	FieldGroup                     *string `json:"field_group"`
	EnableStrictPrivacy            *bool   `json:"enable_strict_privacy"`
	PrivacySetting                 *string `json:"privacy_setting"`
	EnableRecordingNetworkContents *bool   `json:"enable_recording_network_contents"`
	// The version of Highlight's Client.
	ClientVersion string `json:"client_version"`
	// The version of Highlight's Firstload.
	FirstloadVersion string `json:"firstload_version"`
	// The client configuration that the end-user sets up. This is used for debugging purposes.
	ClientConfig *string `json:"client_config" gorm:"type:jsonb"`
	// Determines whether this session should be viewable. This enforces billing.
	WithinBillingQuota *bool `json:"within_billing_quota" gorm:"default:true"`
	// Used for shareable links. No authentication is needed if IsPublic is true
	IsPublic bool `json:"is_public" gorm:"default:false"`
	// EventCounts is a len()=100 slice that contains the count of events for the session normalized over 100 points
	EventCounts *string
	// Number of pages visited during a session
	PagesVisited int

	ObjectStorageEnabled  *bool  `json:"object_storage_enabled"`
	DirectDownloadEnabled bool   `json:"direct_download_enabled" gorm:"default:false"`
	AllObjectsCompressed  bool   `json:"all_resources_compressed" gorm:"default:false"`
	PayloadSize           *int64 `json:"payload_size"`
	VerboseID             string `json:"verbose_id"`

	// Excluded will be true when we would typically have deleted the session
	Excluded       bool `gorm:"default:false"`
	ExcludedReason *modelInputs.SessionExcludedReason

	// Lock is the timestamp at which a session was locked
	// - when selecting sessions, ignore Locks that are > 10 minutes old
	//   ex. SELECT * FROM sessions WHERE (lock IS NULL OR lock < NOW() - 10 * (INTERVAL '1 MINUTE'))
	Lock sql.NullTime

	RetryCount int

	// Represents the admins that have viewed this session.
	ViewedByAdmins []Admin `json:"viewed_by_admins" gorm:"many2many:session_admins_views;"`

	Chunked          *bool
	ProcessWithRedis bool
	Normalness       *float64
}

func (*Session) BeforeCreate

func (s *Session) BeforeCreate(tx *gorm.DB) (err error)

func (*Session) GetSlackAttachment

func (s *Session) GetSlackAttachment(attachment *slack.Attachment) error

func (*Session) GetUserProperties

func (s *Session) GetUserProperties() (map[string]string, error)

func (*Session) SetUserProperties

func (s *Session) SetUserProperties(userProperties map[string]string) error

type SessionAdminsView

type SessionAdminsView struct {
	SessionID int       `gorm:"primaryKey"`
	AdminID   int       `gorm:"primaryKey"`
	ViewedAt  time.Time `gorm:"default:NOW()"`
}

type SessionAlert

type SessionAlert struct {
	Model
	AlertDeprecated
	TrackProperties *string
	UserProperties  *string
	ExcludeRules    *string
	AlertIntegrations
}

func (*SessionAlert) GetExcludeRules

func (obj *SessionAlert) GetExcludeRules() ([]*string, error)

func (*SessionAlert) GetTrackProperties

func (obj *SessionAlert) GetTrackProperties() ([]*TrackProperty, error)

func (*SessionAlert) GetUserProperties

func (obj *SessionAlert) GetUserProperties() ([]*UserProperty, error)

type SessionAlertEvent

type SessionAlertEvent struct {
	ID              int64  `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	SessionAlertID  int    `gorm:"index:idx_session_alert_event"`
	SessionSecureID string `gorm:"index:idx_session_alert_event"`
	SentAt          time.Time
}

type SessionComment

type SessionComment struct {
	Model
	Admins          []Admin `gorm:"many2many:session_comment_admins;"`
	ProjectID       int     `json:"project_id"`
	AdminId         int     `gorm:"type:integer"`
	SessionId       int     `gorm:"type:integer"`
	SessionSecureId string  `gorm:"index;not null;default:''"`
	SessionImage    string
	Timestamp       int `gorm:"type:integer"`
	Text            string
	XCoordinate     float64
	YCoordinate     float64
	Type            string                `json:"type" gorm:"default:ADMIN"`
	Metadata        JSONB                 `json:"metadata" gorm:"type:jsonb"`
	Tags            []*SessionCommentTag  `json:"tags" gorm:"many2many:session_tags;"`
	Attachments     []*ExternalAttachment `gorm:"foreignKey:SessionCommentID"`
	Replies         []*CommentReply       `gorm:"foreignKey:SessionCommentID"`
	Followers       []*CommentFollower    `gorm:"foreignKey:SessionCommentID"`
	Threads         []*CommentSlackThread `gorm:"foreignKey:SessionCommentID"`
}

type SessionCommentTag

type SessionCommentTag struct {
	Model
	SessionComments []SessionComment `json:"session_comments" gorm:"many2many:session_tags;"`
	ProjectID       int              `json:"project_id"`
	Name            string
}

type SessionData

type SessionData struct {
	Data string
}

func (*SessionData) Contents

func (sd *SessionData) Contents() string

type SessionExport

type SessionExport struct {
	Model
	SessionID    int                 `gorm:"uniqueIndex:idx_session_exports"`
	Type         SessionExportFormat `gorm:"uniqueIndex:idx_session_exports"`
	URL          string
	Error        string
	TargetEmails pq.StringArray `gorm:"type:text[];"`
}

type SessionExportFormat

type SessionExportFormat = string
const (
	SessionExportFormatMP4 SessionExportFormat = "video/mp4"
	SessionExportFormatGif SessionExportFormat = "image/gif"
	SessionExportFormatPng SessionExportFormat = "image/png"
)

type SessionInsight

type SessionInsight struct {
	Model
	SessionID int `gorm:"index"`
	Insight   string
}

type SessionInterval

type SessionInterval struct {
	Model
	ID              int64  `gorm:"primary_key;type:bigint;autoIncrement" json:"id" deep:"-"`
	SessionSecureID string `gorm:"index" json:"secure_id"`
	StartTime       time.Time
	EndTime         time.Time
	Duration        int
	Active          bool
}

type SessionPayload

type SessionPayload struct {
	Events                  []interface{}    `json:"events"`
	Errors                  []ErrorObject    `json:"errors"`
	RageClicks              []RageClickEvent `json:"rage_clicks"`
	SessionComments         []SessionComment `json:"session_comments"`
	LastUserInteractionTime time.Time        `json:"last_user_interaction_time"`
}

type SessionResults

type SessionResults struct {
	Sessions          []Session
	TotalCount        int64
	TotalLength       int64
	TotalActiveLength int64
}

type SessionsHistogram

type SessionsHistogram struct {
	BucketTimes           []time.Time `json:"bucket_times"`
	SessionsWithoutErrors []int64     `json:"sessions_without_errors"`
	SessionsWithErrors    []int64     `json:"sessions_with_errors"`
	InactiveLengths       []int64     `json:"inactive_lengths"`
	ActiveLengths         []int64     `json:"active_lengths"`
	TotalSessions         []int64     `json:"total_sessions"`
}

type SetupEvent

type SetupEvent struct {
	ID        int                  `gorm:"primary_key;type:integer;autoIncrement" json:"id" deep:"-"`
	CreatedAt time.Time            `json:"created_at" deep:"-"`
	ProjectID int                  `gorm:"uniqueIndex:idx_project_id_type"`
	Type      MarkBackendSetupType `gorm:"uniqueIndex:idx_project_id_type"`
}

type SlackChannel

type SlackChannel struct {
	WebhookAccessToken string
	WebhookURL         string
	WebhookChannel     string
	WebhookChannelID   string
}

type SystemConfiguration

type SystemConfiguration struct {
	Active            bool `gorm:"primary_key"`
	MaintenanceStart  time.Time
	MaintenanceEnd    time.Time
	ErrorFilters      pq.StringArray `gorm:"type:text[]"`
	IgnoredFiles      pq.StringArray `gorm:"type:text[]"`
	MainWorkers       int            `gorm:"default:64"`
	LogsWorkers       int            `gorm:"default:1"`
	LogsFlushSize     int            `gorm:"type:bigint;default:1000"`
	LogsQueueSize     int            `gorm:"type:bigint;default:100"`
	LogsFlushTimeout  time.Duration  `gorm:"type:bigint;default:1000000000"`
	DataSyncWorkers   int            `gorm:"default:1"`
	DataSyncFlushSize int            `gorm:"type:bigint;default:1000"`
	DataSyncQueueSize int            `gorm:"type:bigint;default:100"`
	DataSyncTimeout   time.Duration  `gorm:"type:bigint;default:1000000000"`
	TraceWorkers      int            `gorm:"default:1"`
	TraceFlushSize    int            `gorm:"type:bigint;default:1000"`
	TraceQueueSize    int            `gorm:"type:bigint;default:100"`
	TraceFlushTimeout time.Duration  `gorm:"type:bigint;default:1000000000"`
}

func (*SystemConfiguration) BeforeCreate

func (s *SystemConfiguration) BeforeCreate(tx *gorm.DB) (err error)

type TableConfig

type TableConfig struct {
	TableName         string
	BodyColumn        string
	SeverityColumn    string
	AttributesColumns []ColumnMapping // A prefix -> column mapping. The column for the first matching prefix will be used.
	AttributesTable   string
	MetricColumn      *string
	KeysToColumns     map[string]string
	ReservedKeys      []string
	SelectColumns     []string
	DefaultFilter     string
	IgnoredFilters    map[string]bool
}

type TimelineIndicatorEvent

type TimelineIndicatorEvent struct {
	Model
	ID              int    `json:"id"` // Shadow Model.ID to avoid creating a pkey constraint
	SessionSecureID string `gorm:"index" json:"secure_id"`
	Timestamp       float64
	Type            int
	SID             float64
	Data            JSONB `json:"data" gorm:"type:jsonb"`
}

type TrackProperty

type TrackProperty struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

type UserJourneyStep

type UserJourneyStep struct {
	CreatedAt time.Time `json:"created_at" deep:"-"`
	ProjectID int
	SessionID int `gorm:"primary_key;not null"`
	Index     int `gorm:"primary_key;not null"`
	Url       string
	NextUrl   string
}

type UserProperty

type UserProperty struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Vector

type Vector []float32

Vector is serialized as '[-0.0123,0.456]' aka like a json list

func (*Vector) Scan

func (j *Vector) Scan(value interface{}) error

func (Vector) Value

func (j Vector) Value() (driver.Value, error)

type VercelIntegrationConfig

type VercelIntegrationConfig struct {
	WorkspaceID     int `gorm:"uniqueIndex:idx_workspace_id_vercel_project_id;index"`
	ProjectID       int
	VercelProjectID string `gorm:"uniqueIndex:idx_workspace_id_vercel_project_id"`
}

type Visualization

type Visualization struct {
	Model
	ProjectID        int `gorm:"index"`
	Name             string
	UpdatedByAdminId *int
	UpdatedByAdmin   *Admin        `gorm:"foreignKey:UpdatedByAdminId"`
	GraphIds         pq.Int32Array `gorm:"type:integer[]"`
	Graphs           []Graph
	TimePreset       *string
	Variables        string
}

type VisualizationsResponse

type VisualizationsResponse struct {
	Count   int
	Results []Visualization
}

type WebhookDestination

type WebhookDestination struct {
	URL           string
	Authorization *string
}

type WebhookDestinations

type WebhookDestinations []*WebhookDestination

func (*WebhookDestinations) Scan

func (dc *WebhookDestinations) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (WebhookDestinations) Value

func (dc WebhookDestinations) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type Workspace

type Workspace struct {
	Model
	Name                        *string
	Secret                      *string // Needed for workspace-level team
	Admins                      []Admin `gorm:"many2many:workspace_admins;"`
	SlackAccessToken            *string
	SlackWebhookURL             *string
	SlackWebhookChannel         *string
	SlackWebhookChannelID       *string
	JiraDomain                  *string
	JiraCloudID                 *string
	MicrosoftTeamsTenantId      *string
	SlackChannels               *string
	LinearAccessToken           *string
	VercelAccessToken           *string
	VercelTeamID                *string
	CloudflareProxy             *string
	Projects                    []Project
	MigratedFromProjectID       *int // Column can be removed after migration is done
	HubspotCompanyID            *int
	StripeCustomerID            *string
	AWSMarketplaceCustomer      *AWSMarketplaceCustomer `gorm:"foreignKey:WorkspaceID"`
	PlanTier                    string                  `gorm:"default:Free"`
	UnlimitedMembers            bool                    `gorm:"default:false"`
	BillingPeriodStart          *time.Time
	BillingPeriodEnd            *time.Time
	NextInvoiceDate             *time.Time
	MonthlySessionLimit         *int
	MonthlyMembersLimit         *int
	MonthlyErrorsLimit          *int
	MonthlyLogsLimit            *int
	MonthlyTracesLimit          *int
	RetentionPeriod             *modelInputs.RetentionPeriod `gorm:"default:SevenDays"`
	ErrorsRetentionPeriod       *modelInputs.RetentionPeriod `gorm:"default:SevenDays"`
	LogsRetentionPeriod         *modelInputs.RetentionPeriod `gorm:"default:ThirtyDays"`
	TracesRetentionPeriod       *modelInputs.RetentionPeriod `gorm:"default:ThirtyDays"`
	SessionsMaxCents            *int
	ErrorsMaxCents              *int
	LogsMaxCents                *int
	TracesMaxCents              *int
	StripeSessionOveragePriceID *string
	StripeErrorOveragePriceID   *string
	StripeLogOveragePriceID     *string
	StripeTracesOveragePriceID  *string
	TrialEndDate                *time.Time `json:"trial_end_date"`
	AllowMeterOverage           bool       `gorm:"default:true"`
	AllowedAutoJoinEmailOrigins *string    `json:"allowed_auto_join_email_origins"`
	EligibleForTrialExtension   bool       `gorm:"default:false"`
	TrialExtensionEnabled       bool       `gorm:"default:false"`
	ClearbitEnabled             bool       `gorm:"default:false"`
	DiscordGuildId              *string
	ClickupAccessToken          *string
	PromoCode                   *string
}

func (*Workspace) AdminEmailAddresses

func (w *Workspace) AdminEmailAddresses(db *gorm.DB) ([]struct {
	AdminID int
	Email   string
}, error)

func (*Workspace) BeforeCreate

func (u *Workspace) BeforeCreate(tx *gorm.DB) (err error)

func (*Workspace) GetRetentionPeriod

func (w *Workspace) GetRetentionPeriod() modelInputs.RetentionPeriod

func (*Workspace) GetSecret

func (workspace *Workspace) GetSecret() *string

func (*Workspace) IntegratedSlackChannels

func (u *Workspace) IntegratedSlackChannels() ([]SlackChannel, error)

type WorkspaceAccessRequest

type WorkspaceAccessRequest struct {
	Model
	AdminID                int `gorm:"uniqueIndex"`
	LastRequestedWorkspace int
}

type WorkspaceAdmin

type WorkspaceAdmin struct {
	AdminID     int           `gorm:"primaryKey"`
	WorkspaceID int           `gorm:"primaryKey"`
	CreatedAt   time.Time     `json:"created_at" deep:"-"`
	UpdatedAt   time.Time     `json:"updated_at" deep:"-"`
	DeletedAt   *time.Time    `json:"deleted_at" deep:"-"`
	Role        *string       `json:"role" gorm:"default:ADMIN"`
	ProjectIds  pq.Int32Array `gorm:"type:integer[]"`
}

type WorkspaceAdminRole

type WorkspaceAdminRole struct {
	WorkspaceId int
	Admin       *Admin
	Role        string
	ProjectIds  []int
}
type WorkspaceInviteLink struct {
	Model
	WorkspaceID    *int
	InviteeEmail   *string
	InviteeRole    *string
	ExpirationDate *time.Time
	Secret         *string
	ProjectIds     pq.Int32Array `gorm:"type:integer[]"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL