@@ -9,6 +9,8 @@ type Client interface {
9
9
ModuleCreation ()
10
10
ModuleReconciliation ()
11
11
InstanceStart ()
12
+ TemplateCreation ()
13
+ TemplateEdit ()
12
14
}
13
15
14
16
type logger interface {
@@ -19,11 +21,12 @@ type logger interface {
19
21
type EnqueueClient struct {
20
22
client posthog.Client
21
23
distinctID string
24
+ version string
22
25
}
23
26
24
27
type MockClient struct {}
25
28
26
- func NewClient (disable bool , logger logger ) (Client , error ) {
29
+ func NewClient (disable bool , version string , logger logger ) (Client , error ) {
27
30
if disable {
28
31
logger .Info ("telemetry disabled" )
29
32
return MockClient {}, nil
@@ -53,30 +56,62 @@ func NewClient(disable bool, logger logger) (Client, error) {
53
56
return EnqueueClient {
54
57
client : client ,
55
58
distinctID : idStr ,
59
+ version : version ,
56
60
}, nil
57
61
}
58
62
59
63
func (c EnqueueClient ) InstanceStart () {
60
64
_ = c .client .Enqueue (posthog.Capture {
61
65
Event : "cyclops-instance-start" ,
62
66
DistinctId : c .distinctID ,
67
+ Properties : map [string ]interface {}{
68
+ "version" : c .version ,
69
+ },
63
70
})
64
71
}
65
72
66
73
func (c EnqueueClient ) ModuleReconciliation () {
67
74
_ = c .client .Enqueue (posthog.Capture {
68
75
Event : "module-reconciliation" ,
69
76
DistinctId : c .distinctID ,
77
+ Properties : map [string ]interface {}{
78
+ "version" : c .version ,
79
+ },
70
80
})
71
81
}
72
82
73
83
func (c EnqueueClient ) ModuleCreation () {
74
84
_ = c .client .Enqueue (posthog.Capture {
75
85
Event : "module-creation" ,
76
86
DistinctId : c .distinctID ,
87
+ Properties : map [string ]interface {}{
88
+ "version" : c .version ,
89
+ },
90
+ })
91
+ }
92
+
93
+ func (c EnqueueClient ) TemplateCreation () {
94
+ _ = c .client .Enqueue (posthog.Capture {
95
+ Event : "template-creation" ,
96
+ DistinctId : c .distinctID ,
97
+ Properties : map [string ]interface {}{
98
+ "version" : c .version ,
99
+ },
77
100
})
78
101
}
79
102
103
+ func (c EnqueueClient ) TemplateEdit () {
104
+ _ = c .client .Enqueue (posthog.Capture {
105
+ Event : "template-edit" ,
106
+ DistinctId : c .distinctID ,
107
+ Properties : map [string ]interface {}{
108
+ "version" : c .version ,
109
+ },
110
+ })
111
+ }
112
+
113
+ // region mock client
114
+
80
115
func (c MockClient ) InstanceStart () {
81
116
}
82
117
@@ -85,3 +120,9 @@ func (c MockClient) ModuleReconciliation() {
85
120
86
121
func (c MockClient ) ModuleCreation () {
87
122
}
123
+
124
+ func (c MockClient ) TemplateCreation () {}
125
+
126
+ func (c MockClient ) TemplateEdit () {}
127
+
128
+ // endregion
0 commit comments