1
1
package telemetry
2
2
3
- import (
4
- "github.com/devtron-labs/devtron/pkg/build/pipeline/bean/common"
5
- "github.com/devtron-labs/devtron/pkg/plugin/repository"
6
- )
3
+ // EA-mode compatible telemetry queries - no imports needed for current methods
7
4
8
5
func (impl * TelemetryEventClientImpl ) getHelmAppCount () int {
9
6
if impl .installedAppReadService == nil {
@@ -18,62 +15,7 @@ func (impl *TelemetryEventClientImpl) getHelmAppCount() int {
18
15
return count
19
16
}
20
17
21
- func (impl * TelemetryEventClientImpl ) getDevtronAppCount () int {
22
- if impl .appRepository == nil {
23
- impl .logger .Warnw ("appRepository not available for devtron app count" )
24
- return - 1
25
- }
26
- devtronAppCount , err := impl .appRepository .FindDevtronAppCount ()
27
- if err != nil {
28
- impl .logger .Errorw ("error getting all apps for devtron app count" , "err" , err )
29
- return - 1
30
- }
31
- return devtronAppCount
32
- }
33
-
34
- func (impl * TelemetryEventClientImpl ) getJobCount () int {
35
- if impl .appRepository == nil {
36
- impl .logger .Warnw ("appRepository not available for job count" )
37
- return - 1
38
- }
39
- jobCount , err := impl .appRepository .FindJobCount ()
40
- if err != nil {
41
- impl .logger .Errorw ("error getting all apps for job count" , "err" , err )
42
- return - 1
43
- }
44
-
45
- return jobCount
46
- }
47
-
48
- func (impl * TelemetryEventClientImpl ) getUserCreatedPluginCount () int {
49
- if impl .pluginRepository == nil {
50
- impl .logger .Warnw ("pluginRepository not available for user created plugin count" )
51
- return - 1
52
- }
53
-
54
- // Get all user-created plugins (SHARED type)
55
- plugins , err := impl .pluginRepository .GetAllPluginMinDataByType (string (repository .PLUGIN_TYPE_SHARED ))
56
- if err != nil {
57
- impl .logger .Errorw ("error getting user created plugin count" , "err" , err )
58
- return 0
59
- }
60
-
61
- return len (plugins )
62
- }
63
-
64
- func (impl * TelemetryEventClientImpl ) getPolicyCount () int {
65
- if impl .cvePolicyRepository == nil {
66
- impl .logger .Warnw ("cvePolicyRepository not available for policy count" )
67
- return - 1
68
- }
69
-
70
- // Get global policies
71
- globalPolicies , err := impl .cvePolicyRepository .GetGlobalPolicies ()
72
- if err != nil {
73
- impl .logger .Errorw ("error getting global CVE policies" , "err" , err )
74
- }
75
- return len (globalPolicies )
76
- }
18
+ // EA-mode compatible telemetry methods
77
19
78
20
func (impl * TelemetryEventClientImpl ) getClusterCounts () (physicalCount int , isolatedCount int ) {
79
21
clusters , err := impl .clusterService .FindAllActive ()
@@ -96,66 +38,8 @@ func (impl *TelemetryEventClientImpl) getClusterCounts() (physicalCount int, iso
96
38
return physicalCount , isolatedCount
97
39
}
98
40
99
- func (impl * TelemetryEventClientImpl ) getJobPipelineCount () int {
100
- return 0
101
- }
102
-
103
- func (impl * TelemetryEventClientImpl ) getJobPipelineTriggeredLast24h () int {
104
- // Check if we have the required dependency
105
- if impl .ciWorkflowRepository == nil {
106
- impl .logger .Warnw ("ciWorkflowRepository not available for job pipeline triggered count" )
107
- return - 1
108
- }
109
-
110
- // Get build type and status data for the last 24 hours
111
- buildTypeStatusData := impl .ciWorkflowRepository .FindBuildTypeAndStatusDataOfLast1Day ()
112
- if buildTypeStatusData == nil {
113
- impl .logger .Warnw ("no build type status data available for last 24 hours" )
114
- return 0
115
- }
116
-
117
- // Count job pipeline triggers
118
- // Job pipelines have build type "CI_JOB"
119
- jobTriggeredCount := 0
120
- for _ , data := range buildTypeStatusData {
121
- if data .Type == string (common .CI_JOB ) {
122
- jobTriggeredCount += data .Count
123
- }
124
- }
125
-
126
- return jobTriggeredCount
127
- }
128
-
129
- func (impl * TelemetryEventClientImpl ) getJobPipelineSucceededLast24h () int {
130
- // Check if we have the required dependency
131
- if impl .ciWorkflowRepository == nil {
132
- impl .logger .Warnw ("ciWorkflowRepository not available for job pipeline succeeded count" )
133
- return - 1
134
- }
135
-
136
- // Get build type and status data for the last 24 hours
137
- buildTypeStatusData := impl .ciWorkflowRepository .FindBuildTypeAndStatusDataOfLast1Day ()
138
- if buildTypeStatusData == nil {
139
- impl .logger .Warnw ("no build type status data available for last 24 hours" )
140
- return 0
141
- }
142
-
143
- // Count successful job pipeline runs
144
- // Job pipelines have build type "CI_JOB"
145
- successfulJobCount := 0
146
- for _ , data := range buildTypeStatusData {
147
- if data .Type == "CI_JOB" && data .Status == "Succeeded" {
148
- successfulJobCount += data .Count
149
- }
150
- }
151
-
152
- impl .logger .Debugw ("counted successful job pipeline runs in last 24h" , "count" , successfulJobCount )
153
- return successfulJobCount
154
- }
155
-
156
- func (impl * TelemetryEventClientImpl ) getAppliedPolicyRowCount () int {
157
- return 0
158
- }
41
+ // Note: FULL-mode specific methods like getDevtronAppCount, getJobCount, etc.
42
+ // are now implemented in TelemetryEventClientImplExtended in telemetryQueriesExtended.go
159
43
160
44
func (impl * TelemetryEventClientImpl ) getActiveUsersLast30Days () int {
161
45
if impl .userAuditService == nil {
@@ -172,54 +56,3 @@ func (impl *TelemetryEventClientImpl) getActiveUsersLast30Days() int {
172
56
impl .logger .Debugw ("counted active users in last 30 days" , "count" , count )
173
57
return count
174
58
}
175
-
176
- func (impl * TelemetryEventClientImpl ) getGitOpsPipelineCount () int {
177
- // Check if we have the required dependency
178
- if impl .cdWorkflowRepository == nil {
179
- impl .logger .Warnw ("cdWorkflowRepository not available for GitOps pipeline count" )
180
- return - 1
181
- }
182
-
183
- var count int
184
- query := `
185
- SELECT COUNT(DISTINCT p.id)
186
- FROM pipeline p
187
- WHERE p.deleted = false AND p.deployment_app_type = 'argo_cd'
188
- `
189
-
190
- dbConnection := impl .cdWorkflowRepository .GetConnection ()
191
- _ , err := dbConnection .Query (& count , query )
192
- if err != nil {
193
- impl .logger .Errorw ("error getting GitOps pipeline count" , "err" , err )
194
- return - 1
195
- }
196
-
197
- impl .logger .Debugw ("counted GitOps pipelines" , "count" , count )
198
- return count
199
- }
200
-
201
- func (impl * TelemetryEventClientImpl ) helmPipelineCount () int {
202
- // Check if we have the required dependency
203
- if impl .cdWorkflowRepository == nil {
204
- impl .logger .Warnw ("cdWorkflowRepository not available for No-GitOps pipeline count" )
205
- return - 1
206
- }
207
-
208
- // Get the pipeline repository from cdWorkflowRepository connection
209
- var count int
210
- query := `
211
- SELECT COUNT(DISTINCT p.id)
212
- FROM pipeline p
213
- WHERE p.deleted = false AND p.deployment_app_type = 'helm'
214
- `
215
-
216
- dbConnection := impl .cdWorkflowRepository .GetConnection ()
217
- _ , err := dbConnection .Query (& count , query )
218
- if err != nil {
219
- impl .logger .Errorw ("error getting No-GitOps pipeline count" , "err" , err )
220
- return - 1
221
- }
222
-
223
- impl .logger .Debugw ("counted No-GitOps pipelines" , "count" , count )
224
- return count
225
- }
0 commit comments