graph

package
v0.0.0-...-69ce26b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ERROR_EVENT_MAX_LENGTH = 10000
View Source
const PAYLOAD_STAGING_COUNT_MAX = 100
View Source
const SESSION_FIELD_MAX_LENGTH = 2000

Variables

View Source
var ErrUserFilteredError = e.New("User filtered error")
View Source
var NumberRegex = regexp.MustCompile(`^\d+$`)
View Source
var PropertyType = struct {
	USER    Property
	SESSION Property
	TRACK   Property
}{
	USER:    "user",
	SESSION: "session",
	TRACK:   "track",
}
View Source
var SessionProcessDelaySeconds = 120 // a session will be processed after not receiving events for this time
View Source
var SessionProcessLockMinutes = 30 // a session marked as processing can be reprocessed after this time

Functions

func ClampTime

func ClampTime(input time.Time, curTime time.Time) time.Time

If curTime is provided and the input is different by more than 2 hours, use curTime instead of the input.

func PublicMiddleware

func PublicMiddleware(next http.Handler) http.Handler

Types

type AlertCountsGroupedByRecent

type AlertCountsGroupedByRecent struct {
	Count       int64 `gorm:"column:count"`
	RecentAlert bool  `gorm:"column:recent_alert"`
}

type AppendProperty

type AppendProperty struct {
	Key       string
	Value     string
	Timestamp time.Time
}

type DeviceDetails

type DeviceDetails struct {
	IsBot          bool   `json:"is_bot"`
	OSName         string `json:"os_name"`
	OSVersion      string `json:"os_version"`
	BrowserName    string `json:"browser_name"`
	BrowserVersion string `json:"browser_version"`
}

func GetDeviceDetails

func GetDeviceDetails(userAgentString string) (deviceDetails DeviceDetails)

type ErrorMetaData

type ErrorMetaData struct {
	Timestamp   time.Time `json:"timestamp"`
	ErrorID     int       `json:"error_id"`
	SessionID   int       `json:"session_id"`
	Browser     string    `json:"browser"`
	OS          string    `json:"os"`
	VisitedURL  string    `json:"visited_url"`
	Identifier  string    `json:"identifier"`
	Fingerprint int       `json:"fingerprint"`
}

type FieldData

type FieldData struct {
	Name  string
	Value string
}

type Location

type Location struct {
	City      string      `json:"city"`
	Postal    string      `json:"postal"`
	Latitude  interface{} `json:"latitude"`
	Longitude interface{} `json:"longitude"`
	State     string      `json:"state"`
	Country   string      `json:"country_name"`
}

func GetLocationFromIP

func GetLocationFromIP(ctx context.Context, ip string) (location *Location, err error)

type NetworkResource

type NetworkResource struct {
	// Deprecated, use the absolute version `StartTimeAbs` instead
	StartTime float64 `json:"startTime"`
	// Deprecated, use the absolute version `ResponseEndAbs` instead
	ResponseEnd float64 `json:"responseEnd"`

	StartTimeAbs             float64              `json:"startTimeAbs"`
	ResponseEndAbs           float64              `json:"responseEndAbs"`
	ConnectStartAbs          float64              `json:"connectStartAbs"`
	ConnectEndAbs            float64              `json:"connectEndAbs"`
	DomainLookupStartAbs     float64              `json:"domainLookupStartAbs"`
	DomainLookupEndAbs       float64              `json:"domainLookupEndAbs"`
	FetchStartAbs            float64              `json:"fetchStartAbs"`
	RedirectStartAbs         float64              `json:"redirectStartAbs"`
	RedirectEndAbs           float64              `json:"redirectEndAbs"`
	RequestStartAbs          float64              `json:"requestStartAbs"`
	ResponseStartAbs         float64              `json:"responseStartAbs"`
	SecureConnectionStartAbs float64              `json:"secureConnectionStartAbs"`
	WorkerStartAbs           float64              `json:"workerStartAbs"`
	DecodedBodySize          float64              `json:"decodedBodySize"`
	TransferSize             float64              `json:"transferSize"`
	EncodedBodySize          float64              `json:"encodedBodySize"`
	NextHopProtocol          string               `json:"nextHopProtocol"`
	InitiatorType            string               `json:"initiatorType"`
	Name                     string               `json:"name"`
	RequestResponsePairs     RequestResponsePairs `json:"requestResponsePairs"`
}

