-
Notifications
You must be signed in to change notification settings - Fork 335
/
fetcher.go
32 lines (25 loc) · 904 Bytes
/
fetcher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package worker
import (
"context"
"github.com/didi/sharingan/replayer-agent/common/handlers/tlog"
"github.com/didi/sharingan/replayer-agent/idl"
"github.com/didi/sharingan/replayer-agent/logic/search"
"github.com/didi/sharingan/replayer-agent/model/esmodel"
"github.com/didi/sharingan/replayer-agent/model/replaying"
)
func FetchSessions(ctx context.Context, sessionId string, project string) []*replaying.Session {
var esSessions []esmodel.Session
session := search.GetRawSessions(ctx, &idl.SearchReq{SessionId: sessionId, Size: 1, Project: project})
if session != nil {
esSessions = append(esSessions, *session)
}
t := &Transformer{}
sessions, err := t.BuildSessions(esSessions, project)
if err != nil {
tlog.Handler.Errorf(ctx, tlog.DLTagUndefined, "errmsg=fetch session failed||err=%s", err)
}
return sessions
}
type Record struct {
Session esmodel.Session `json:"data"`
}