-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(backend): integrate screen view event with session replay
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package replay | ||
|
||
import ( | ||
"backend/api/event" | ||
"time" | ||
) | ||
|
||
// ScreenView represents screen view events suitable | ||
// for session replay. | ||
type ScreenView struct { | ||
EventType string `json:"event_type"` | ||
ThreadName string `json:"thread_name"` | ||
UserTriggered bool `json:"user_triggered"` | ||
*event.ScreenView | ||
Timestamp time.Time `json:"timestamp"` | ||
} | ||
|
||
// ComputeScreemViews computes screen view events | ||
// for session replay. | ||
func ComputeScreenViews(events []event.EventField) (result []ThreadGrouper) { | ||
for _, event := range events { | ||
sv := ScreenView{ | ||
event.Type, | ||
event.Attribute.ThreadName, | ||
event.UserTriggered, | ||
event.ScreenView, | ||
event.Timestamp, | ||
} | ||
result = append(result, sv) | ||
} | ||
|
||
return | ||
} | ||
|
||
// GetThreadName provides the name of the thread | ||
// where screen view took place. | ||
func (sv ScreenView) GetThreadName() string { | ||
return sv.ThreadName | ||
} | ||
|
||
// GetTimestamp provides the timestamp of | ||
// the screen view took place. | ||
func (sv ScreenView) GetTimestamp() time.Time { | ||
return sv.Timestamp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters