Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
new: Add support for reporting unique IDs for activities
Browse files Browse the repository at this point in the history
  • Loading branch information
bradhe committed Jul 31, 2020
1 parent d0350ed commit ba0d492
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion instrumentation/activities/activity/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ import "time"
type ActivityMetadata map[string]string

type Activity struct {
// ID is a unique identifier for this activity. Activity data consumers will
// use this identifier (when provided) to deduplicated activity data.
ID string

// Name is the name of the activity to report. e.g. "workflow-run"
Name string

// UserID is the identifier of the user that this activity belongs to.
UserID string
Name string
Metadata ActivityMetadata
OccuredAt time.Time
}
1 change: 1 addition & 0 deletions instrumentation/activities/delegates/intercom.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Intercom struct {

func (d *Intercom) Report(act activity.Activity) error {
return d.client.Events.Save(&intercom.Event{
ID: act.ID,
UserID: act.UserID,
EventName: act.Name,
CreatedAt: act.OccuredAt.Unix(),
Expand Down
1 change: 1 addition & 0 deletions instrumentation/activities/delegates/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Segment struct {

func (d *Segment) Report(act activity.Activity) error {
track := analytics.Track{
MessageId: act.ID,
UserId: act.UserID,
Event: act.Name,
Timestamp: act.OccuredAt,
Expand Down

0 comments on commit ba0d492

Please sign in to comment.