-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype_event.go
More file actions
65 lines (61 loc) · 1.97 KB
/
type_event.go
File metadata and controls
65 lines (61 loc) · 1.97 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package telescope
import (
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
"time"
)
// Event @Bean
type Event struct {
Name string `json:"name"`
Payload struct {
ConnectionName string `json:"connectionName"`
Queue string `json:"queue"`
Payload struct {
Class string `json:"class"`
Properties struct {
Value string `json:"value"`
Decoded struct {
Uuid string `json:"uuid"`
DisplayName string `json:"displayName"`
Job string `json:"job"`
MaxTries interface{} `json:"maxTries"`
MaxExceptions interface{} `json:"maxExceptions"`
FailOnTimeout bool `json:"failOnTimeout"`
Backoff interface{} `json:"backoff"`
Timeout interface{} `json:"timeout"`
RetryUntil interface{} `json:"retryUntil"`
Data struct {
CommandName string `json:"commandName"`
Command string `json:"command"`
} `json:"data"`
TelescopeUuid string `json:"telescope_uuid"`
Id string `json:"id"`
Attempts int `json:"attempts"`
Type string `json:"type"`
Tags []interface{} `json:"tags"`
PushedAt string `json:"pushedAt"`
} `json:"decoded"`
} `json:"properties"`
} `json:"payload"`
} `json:"payload"`
Listeners []struct {
Name string `json:"name"`
Queued bool `json:"queued"`
} `json:"listeners"`
Broadcast bool `json:"broadcast"`
Hostname string `json:"hostname"`
}
func (b Event) BindType() string {
return "event"
}
func (b Event) Handler(entry *logrus.Entry) (*entries, []tag) {
return &entries{
Uuid: uuid.NewV4().String(),
BatchId: NewtelescopeHook().TelescopeUUID(),
FamilyHash: nil,
ShouldDisplayOnIndex: 1,
Type: b.BindType(),
Content: ToContent(b),
CreatedAt: time.Now().Format("2006-01-02 15:04:05"),
}, nil
}