func (*NetworkResource) End

func (re *NetworkResource) End(sessionStart time.Time) time.Time

func (*NetworkResource) Start

func (re *NetworkResource) Start(sessionStart time.Time) time.Time

type Property

type Property string

type PushPayloadChunk

type PushPayloadChunk struct {
	// contains filtered or unexported fields
}

type PushPayloadMessages

type PushPayloadMessages struct {
	Messages []*hlog.Message `json:"messages"`
}

type PushPayloadResources

type PushPayloadResources struct {
	Resources []*any `json:"resources"`
}

type PushPayloadWebSocketEvents

type PushPayloadWebSocketEvents struct {
	WebSocketEvents []*any `json:"webSocketEvents"`
}

type Request

type Request struct {
	ID         string `json:"id"`
	URL        string `json:"url"`
	Method     string `json:"verb"`
	HeadersRaw any    `json:"headers"`
	Body       any    `json:"body"`
}

type RequestResponsePairs

type RequestResponsePairs struct {
	Request    Request  `json:"request"`
	Response   Response `json:"response"`
	URLBlocked bool     `json:"urlBlocked"`
}

type Resolver

type Resolver struct {
	DB                *gorm.DB
	Tracer            trace.Tracer
	TracerNoResources trace.Tracer
	ProducerQueue     kafka_queue.MessageQueue
	BatchedQueue      kafka_queue.MessageQueue
	DataSyncQueue     kafka_queue.MessageQueue
	TracesQueue       kafka_queue.MessageQueue
	MailClient        *sendgrid.Client
	StorageClient     storage.Client
	EmbeddingsClient  embeddings.Client
	Redis             *redis.Client
	Clickhouse        *clickhouse.Client
	RH                *resthooks.Resthook
	Store             *store.Store
	LambdaClient      *lambda.Client
	SessionCache      *lru.Cache[string, *model.Session]
}

func (*Resolver) AddLegacyMetric

func (r *Resolver) AddLegacyMetric(ctx context.Context, sessionID int, name string, value float64) (int, error)

func (*Resolver) AddSessionEvents

func (r *Resolver) AddSessionEvents(ctx context.Context, sessionID int, events *parse.ReplayEvents) error

func (*Resolver) AddSessionFeedbackImpl

func (r *Resolver) AddSessionFeedbackImpl(ctx context.Context, input *kafka_queue.AddSessionFeedbackArgs) error

func (*Resolver) AddSessionPropertiesImpl

func (r *Resolver) AddSessionPropertiesImpl(ctx context.Context, sessionSecureID string, propertiesObject interface{}) error

func (*Resolver) AddTrackPropertiesImpl

func (r *Resolver) AddTrackPropertiesImpl(ctx context.Context, sessionSecureID string, propertiesObject interface{}) error

Deprecated, left for backward compatibility with older client versions. Use AddSessionEvents instead

func (*Resolver) AppendFields

func (r *Resolver) AppendFields(ctx context.Context, fields []*model.Field, session *model.Session) error

func (*Resolver) AppendProperties

func (r *Resolver) AppendProperties(ctx context.Context, sessionID int, properties []AppendProperty, propType Property) error

Change to AppendProperties(sessionId,properties,type)

func (*Resolver) GetErrorAppVersion

func (r *Resolver) GetErrorAppVersion(ctx context.Context, errorObj *model.ErrorObject) *string

func (*Resolver) GetOrCreateErrorGroup

func (r *Resolver) GetOrCreateErrorGroup(ctx context.Context, errorObj *model.ErrorObject, matchFn func() (*int, error), onCreateGroup func(int) error, tagGroup bool) (*model.ErrorGroup, error)

func (*Resolver) GetTopErrorGroupMatch

