Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions sens/fission/src/session/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
)

type Session struct {
Id string `json:"Id"`
Id string `json:"SessionId"`
UserId string `json:"UserId"`
Name string `json:"Name"`
Type string `json:"Type"`
Name string `json:"SessionName"`
Type string `json:"SessionType"`
StartedAt int64 `json:"StartedAt"`
EndedAt int64 `json:"EndedAt"`
}
Expand All @@ -33,15 +33,15 @@ type Sessions []Session

type SessionProperty struct {
SessionId string `json:"SessionId"`
Name string `json:"name"`
Value string `json:"value"`
Key string `json:"Key"`
Value string `json:"Value"`
}

type SessionProperties []SessionProperty

type SessionRecord struct {
UserId string `json:"UserId"`
Name string `json:"Name"`
Key string `json:"Key"`
Timestamp int64 `json:"Timestamp"`
Value float64 `json:"Value"`
}
Expand All @@ -51,7 +51,7 @@ type SessionRecords []SessionRecord
type SessionEvent struct {
Id string `json:"Id"`
UserId string `json:"UserId"`
Name string `json:"Name"`
Key string `json:"Key"`
StartTime int64 `json:"StartTime"`
EndTime int64 `json:"EndTime"`
}
Expand Down Expand Up @@ -131,7 +131,7 @@ type SessionsSummary struct {
func fetchSessionProperties(sessionId string, requiredSessionProperties map[string]int64) map[string]int64 {
// Fetching session properties
for key := range requiredSessionProperties {
sessionPropertiesUrl := fmt.Sprintf("%v/api/session-properties/find?and=SessionId^%v&and=Name^%v&limit=1", config.GetDatastoreUrl(), sessionId, key)
sessionPropertiesUrl := fmt.Sprintf("%v/api/session-properties/find?and=SessionId^%v&and=Key^%v&limit=1", config.GetDatastoreUrl(), sessionId, key)
sessionPropertiesResponseData := getFromDataStore(sessionPropertiesUrl)

var sessionPropertiesData SessionProperties
Expand Down Expand Up @@ -160,7 +160,7 @@ func fetchSessionProperties(sessionId string, requiredSessionProperties map[stri
func fetchSessionRecords(sessionUserId string, sessionStartTime int64, sessionEndTime int64, requiredSessionRecords *map[string]TimeSeriesData) {
// Fetch records
for key := range *requiredSessionRecords {
sessionRecordsUrl := fmt.Sprintf("%v/api/session-records/find?and=Name^%v&and=UserId^%v&span=Timestamp^%v^%v&limit=10000000", config.GetDatastoreUrl(), key, sessionUserId, sessionStartTime, sessionEndTime)
sessionRecordsUrl := fmt.Sprintf("%v/api/session-records/find?and=Key^%v&and=UserId^%v&span=Timestamp^%v^%v&limit=10000000", config.GetDatastoreUrl(), key, sessionUserId, sessionStartTime, sessionEndTime)
sessionRecordsReponseData := getFromDataStore(sessionRecordsUrl)
var sessionRecordsData SessionRecords
json.Unmarshal(sessionRecordsReponseData, &sessionRecordsData)
Expand Down Expand Up @@ -202,7 +202,7 @@ func getUserSessions(r *http.Request, sessionType string, limit int64, userId *s

for _, currentUserId := range userIdList {
var url string
url = fmt.Sprintf("%v/api/sessions/find?and=UserId^%v&limit=%v&and=Type^%v&column=EndedAt", config.GetDatastoreUrl(), currentUserId, limit, sessionType)
url = fmt.Sprintf("%v/api/sessions/find?and=UserId^%v&limit=%v&and=SessionType^%v&column=EndedAt", config.GetDatastoreUrl(), currentUserId, limit, sessionType)
if from != 0 && to != 0 {
url = fmt.Sprintf("%v&span=EndedAt^%v^%v", url, from, to)
}
Expand Down