Skip to content

Commit 993363d

Browse files
authored
Merge branch 'main' into april-docup
2 parents 30dc8fa + 1e666e4 commit 993363d

17 files changed

+288
-64
lines changed

client/telemetry/TelemetryEventClientExtended.go

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ type TelemetryEventDto struct {
131131
UserCount int `json:"userCount,omitempty"`
132132
EnvironmentCount int `json:"environmentCount,omitempty"`
133133
ClusterCount int `json:"clusterCount,omitempty"`
134-
CiCountPerDay int `json:"ciCountPerDay,omitempty"`
135-
CdCountPerDay int `json:"cdCountPerDay,omitempty"`
134+
CiCreatedPerDay int `json:"ciCreatedPerDay"`
135+
CdCreatedPerDay int `json:"cdCreatedPerDay"`
136+
CiDeletedPerDay int `json:"ciDeletedPerDay"`
137+
CdDeletedPerDay int `json:"cdDeletedPerDay"`
138+
CiTriggeredPerDay int `json:"ciTriggeredPerDay"`
139+
CdTriggeredPerDay int `json:"cdTriggeredPerDay"`
136140
HelmChartCount int `json:"helmChartCount,omitempty"`
137141
SecurityScanCountPerDay int `json:"securityScanCountPerDay,omitempty"`
138142
GitAccountsCount int `json:"gitAccountsCount,omitempty"`
@@ -187,7 +191,7 @@ func (impl *TelemetryEventClientImplExtended) SendSummaryEvent(eventType string)
187191
impl.logger.Infow("sending summary event", "eventType", eventType)
188192
ucid, err := impl.getUCID()
189193
if err != nil {
190-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
194+
impl.logger.Errorw("exception caught inside telemetry summary event while retrieving ucid", "err", err)
191195
return err
192196
}
193197

@@ -200,58 +204,77 @@ func (impl *TelemetryEventClientImplExtended) SendSummaryEvent(eventType string)
200204
payload := &TelemetryEventDto{UCID: ucid, Timestamp: time.Now(), EventType: TelemetryEventType(eventType), DevtronVersion: "v1"}
201205
payload.ServerVersion = k8sServerVersion.String()
202206

203-
environments, err := impl.environmentService.GetAllActive()
207+
environmentCount, err := impl.environmentService.GetAllActiveEnvironmentCount()
204208
if err != nil && err != pg.ErrNoRows {
205-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
206-
return err
209+
impl.logger.Errorw("exception caught inside telemetry summary event while retrieving environmentCount, setting its value to -1", "err", err)
210+
environmentCount = -1
207211
}
208212

209213
prodApps, err := impl.appListingRepository.FindAppCount(true)
210214
if err != nil && err != pg.ErrNoRows {
211-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
212-
return err
215+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving prodApps, setting its value to -1", "err", err)
216+
prodApps = -1
213217
}
214218

215219
nonProdApps, err := impl.appListingRepository.FindAppCount(false)
216220
if err != nil && err != pg.ErrNoRows {
217-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
218-
return err
221+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving nonProdApps, setting its value to -1", "err", err)
222+
nonProdApps = -1
219223
}
220224

221-
ciPipeline, err := impl.ciPipelineRepository.FindAllPipelineInLast24Hour()
225+
ciPipelineCount, err := impl.ciPipelineRepository.FindAllPipelineCreatedCountInLast24Hour()
222226
if err != nil && err != pg.ErrNoRows {
223-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
224-
return err
227+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving ciPipelineCount, setting its value to -1", "err", err)
228+
ciPipelineCount = -1
225229
}
226-
227-
cdPipeline, err := impl.pipelineRepository.FindAllPipelineInLast24Hour()
230+
ciPipelineDeletedCount, err := impl.ciPipelineRepository.FindAllDeletedPipelineCountInLast24Hour()
228231
if err != nil && err != pg.ErrNoRows {
229-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
230-
return err
232+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving ciPipelineDeletedCount, setting its value to -1", "err", err)
233+
ciPipelineDeletedCount = -1
234+
}
235+
ciPipelineTriggeredCount, err := impl.ciWorkflowRepository.FindAllTriggeredWorkflowCountInLast24Hour()
236+
if err != nil && err != pg.ErrNoRows {
237+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving ciPipelineTriggeredCount, setting its value to -1", "err", err)
238+
ciPipelineTriggeredCount = -1
231239
}
232240

233-
gitAccounts, err := impl.gitProviderRepository.FindAll()
241+
cdPipelineCount, err := impl.pipelineRepository.FindAllPipelineCreatedCountInLast24Hour()
234242
if err != nil && err != pg.ErrNoRows {
235-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
236-
return err
243+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving cdPipelineCount, setting its value to -1", "err", err)
244+
cdPipelineCount = -1
245+
}
246+
cdPipelineDeletedCount, err := impl.pipelineRepository.FindAllDeletedPipelineCountInLast24Hour()
247+
if err != nil && err != pg.ErrNoRows {
248+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving cdPipelineDeletedCount, setting its value to -1", "err", err)
249+
cdPipelineDeletedCount = -1
250+
}
251+
cdPipelineTriggeredCount, err := impl.cdWorkflowRepository.FindAllTriggeredWorkflowCountInLast24Hour()
252+
if err != nil && err != pg.ErrNoRows {
253+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving cdPipelineTriggeredCount, setting its value to -1", "err", err)
254+
cdPipelineTriggeredCount = -1
255+
}
256+
gitAccounts, err := impl.gitProviderRepository.FindAllGitProviderCount()
257+
if err != nil && err != pg.ErrNoRows {
258+
impl.logger.Errorw("exception caught inside telemetry summary event, while retrieving gitAccounts, setting its value to -1", "err", err)
259+
gitAccounts = -1
237260
}
238261

239262
gitOpsCount, err := impl.gitOpsConfigReadService.GetConfiguredGitOpsCount()
240263
if err != nil {
241-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
242-
return err
264+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving gitOpsCount, setting its value to -1", "err", err)
265+
gitOpsCount = -1
243266
}
244267

245-
containerRegistry, err := impl.dockerArtifactStoreRepository.FindAll()
268+
containerRegistryCount, err := impl.dockerArtifactStoreRepository.FindAllDockerArtifactCount()
246269
if err != nil && err != pg.ErrNoRows {
247-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
248-
return err
270+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving containerRegistryCount, setting its value to -1", "err", err)
271+
containerRegistryCount = -1
249272
}
250273

251274
//appSetup := false
252275
apps, err := impl.appRepository.FindAll()
253276
if err != nil {
254-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
277+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving apps", "err", err)
255278
return err
256279
}
257280

@@ -264,24 +287,24 @@ func (impl *TelemetryEventClientImplExtended) SendSummaryEvent(eventType string)
264287
if len(appIds) < AppsCount {
265288
payload.AppsWithGitRepoConfigured, err = impl.materialRepository.FindNumberOfAppsWithGitRepo(appIds)
266289
if err != nil {
267-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
290+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving AppsWithGitRepoConfigured", "err", err)
268291
}
269292
payload.AppsWithDockerConfigured, err = impl.ciTemplateRepository.FindNumberOfAppsWithDockerConfigured(appIds)
270293
if err != nil {
271-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
294+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving AppsWithDockerConfigured", "err", err)
272295
}
273296
payload.AppsWithDeploymentTemplateConfigured, err = impl.chartRepository.FindNumberOfAppsWithDeploymentTemplate(appIds)
274297
if err != nil {
275-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
298+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving AppsWithDeploymentTemplateConfigured", "err", err)
276299
}
277300
payload.AppsWithCiPipelineConfigured, err = impl.ciPipelineRepository.FindNumberOfAppsWithCiPipeline(appIds)
278301
if err != nil {
279-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
302+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving AppsWithCiPipelineConfigured", "err", err)
280303
}
281304

282305
payload.AppsWithCdPipelineConfigured, err = impl.pipelineRepository.FindNumberOfAppsWithCdPipeline(appIds)
283306
if err != nil {
284-
impl.logger.Errorw("exception caught inside telemetry summary event", "err", err)
307+
impl.logger.Errorw("exception caught inside telemetry summary event,while retrieving AppsWithCdPipelineConfigured", "err", err)
285308
}
286309
}
287310

@@ -302,15 +325,18 @@ func (impl *TelemetryEventClientImplExtended) SendSummaryEvent(eventType string)
302325
devtronVersion := util.GetDevtronVersion()
303326
payload.ProdAppCount = prodApps
304327
payload.NonProdAppCount = nonProdApps
305-
payload.RegistryCount = len(containerRegistry)
328+
payload.RegistryCount = containerRegistryCount
306329
payload.SSOLogin = ssoSetup
307330
payload.UserCount = len(users)
308-
payload.EnvironmentCount = len(environments)
331+
payload.EnvironmentCount = environmentCount
309332
payload.ClusterCount = len(clusters)
310-
payload.CiCountPerDay = len(ciPipeline)
311-
312-
payload.CdCountPerDay = len(cdPipeline)
313-
payload.GitAccountsCount = len(gitAccounts)
333+
payload.CiCreatedPerDay = ciPipelineCount
334+
payload.CiDeletedPerDay = ciPipelineDeletedCount
335+
payload.CiTriggeredPerDay = ciPipelineTriggeredCount
336+
payload.CdCreatedPerDay = cdPipelineCount
337+
payload.CdDeletedPerDay = cdPipelineDeletedCount
338+
payload.CdTriggeredPerDay = cdPipelineTriggeredCount
339+
payload.GitAccountsCount = gitAccounts
314340
payload.GitOpsCount = gitOpsCount
315341
payload.HostURL = hostURL
316342
payload.DevtronGitVersion = devtronVersion.GitCommit

cmd/external-app/wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/sql/repository/GitOpsConfigRepository.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type GitOpsConfigRepository interface {
2828
UpdateGitOpsConfig(model *GitOpsConfig, tx *pg.Tx) error
2929
GetGitOpsConfigById(id int) (*GitOpsConfig, error)
3030
GetAllGitOpsConfig() ([]*GitOpsConfig, error)
31+
GetAllGitOpsConfigCount() (int, error)
3132
GetGitOpsConfigByProvider(provider string) (*GitOpsConfig, error)
3233
GetGitOpsConfigActive() (*GitOpsConfig, error)
3334
GetConnection() *pg.DB
@@ -91,6 +92,10 @@ func (impl *GitOpsConfigRepositoryImpl) GetAllGitOpsConfig() ([]*GitOpsConfig, e
9192
err := impl.dbConnection.Model(&userModel).Order("updated_on desc").Select()
9293
return userModel, err
9394
}
95+
func (impl *GitOpsConfigRepositoryImpl) GetAllGitOpsConfigCount() (int, error) {
96+
cnt, err := impl.dbConnection.Model(&GitOpsConfig{}).Count()
97+
return cnt, err
98+
}
9499
func (impl *GitOpsConfigRepositoryImpl) GetGitOpsConfigByProvider(provider string) (*GitOpsConfig, error) {
95100
var model GitOpsConfig
96101
err := impl.dbConnection.Model(&model).Where("provider = ?", provider).Select()

internal/sql/repository/GitProviderRepository.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type GitProviderRepository interface {
5252
ProviderExists(url string) (bool, error)
5353
FindAllActiveForAutocomplete() ([]GitProvider, error)
5454
FindAll() ([]GitProvider, error)
55+
FindAllGitProviderCount() (int, error)
5556
FindOne(providerId string) (GitProvider, error)
5657
FindByUrl(providerUrl string) (GitProvider, error)
5758
Update(gitProvider *GitProvider) error
@@ -95,6 +96,11 @@ func (impl GitProviderRepositoryImpl) FindAll() ([]GitProvider, error) {
9596
Where("deleted = ?", false).Select()
9697
return providers, err
9798
}
99+
func (impl GitProviderRepositoryImpl) FindAllGitProviderCount() (int, error) {
100+
gitProviderCount, err := impl.dbConnection.Model(&GitProvider{}).
101+
Where("deleted = ?", false).Count()
102+
return gitProviderCount, err
103+
}
98104

99105
func (impl GitProviderRepositoryImpl) FindOne(providerId string) (GitProvider, error) {
100106
var provider GitProvider

internal/sql/repository/dockerRegistry/DockerArtifactStoreRepository.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type DockerArtifactStoreRepository interface {
9292
FindActiveDefaultStore() (*DockerArtifactStore, error)
9393
FindAllActiveForAutocomplete() ([]DockerArtifactStore, error)
9494
FindAll() ([]DockerArtifactStore, error)
95+
FindAllDockerArtifactCount() (int, error)
9596
FindAllChartProviders() ([]DockerArtifactStore, error)
9697
FindOne(storeId string) (*DockerArtifactStore, error)
9798
FindOneWithDeploymentCount(storeId string) (*DockerArtifactStoreExt, error)
@@ -169,7 +170,12 @@ func (impl DockerArtifactStoreRepositoryImpl) FindAll() ([]DockerArtifactStore,
169170
Select()
170171
return providers, err
171172
}
172-
173+
func (impl DockerArtifactStoreRepositoryImpl) FindAllDockerArtifactCount() (int, error) {
174+
dockerArtifactCount, err := impl.dbConnection.Model(&DockerArtifactStore{}).
175+
Where("docker_artifact_store.active = ?", true).
176+
Count()
177+
return dockerArtifactCount, err
178+
}
173179
func (impl DockerArtifactStoreRepositoryImpl) FindAllChartProviders() ([]DockerArtifactStore, error) {
174180
var providers []DockerArtifactStore
175181
err := impl.dbConnection.Model(&providers).

internal/sql/repository/pipelineConfig/CdWorfkflowRepository.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type CdWorkflowRepository interface {
5757
FindLatestWfrByAppIdAndEnvironmentId(appId int, environmentId int) (*CdWorkflowRunner, error)
5858
IsLatestCDWfr(pipelineId, wfrId int) (bool, error)
5959
FindLatestCdWorkflowRunnerByEnvironmentIdAndRunnerType(appId int, environmentId int, runnerType bean.WorkflowType) (CdWorkflowRunner, error)
60-
60+
FindAllTriggeredWorkflowCountInLast24Hour() (cdWorkflowCount int, err error)
6161
GetConnection() *pg.DB
6262

6363
FindLastPreOrPostTriggeredByPipelineId(pipelineId int) (CdWorkflowRunner, error)
@@ -357,7 +357,19 @@ func (impl *CdWorkflowRepositoryImpl) FindLatestCdWorkflowByPipelineIdV2(pipelin
357357
// TODO - Group By Environment And Pipeline will get latest pipeline from top
358358
return cdWorkflow, err
359359
}
360-
360+
func (impl *CdWorkflowRepositoryImpl) FindAllTriggeredWorkflowCountInLast24Hour() (cdWorkflowCount int, err error) {
361+
cnt, err := impl.dbConnection.
362+
Model(&CdWorkflow{}).
363+
ColumnExpr("DISTINCT pipeline_id").
364+
Join("JOIN cd_workflow_runner ON cd_workflow.id = cd_workflow_runner.cd_workflow_id").
365+
Where("cd_workflow_runner.workflow_type = ? AND cd_workflow_runner.started_on > ?", bean.CD_WORKFLOW_TYPE_DEPLOY, time.Now().AddDate(0, 0, -1)).
366+
Group("cd_workflow.pipeline_id").
367+
Count()
368+
if err != nil {
369+
impl.logger.Errorw("error occurred while fetching cd workflow", "err", err)
370+
}
371+
return cnt, err
372+
}
361373
func (impl *CdWorkflowRepositoryImpl) FindCdWorkflowMetaByEnvironmentId(appId int, environmentId int, offset int, limit int) ([]CdWorkflowRunner, error) {
362374
var wfrList []CdWorkflowRunner
363375
err := impl.dbConnection.

internal/sql/repository/pipelineConfig/CiPipelineRepository.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ type CiPipelineRepository interface {
128128
FetchParentCiPipelinesForDG() ([]*bean.CiPipelinesMap, error)
129129
FetchCiPipelinesForDG(parentId int, childCiPipelineIds []int) (*CiPipeline, int, error)
130130
FinDByParentCiPipelineAndAppId(parentCiPipeline int, appIds []int) ([]*CiPipeline, error)
131-
FindAllPipelineInLast24Hour() (pipelines []*CiPipeline, err error)
131+
FindAllPipelineCreatedCountInLast24Hour() (pipelineCount int, err error)
132+
FindAllDeletedPipelineCountInLast24Hour() (pipelineCount int, err error)
132133
FindNumberOfAppsWithCiPipeline(appIds []int) (count int, err error)
133134
FindAppAndProjectByCiPipelineIds(ciPipelineIds []int) ([]*CiPipeline, error)
134135
FindCiPipelineConfigsByIds(ids []int) ([]*CiPipeline, error)
@@ -502,12 +503,17 @@ func (impl *CiPipelineRepositoryImpl) FinDByParentCiPipelineAndAppId(parentCiPip
502503
return ciPipelines, err
503504
}
504505

505-
func (impl *CiPipelineRepositoryImpl) FindAllPipelineInLast24Hour() (pipelines []*CiPipeline, err error) {
506-
err = impl.dbConnection.Model(&pipelines).
507-
Column("ci_pipeline.*").
506+
func (impl *CiPipelineRepositoryImpl) FindAllPipelineCreatedCountInLast24Hour() (pipelineCount int, err error) {
507+
pipelineCount, err = impl.dbConnection.Model(&CiPipeline{}).
508508
Where("created_on > ?", time.Now().AddDate(0, 0, -1)).
509-
Select()
510-
return pipelines, err
509+
Count()
510+
return pipelineCount, err
511+
}
512+
func (impl *CiPipelineRepositoryImpl) FindAllDeletedPipelineCountInLast24Hour() (pipelineCount int, err error) {
513+
pipelineCount, err = impl.dbConnection.Model(&CiPipeline{}).
514+
Where("created_on > ? and deleted=?", time.Now().AddDate(0, 0, -1), true).
515+
Count()
516+
return pipelineCount, err
511517
}
512518

513519
func (impl *CiPipelineRepositoryImpl) FindNumberOfAppsWithCiPipeline(appIds []int) (count int, err error) {

internal/sql/repository/pipelineConfig/CiWorkflowRepository.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type CiWorkflowRepository interface {
4343
FindLastTriggeredWorkflowByCiIds(pipelineId []int) (ciWorkflow []*CiWorkflow, err error)
4444
FindLastTriggeredWorkflowByArtifactId(ciArtifactId int) (ciWorkflow *CiWorkflow, err error)
4545
FindAllLastTriggeredWorkflowByArtifactId(ciArtifactId []int) (ciWorkflow []*CiWorkflow, err error)
46+
FindAllTriggeredWorkflowCountInLast24Hour() (ciWorkflowCount int, err error)
4647
FindLastTriggeredWorkflowGitTriggersByArtifactId(ciArtifactId int) (ciWorkflow *CiWorkflow, err error)
4748
FindLastTriggeredWorkflowGitTriggersByArtifactIds(ciArtifactIds []int) ([]*WorkflowWithArtifact, error)
4849
ExistsByStatus(status string) (bool, error)
@@ -286,7 +287,16 @@ func (impl *CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowByArtifactId(ciAr
286287
Select()
287288
return workflow, err
288289
}
289-
290+
func (impl *CiWorkflowRepositoryImpl) FindAllTriggeredWorkflowCountInLast24Hour() (ciWorkflowCount int, err error) {
291+
cnt, err := impl.dbConnection.Model(&CiWorkflow{}).
292+
ColumnExpr("DISTINCT ci_pipeline_id").
293+
Where("started_on > ? ", time.Now().AddDate(0, 0, -1)).
294+
Count()
295+
if err != nil {
296+
impl.logger.Errorw("error occurred while fetching ci workflow", "err", err)
297+
}
298+
return cnt, err
299+
}
290300
func (impl *CiWorkflowRepositoryImpl) FindAllLastTriggeredWorkflowByArtifactId(ciArtifactIds []int) (ciWorkflows []*CiWorkflow, err error) {
291301
err = impl.dbConnection.Model(&ciWorkflows).
292302
Column("ci_workflow.git_triggers", "ci_workflow.ci_pipeline_id", "CiPipeline", "cia.id").

internal/sql/repository/pipelineConfig/PipelineRepository.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ type PipelineRepository interface {
9393
FindByIdsInAndEnvironment(ids []int, environmentId int) ([]*Pipeline, error)
9494
FindActiveByAppIdAndEnvironmentIdV2() (pipelines []*Pipeline, err error)
9595
GetConnection() *pg.DB
96-
FindAllPipelineInLast24Hour() (pipelines []*Pipeline, err error)
96+
FindAllPipelineCreatedCountInLast24Hour() (pipelineCount int, err error)
97+
FindAllDeletedPipelineCountInLast24Hour() (pipelineCount int, err error)
9798
FindActiveByEnvId(envId int) (pipelines []*Pipeline, err error)
9899
FindActivePipelineByEnvId(envId int) (pipelines []*Pipeline, err error)
99100
FindActiveByEnvIds(envId []int) (pipelines []*Pipeline, err error)
@@ -447,12 +448,17 @@ func (impl PipelineRepositoryImpl) FindByPipelineTriggerGitHash(gitHash string)
447448
return pipelines, err
448449
}
449450

450-
func (impl PipelineRepositoryImpl) FindAllPipelineInLast24Hour() (pipelines []*Pipeline, err error) {
451-
err = impl.dbConnection.Model(&pipelines).
452-
Column("pipeline.*").
451+
func (impl PipelineRepositoryImpl) FindAllPipelineCreatedCountInLast24Hour() (pipelineCount int, err error) {
452+
pipelineCount, err = impl.dbConnection.Model(&Pipeline{}).
453453
Where("created_on > ?", time.Now().AddDate(0, 0, -1)).
454-
Select()
455-
return pipelines, err
454+
Count()
455+
return pipelineCount, err
456+
}
457+
func (impl PipelineRepositoryImpl) FindAllDeletedPipelineCountInLast24Hour() (pipelineCount int, err error) {
458+
pipelineCount, err = impl.dbConnection.Model(&Pipeline{}).
459+
Where("created_on > ? and deleted=?", time.Now().AddDate(0, 0, -1), true).
460+
Count()
461+
return pipelineCount, err
456462
}
457463
func (impl PipelineRepositoryImpl) FindActiveByEnvId(envId int) (pipelines []*Pipeline, err error) {
458464
err = impl.dbConnection.Model(&pipelines).Column("pipeline.*", "App", "Environment").

0 commit comments

Comments
 (0)