func (r *Resolver) GetTopErrorGroupMatch(ctx context.Context, event string, projectID int, fingerprints []*model.ErrorFingerprint) (*int, error)

func (*Resolver) GetTopErrorGroupMatchByEmbedding

func (r *Resolver) GetTopErrorGroupMatchByEmbedding(ctx context.Context, projectID int, method model.ErrorGroupingMethod, embedding model.Vector, threshold float64) (*int, error)

func (*Resolver) HandleErrorAndGroup

func (r *Resolver) HandleErrorAndGroup(ctx context.Context, errorObj *model.ErrorObject, structuredStackTrace []*privateModel.ErrorTrace, projectID int, workspace *model.Workspace) (*model.ErrorGroup, error)

HandleErrorAndGroup caches the result of handleErrorAndGroup under the exact match of the error body + stacktrace. Improves performance of handleErrorAndGroup by first checking if the exact error object has been grouped before.

func (*Resolver) HandleSessionViewable

func (r *Resolver) HandleSessionViewable(ctx context.Context, projectID int, session *model.Session) error

HandleSessionViewable is called after the first events to a session are written. It handles any alerts that must be sent for this session after it is able to be played.

func (*Resolver) IdentifySessionImpl

func (r *Resolver) IdentifySessionImpl(ctx context.Context, sessionSecureID string, userIdentifier string, userObject interface{}, backfill bool) error

func (*Resolver) IndexSessionClickhouse

func (r *Resolver) IndexSessionClickhouse(ctx context.Context, session *model.Session) error

func (*Resolver) InitializeSessionImpl

func (r *Resolver) InitializeSessionImpl(ctx context.Context, input *kafka_queue.InitializeSessionArgs) (*model.Session, error)

func (*Resolver) IsErrorIngested

func (r *Resolver) IsErrorIngested(ctx context.Context, projectID int, errorObject *modelInputs.BackendErrorObjectInput) bool

func (*Resolver) IsErrorIngestedByFilter

func (r *Resolver) IsErrorIngestedByFilter(ctx context.Context, projectID int, errorObject *modelInputs.BackendErrorObjectInput) bool

func (*Resolver) IsErrorIngestedByRateLimit

func (r *Resolver) IsErrorIngestedByRateLimit(ctx context.Context, projectID int, errorObject *modelInputs.BackendErrorObjectInput) bool

func (*Resolver) IsErrorIngestedBySample

func (r *Resolver) IsErrorIngestedBySample(ctx context.Context, projectID int, errorObject *modelInputs.BackendErrorObjectInput) bool

func (*Resolver) IsFrontendErrorIngested

func (r *Resolver) IsFrontendErrorIngested(ctx context.Context, projectID int, session *model.Session, frontendError *modelInputs.ErrorObjectInput) bool

func (*Resolver) IsLogIngested

func (r *Resolver) IsLogIngested(ctx context.Context, logRow *clickhouse.LogRow) bool

func (*Resolver) IsLogIngestedByFilter

func (r *Resolver) IsLogIngestedByFilter(ctx context.Context, logRow *clickhouse.LogRow) bool

func (*Resolver) IsLogIngestedByRateLimit

func (r *Resolver) IsLogIngestedByRateLimit(ctx context.Context, logRow *clickhouse.LogRow) bool

func (*Resolver) IsLogIngestedBySample

func (r *Resolver) IsLogIngestedBySample(ctx context.Context, logRow *clickhouse.LogRow) bool

func (*Resolver) IsSessionExcluded

func (r *Resolver) IsSessionExcluded(ctx context.Context, s *model.Session, sessionHasErrors bool) (bool, *privateModel.SessionExcludedReason)

func (*Resolver) IsSessionExcludedByFilter

func (r *Resolver) IsSessionExcludedByFilter(ctx context.Context, session *model.Session) bool

func (*Resolver) IsTraceIngested

func (r *Resolver) IsTraceIngested(ctx context.Context, trace *clickhouse.TraceRow) bool

func (*Resolver) IsTraceIngestedByFilter

