diff --git a/pkg/tcl/apitcl/v1/testworkflowmetrics.go b/pkg/tcl/apitcl/v1/testworkflowmetrics.go index 84c3739c4f7..f718f080757 100644 --- a/pkg/tcl/apitcl/v1/testworkflowmetrics.go +++ b/pkg/tcl/apitcl/v1/testworkflowmetrics.go @@ -35,10 +35,16 @@ func (s *apiTCL) sendCreateWorkflowTelemetry(ctx context.Context, workflow *test } var dataSource string - if len(workflow.Spec.Content.Files) != 0 { - dataSource = "files" - } else if workflow.Spec.Content.Git != nil { - dataSource = "git" + isKubeshopGitURI := false + if workflow.Spec.Content != nil { + if len(workflow.Spec.Content.Files) != 0 { + dataSource = "files" + } else if workflow.Spec.Content.Git != nil { + dataSource = "git" + if strings.Contains(workflow.Spec.Content.Git.Uri, "kubeshop") { + isKubeshopGitURI = true + } + } } hasArtifacts := false @@ -54,13 +60,6 @@ func (s *apiTCL) sendCreateWorkflowTelemetry(ctx context.Context, workflow *test image = workflow.Spec.Container.Image } - isKubeshopGitURI := false - if workflow.Spec.Content != nil && workflow.Spec.Content.Git != nil { - if strings.Contains(workflow.Spec.Content.Git.Uri, "kubeshop") { - isKubeshopGitURI = true - } - } - out, err := telemetry.SendCreateWorkflowEvent("testkube_api_create_test_workflow", telemetry.CreateWorkflowParams{ CreateParams: telemetry.CreateParams{ AppVersion: version.Version, @@ -107,10 +106,16 @@ func (s *apiTCL) sendCreateWorkflowTemplateTelemetry(ctx context.Context, templa } var dataSource string - if template.Spec.Content != nil && len(template.Spec.Content.Files) != 0 { - dataSource = "files" - } else if template.Spec.Content.Git != nil { - dataSource = "git" + isKubeshopGitURI := false + if template.Spec.Content != nil { + if len(template.Spec.Content.Files) != 0 { + dataSource = "files" + } else if template.Spec.Content.Git != nil { + dataSource = "git" + if strings.Contains(template.Spec.Content.Git.Uri, "kubeshop") { + isKubeshopGitURI = true + } + } } hasArtifacts := false @@ -126,13 +131,6 @@ func (s *apiTCL) sendCreateWorkflowTemplateTelemetry(ctx context.Context, templa image = template.Spec.Container.Image } - isKubeshopGitURI := false - if template.Spec.Content != nil && template.Spec.Content.Git != nil { - if strings.Contains(template.Spec.Content.Git.Uri, "kubeshop") { - isKubeshopGitURI = true - } - } - out, err := telemetry.SendCreateWorkflowEvent("testkube_api_create_test_workflow_template", telemetry.CreateWorkflowParams{ CreateParams: telemetry.CreateParams{ AppVersion: version.Version, @@ -178,10 +176,16 @@ func (s *apiTCL) sendRunWorkflowTelemetry(ctx context.Context, workflow *testwor } var dataSource string - if len(workflow.Spec.Content.Files) != 0 { - dataSource = "files" - } else if workflow.Spec.Content.Git != nil { - dataSource = "git" + isKubeshopGitURI := false + if workflow.Spec.Content != nil { + if len(workflow.Spec.Content.Files) != 0 { + dataSource = "files" + } else if workflow.Spec.Content.Git != nil { + dataSource = "git" + if strings.Contains(workflow.Spec.Content.Git.Uri, "kubeshop") { + isKubeshopGitURI = true + } + } } hasArtifacts := false @@ -196,12 +200,6 @@ func (s *apiTCL) sendRunWorkflowTelemetry(ctx context.Context, workflow *testwor if workflow.Spec.Container != nil { image = workflow.Spec.Container.Image } - isKubeshopGitURI := false - if workflow.Spec.Content != nil && workflow.Spec.Content.Git != nil { - if strings.Contains(workflow.Spec.Content.Git.Uri, "kubeshop") { - isKubeshopGitURI = true - } - } out, err := telemetry.SendRunWorkflowEvent("testkube_api_run_test_workflow", telemetry.RunWorkflowParams{ RunParams: telemetry.RunParams{