Documentation ¶
Index ¶
- Variables
- func WithBranch(branch string) analyticsOptFn
- func WithBranchId(branchId string) analyticsOptFn
- func WithMessageId(messageId string) analyticsOptFn
- func WithPodID(id string) analyticsOptFn
- func WithPodIPAddress(ip string) analyticsOptFn
- func WithPodName(name string) analyticsOptFn
- func WithRegion(region string) analyticsOptFn
- func WithRequestId(requestId string) analyticsOptFn
- func WithScope(scope string) analyticsOptFn
- func WithSessionId(sessionId string) analyticsOptFn
- func WithUserId(userId string) analyticsOptFn
- type Analytics
- type Event
Constants ¶
This section is empty.
Variables ¶
var ErrTrackerClosed = errors.New("analytics: closed")
Functions ¶
func WithBranch ¶
func WithBranch(branch string) analyticsOptFn
WithBranch will override the branch setting on the event
func WithBranchId ¶ added in v0.0.42
func WithBranchId(branchId string) analyticsOptFn
WithBranchId will override the branch id setting on the event
func WithMessageId ¶
func WithMessageId(messageId string) analyticsOptFn
WithMessageId will set the Nats-Msg-Id on the event
func WithPodID ¶ added in v0.0.42
func WithPodID(id string) analyticsOptFn
WithPodID will override the pod id setting on the event
func WithPodIPAddress ¶ added in v0.0.42
func WithPodIPAddress(ip string) analyticsOptFn
WithPodIPAddress will override the pod ip address setting on the event
func WithPodName ¶ added in v0.0.42
func WithPodName(name string) analyticsOptFn
WithPodName will override the pod name setting on the event
func WithRegion ¶
func WithRegion(region string) analyticsOptFn
WithRegion will override the region setting on the event
func WithRequestId ¶
func WithRequestId(requestId string) analyticsOptFn
WithRequestId will set the requestId on the event
func WithScope ¶ added in v0.0.42
func WithScope(scope string) analyticsOptFn
WithScope will override the scope setting on the event
func WithSessionId ¶
func WithSessionId(sessionId string) analyticsOptFn
WithSessionId will set the sessionId on the event
func WithUserId ¶
func WithUserId(userId string) analyticsOptFn
WithUserId will set the userId on the event
Types ¶
type Analytics ¶
type Analytics interface { // Queue an analytics event which will be delivered in the background Queue(name string, companyId string, locationId string, data any, opts ...analyticsOptFn) error // Close will flush all pending analytics events and close the background sender Close() error }
Analytics is a background service which is used for delivering analytics events in the background
type Event ¶
type Event struct { Timestamp time.Time `json:"timestamp"` Branch string `json:"branch"` Region string `json:"region"` Name string `json:"name"` CompanyId string `json:"companyId"` LocationId string `json:"locationId"` Data any `json:"data,omitempty"` UserId *string `json:"userId,omitempty"` SessionId *string `json:"sessionId,omitempty"` RequestId *string `json:"requestId,omitempty"` }