Skip to content

Commit

Permalink
feat(telemetry): add attributes related to the usage inside CI-systems
Browse files Browse the repository at this point in the history
Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Aug 4, 2022
1 parent 7d19f54 commit ec02e33
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions pkg/telemetry/telemetrywerfio.go
Expand Up @@ -14,6 +14,7 @@ import (
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"

"github.com/werf/werf/pkg/util"
"github.com/werf/werf/pkg/werf"
)

Expand Down Expand Up @@ -133,6 +134,36 @@ func (t *TelemetryWerfIO) getAttributes() map[string]interface{} {
attributes["groupChannel"] = val
}

{
if isCI := util.GetBoolEnvironmentDefaultFalse("CI"); isCI {
attributes["CI"] = true
}
if isGitlabCI := util.GetBoolEnvironmentDefaultFalse("GITLAB_CI"); isGitlabCI {
attributes["ciName"] = "gitlab"
}
if val := os.Getenv("JENKINS_URL"); val != "" {
attributes["ciName"] = "jenkins"
}
if isTravis := util.GetBoolEnvironmentDefaultFalse("TRAVIS"); isTravis {
attributes["ciName"] = "travis"
}
if isGithubActions := util.GetBoolEnvironmentDefaultFalse("GITHUB_ACTIONS"); isGithubActions {
attributes["ciName"] = "github-actions"
}
if isCircleCI := util.GetBoolEnvironmentDefaultFalse("CIRCLECI"); isCircleCI {
attributes["ciName"] = "circleci"
}
if val := os.Getenv("TEAMCITY_VERSION"); val != "" {
attributes["ciName"] = "teamcity"
}
if isBuddy := util.GetBoolEnvironmentDefaultFalse("BUDDY"); isBuddy {
attributes["ciName"] = "buddy"
}
if val := os.Getenv("GO_SERVER_URL"); val != "" {
attributes["ciName"] = "gocd"
}
}

return attributes
}

Expand Down

0 comments on commit ec02e33

Please sign in to comment.