Documentation ¶
Index ¶
- Constants
- Variables
- func SetContext(ctx context.Context, client *Client) context.Context
- type Client
- type Config
- type DeploymentInfo
- type Event
- type Provider
- type RequestCreated
- type RequestReviewed
- type RequestRevoked
- type Role
- type RuleArchived
- type RuleCreated
- type RuleUpdated
- type Timing
- type TimingMode
- type UserInfo
Constants ¶
View Source
const ( DevEndpoint = "https://t-dev.commonfate.io" DefaultEndpoint = "https://t.commonfate.io" )
Variables ¶
View Source
var ( // Disabled disables analytics altogether. Disabled = Config{ Endpoint: "", Enabled: false, Verbose: false, } // Development uses https://t-dev.commonfate.io as the endpoint. Development = Config{ Endpoint: DevEndpoint, Enabled: true, Verbose: true, } // Default uses https://t.commonfate.io as the endpoint. Default = Config{ Endpoint: DefaultEndpoint, Enabled: true, Verbose: false, } )
View Source
var AllEvents = map[string]Event{}
Functions ¶
Types ¶
type Client ¶
type Client struct { // OnFailure is a callback fired if events are failed to be dispatched. OnFailure func(e Event) // contains filtered or unexported fields }
func FromContext ¶
FromContext loads an analytics client from context. analytics.SetContext must have been called. if there is no client in context, a new noop client is returned.
func (*Client) SetDeploymentID ¶
SetDeploymentID sets the deployment ID.
type Config ¶
type Config struct { Endpoint string `json:"endpoint"` Enabled bool `json:"enabled"` Verbose bool `json:"verbose"` }
Config is configuration for the analytics client.
type DeploymentInfo ¶
type DeploymentInfo struct { ID string `json:"-"` Version string `json:"version"` UserCount int `json:"user_count"` GroupCount int `json:"group_count"` IDP string `json:"idp"` Stage string `json:"stage,omitempty"` // dev, prod, uat, etc. }
func (*DeploymentInfo) EmittedWhen ¶
func (d *DeploymentInfo) EmittedWhen() string
func (*DeploymentInfo) Type ¶
func (d *DeploymentInfo) Type() string
type Event ¶
type Event interface { // Type of the event, in the format 'namespace:entity.action.' // // namespace is the project namespace, like 'cf' for Common Fate. // // entity is the thing the event is related to, like 'scan'. // // action is the thing that happened in past tense, like 'created'. // // example type: "cf:scan.created" Type() string // Description of when the event is emitted. EmittedWhen() string // contains filtered or unexported methods }
Event is a product analytics event that is tracked.
type RequestCreated ¶
type RequestCreated struct { RequestedBy string `json:"requested_by" analytics:"usr"` Provider Provider `json:"provider"` BuiltInProvider string `json:"built_in_provider"` PDKProvider bool `json:"pdk_provider"` RuleID string `json:"rule_id" analytics:"rul"` Timing Timing `json:"timing"` HasReason bool `json:"has_reason"` // RequiresApproval is true if a manual approval is required. RequiresApproval bool `json:"requires_approval"` }
func (*RequestCreated) EmittedWhen ¶
func (r *RequestCreated) EmittedWhen() string
func (*RequestCreated) Type ¶
func (r *RequestCreated) Type() string
type RequestReviewed ¶
type RequestReviewed struct { RequestedBy string `json:"requested_by" analytics:"usr"` ReviewedBy string `json:"reviewed_by" analytics:"usr"` Provider Provider `json:"provider"` BuiltInProvider string `json:"built_in_provider"` PDKProvider bool `json:"pdk_provider"` RuleID string `json:"rule_id" analytics:"rul"` Timing Timing `json:"timing"` OverrideTiming *Timing `json:"override_timing"` HasReason bool `json:"has_reason"` // PendingDurationSeconds is how long the request has been waiting for a review. PendingDurationSeconds float64 `json:"pending_duration_seconds"` // Review is APPROVE or DENY Review string `json:"review"` ReviewerIsAdmin bool `json:"reviewer_is_admin"` }
func (*RequestReviewed) EmittedWhen ¶
func (r *RequestReviewed) EmittedWhen() string
func (*RequestReviewed) Type ¶
func (r *RequestReviewed) Type() string
type RequestRevoked ¶
type RequestRevoked struct { RequestedBy string `json:"requested_by" analytics:"usr"` RevokedBy string `json:"revoked_by" analytics:"usr"` Provider Provider `json:"provider"` BuiltInProvider string `json:"built_in_provider"` PDKProvider bool `json:"pdk_provider"` RuleID string `json:"rule_id" analytics:"rul"` Timing Timing `json:"timing"` HasReason bool `json:"has_reason"` }
func (*RequestRevoked) EmittedWhen ¶
func (r *RequestRevoked) EmittedWhen() string
func (*RequestRevoked) Type ¶
func (r *RequestRevoked) Type() string
type RuleArchived ¶
type RuleArchived struct { RuleID string `json:"rule_id" analytics:"rul"` ArchivedBy string `json:"archived_by" analytics:"usr"` }
func (*RuleArchived) EmittedWhen ¶
func (r *RuleArchived) EmittedWhen() string
func (*RuleArchived) Type ¶
func (r *RuleArchived) Type() string
type RuleCreated ¶
type RuleCreated struct { RuleID string `json:"rule_id" analytics:"rul"` CreatedBy string `json:"created_by" analytics:"usr"` UsesSelectableOptions bool `json:"uses_selectable_options"` UsesDynamicOptions bool `json:"uses_dynamic_options"` Provider Provider `json:"provider"` BuiltInProvider string `json:"built_in_provider"` PDKProvider bool `json:"pdk_provider"` MaxDurationSeconds int `json:"max_duration_seconds"` RequiresApproval bool `json:"requires_approval"` OptionCount int `json:"option_count"` }
func (*RuleCreated) EmittedWhen ¶
func (r *RuleCreated) EmittedWhen() string
func (*RuleCreated) Type ¶
func (r *RuleCreated) Type() string
type RuleUpdated ¶
type RuleUpdated struct { RuleID string `json:"rule_id" analytics:"rul"` UpdatedBy string `json:"updated_by" analytics:"usr"` UsesSelectableOptions bool `json:"uses_selectable_options"` UsesDynamicOptions bool `json:"uses_dynamic_options"` Provider Provider `json:"provider"` BuiltInProvider string `json:"built_in_provider"` PDKProvider bool `json:"pdk_provider"` MaxDurationSeconds int `json:"max_duration_seconds"` RequiresApproval bool `json:"requires_approval"` OptionCount int `json:"option_count"` }
func (*RuleUpdated) EmittedWhen ¶
func (r *RuleUpdated) EmittedWhen() string
func (*RuleUpdated) Type ¶
func (r *RuleUpdated) Type() string
type Timing ¶
type Timing struct { Mode TimingMode `json:"mode"` DurationSeconds float64 `json:"duration_seconds"` }
type TimingMode ¶
type TimingMode string
var ( TimingModeASAP TimingMode = "asap" TimingModeScheduled TimingMode = "scheduled" )
Source Files ¶
- client.go
- context.go
- encode_property.go
- event.go
- event_request_created.go
- event_request_reviewed.go
- event_request_revoked.go
- event_rule_archived.go
- event_rule_created.go
- event_rule_updated.go
- groupidentify_deployment_info.go
- identify_user_info.go
- marshal_context.go
- provider.go
- registry.go
- tag.go
- track.go
Click to show internal directories.
Click to hide internal directories.