func (r *Resolver) IsTraceIngestedByFilter(ctx context.Context, trace *clickhouse.TraceRow) bool

func (*Resolver) IsTraceIngestedByRateLimit

func (r *Resolver) IsTraceIngestedByRateLimit(ctx context.Context, trace *clickhouse.TraceRow) bool

func (*Resolver) IsTraceIngestedBySample

func (r *Resolver) IsTraceIngestedBySample(ctx context.Context, trace *clickhouse.TraceRow) bool

func (*Resolver) IsWithinQuota

func (r *Resolver) IsWithinQuota(ctx context.Context, productType model.PricingProductType, workspace *model.Workspace, now time.Time) (bool, float64)

func (*Resolver) MarkBackendSetupImpl

func (r *Resolver) MarkBackendSetupImpl(ctx context.Context, projectID int, setupType model.MarkBackendSetupType) error

func (*Resolver) MoveSessionDataToStorage

func (r *Resolver) MoveSessionDataToStorage(ctx context.Context, sessionId int, payloadId *int, projectId int, payloadType model.RawPayloadType) error

func (*Resolver) Mutation

func (r *Resolver) Mutation() generated1.MutationResolver

Mutation returns generated1.MutationResolver implementation.

func (*Resolver) ProcessBackendPayloadImpl

func (r *Resolver) ProcessBackendPayloadImpl(ctx context.Context, sessionSecureID *string, projectVerboseID *string, errorObjects []*publicModel.BackendErrorObjectInput)

func (*Resolver) ProcessCompressedPayload

func (r *Resolver) ProcessCompressedPayload(ctx context.Context, sessionSecureID string, payloadID int, data string) error

func (*Resolver) ProcessPayload

func (r *Resolver) ProcessPayload(ctx context.Context, sessionSecureID string, events publicModel.ReplayEventsInput, messages string, resources string, webSocketEvents *string, errors []*publicModel.ErrorObjectInput, isBeacon bool, hasSessionUnloaded bool, highlightLogs *string, payloadId *int) error

func (*Resolver) PushMetricsImpl

func (r *Resolver) PushMetricsImpl(ctx context.Context, projectVerboseID *string, sessionSecureID *string, metrics []*publicModel.MetricInput) error

func (*Resolver) Query

func (r *Resolver) Query() generated1.QueryResolver

Query returns generated1.QueryResolver implementation.

func (*Resolver) SaveSessionData

func (r *Resolver) SaveSessionData(ctx context.Context, projectId, sessionId, payloadId int, isBeacon bool, payloadType model.RawPayloadType, data []byte) error

func (*Resolver) SendSessionIdentifiedAlert

func (r *Resolver) SendSessionIdentifiedAlert(ctx context.Context, workspace *model.Workspace, project *model.Project, session *model.Session) error

func (*Resolver) SendSessionInitAlert

func (r *Resolver) SendSessionInitAlert(ctx context.Context, workspace *model.Workspace, project *model.Project, sessionID int) error

func (*Resolver) SendSessionTrackPropertiesAlert

func (r *Resolver) SendSessionTrackPropertiesAlert(ctx context.Context, workspace *model.Workspace, project *model.Project, session *model.Session, properties []AppendProperty) error

func (*Resolver) SendSessionUserPropertiesAlert

func (r *Resolver) SendSessionUserPropertiesAlert(ctx context.Context, workspace *model.Workspace, project *model.Project, session *model.Session) error

func (*Resolver) Session

func (r *Resolver) Session() generated1.SessionResolver

Session returns generated1.SessionResolver implementation.

func (*Resolver) SubmitMetricsMessage

func (r *Resolver) SubmitMetricsMessage(ctx context.Context, metrics []*publicModel.MetricInput) (int, error)

func (*Resolver) SubmitSessionEvents

func (r *Resolver) SubmitSessionEvents(ctx context.Context, sessionID int, events []*clickhouse.SessionEventRow) error

type Response

type Response struct {
	Status     float64 `json:"status"`
	Size       float64 `json:"size"`
	HeadersRaw any     `json:"headers"`
	Body       any     `json:"body"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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