diff options
Diffstat (limited to 'main/civisibility/constants')
-rw-r--r-- | main/civisibility/constants/ci.go | 44 | ||||
-rw-r--r-- | main/civisibility/constants/env.go | 27 | ||||
-rw-r--r-- | main/civisibility/constants/git.go | 52 | ||||
-rw-r--r-- | main/civisibility/constants/os.go | 21 | ||||
-rw-r--r-- | main/civisibility/constants/runtime.go | 16 | ||||
-rw-r--r-- | main/civisibility/constants/span_types.go | 28 | ||||
-rw-r--r-- | main/civisibility/constants/tags.go | 43 | ||||
-rw-r--r-- | main/civisibility/constants/test_tags.go | 90 |
8 files changed, 321 insertions, 0 deletions
diff --git a/main/civisibility/constants/ci.go b/main/civisibility/constants/ci.go new file mode 100644 index 0000000..d1ca2e8 --- /dev/null +++ b/main/civisibility/constants/ci.go @@ -0,0 +1,44 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // CIJobName indicates the name of the CI job. + CIJobName = "ci.job.name" + + // CIJobURL indicates the URL of the CI job. + CIJobURL = "ci.job.url" + + // CIPipelineID indicates the ID of the CI pipeline. + CIPipelineID = "ci.pipeline.id" + + // CIPipelineName indicates the name of the CI pipeline. + CIPipelineName = "ci.pipeline.name" + + // CIPipelineNumber indicates the number of the CI pipeline. + CIPipelineNumber = "ci.pipeline.number" + + // CIPipelineURL indicates the URL of the CI pipeline. + CIPipelineURL = "ci.pipeline.url" + + // CIProviderName indicates the name of the CI provider. + CIProviderName = "ci.provider.name" + + // CIStageName indicates the name of the CI stage. + CIStageName = "ci.stage.name" + + // CINodeName indicates the name of the node in the CI environment. + CINodeName = "ci.node.name" + + // CINodeLabels indicates the labels associated with the node in the CI environment. + CINodeLabels = "ci.node.labels" + + // CIWorkspacePath records an absolute path to the directory where the project has been checked out. + CIWorkspacePath = "ci.workspace_path" + + // CIEnvVars contains environment variables used to get the pipeline correlation ID. + CIEnvVars = "_dd.ci.env_vars" +) diff --git a/main/civisibility/constants/env.go b/main/civisibility/constants/env.go new file mode 100644 index 0000000..ebc00fc --- /dev/null +++ b/main/civisibility/constants/env.go @@ -0,0 +1,27 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // CIVisibilityEnabledEnvironmentVariable indicates if CI Visibility mode is enabled. + // This environment variable should be set to "1" or "true" to enable CI Visibility mode, which activates tracing and other + // features related to CI Visibility in the Datadog platform. + CIVisibilityEnabledEnvironmentVariable = "DD_CIVISIBILITY_ENABLED" + + // CIVisibilityAgentlessEnabledEnvironmentVariable indicates if CI Visibility agentless mode is enabled. + // This environment variable should be set to "1" or "true" to enable agentless mode for CI Visibility, where traces + // are sent directly to Datadog without using a local agent. + CIVisibilityAgentlessEnabledEnvironmentVariable = "DD_CIVISIBILITY_AGENTLESS_ENABLED" + + // CIVisibilityAgentlessURLEnvironmentVariable forces the agentless URL to a custom one. + // This environment variable allows you to specify a custom URL for the agentless intake in CI Visibility mode. + CIVisibilityAgentlessURLEnvironmentVariable = "DD_CIVISIBILITY_AGENTLESS_URL" + + // APIKeyEnvironmentVariable indicates the API key to be used for agentless intake. + // This environment variable should be set to your Datadog API key, allowing the agentless mode to authenticate and + // send data directly to the Datadog platform. + APIKeyEnvironmentVariable = "DD_API_KEY" +) diff --git a/main/civisibility/constants/git.go b/main/civisibility/constants/git.go new file mode 100644 index 0000000..6265be3 --- /dev/null +++ b/main/civisibility/constants/git.go @@ -0,0 +1,52 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // GitBranch indicates the current git branch. + // This constant is used to tag traces with the branch name being used in the CI/CD process. + GitBranch = "git.branch" + + // GitCommitAuthorDate indicates the git commit author date related to the build. + // This constant is used to tag traces with the date when the author created the commit. + GitCommitAuthorDate = "git.commit.author.date" + + // GitCommitAuthorEmail indicates the git commit author email related to the build. + // This constant is used to tag traces with the email of the author who created the commit. + GitCommitAuthorEmail = "git.commit.author.email" + + // GitCommitAuthorName indicates the git commit author name related to the build. + // This constant is used to tag traces with the name of the author who created the commit. + GitCommitAuthorName = "git.commit.author.name" + + // GitCommitCommitterDate indicates the git commit committer date related to the build. + // This constant is used to tag traces with the date when the committer applied the commit. + GitCommitCommitterDate = "git.commit.committer.date" + + // GitCommitCommitterEmail indicates the git commit committer email related to the build. + // This constant is used to tag traces with the email of the committer who applied the commit. + GitCommitCommitterEmail = "git.commit.committer.email" + + // GitCommitCommitterName indicates the git commit committer name related to the build. + // This constant is used to tag traces with the name of the committer who applied the commit. + GitCommitCommitterName = "git.commit.committer.name" + + // GitCommitMessage indicates the git commit message related to the build. + // This constant is used to tag traces with the message associated with the commit. + GitCommitMessage = "git.commit.message" + + // GitCommitSHA indicates the git commit SHA1 hash related to the build. + // This constant is used to tag traces with the SHA1 hash of the commit. + GitCommitSHA = "git.commit.sha" + + // GitRepositoryURL indicates the git repository URL related to the build. + // This constant is used to tag traces with the URL of the repository where the commit is stored. + GitRepositoryURL = "git.repository_url" + + // GitTag indicates the current git tag. + // This constant is used to tag traces with the tag name associated with the current commit. + GitTag = "git.tag" +) diff --git a/main/civisibility/constants/os.go b/main/civisibility/constants/os.go new file mode 100644 index 0000000..e065f17 --- /dev/null +++ b/main/civisibility/constants/os.go @@ -0,0 +1,21 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // OSPlatform indicates the operating system family (e.g., linux, windows, darwin). + // This constant is used to tag traces with the operating system family on which the tests are running. + OSPlatform = "os.platform" + + // OSVersion indicates the version of the operating system. + // This constant is used to tag traces with the specific version of the operating system on which the tests are running. + OSVersion = "os.version" + + // OSArchitecture indicates the architecture this SDK is built for (e.g., amd64, 386, arm). + // This constant is used to tag traces with the architecture of the operating system for which the tests are built. + // Note: This could be 32-bit on a 64-bit system. + OSArchitecture = "os.architecture" +) diff --git a/main/civisibility/constants/runtime.go b/main/civisibility/constants/runtime.go new file mode 100644 index 0000000..15257ef --- /dev/null +++ b/main/civisibility/constants/runtime.go @@ -0,0 +1,16 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // RuntimeName indicates the name of the runtime compiler. + // This constant is used to tag traces with the name of the runtime compiler being used (e.g., Go, JVM). + RuntimeName = "runtime.name" + + // RuntimeVersion indicates the version of the runtime compiler. + // This constant is used to tag traces with the specific version of the runtime compiler being used. + RuntimeVersion = "runtime.version" +) diff --git a/main/civisibility/constants/span_types.go b/main/civisibility/constants/span_types.go new file mode 100644 index 0000000..55f3fe5 --- /dev/null +++ b/main/civisibility/constants/span_types.go @@ -0,0 +1,28 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // SpanTypeTest marks a span as a test execution. + // This constant is used to indicate that the span represents a test execution. + SpanTypeTest = "test" + + // SpanTypeTestSuite marks a span as a test suite. + // This constant is used to indicate that the span represents the end of a test suite. + SpanTypeTestSuite = "test_suite_end" + + // SpanTypeTestModule marks a span as a test module. + // This constant is used to indicate that the span represents the end of a test module. + SpanTypeTestModule = "test_module_end" + + // SpanTypeTestSession marks a span as a test session. + // This constant is used to indicate that the span represents the end of a test session. + SpanTypeTestSession = "test_session_end" + + // SpanTypeSpan marks a span as a span event. + // This constant is used to indicate that the span represents a general span event. + SpanTypeSpan = "span" +) diff --git a/main/civisibility/constants/tags.go b/main/civisibility/constants/tags.go new file mode 100644 index 0000000..4563cb8 --- /dev/null +++ b/main/civisibility/constants/tags.go @@ -0,0 +1,43 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // Origin is a tag used to indicate the origin of the data. + // This tag helps in identifying the source of the trace data. + Origin = "_dd.origin" + + // CIAppTestOrigin defines the CIApp test origin value. + // This constant is used to tag traces that originate from CIApp test executions. + CIAppTestOrigin = "ciapp-test" + + // TestSessionIDTag defines the test session ID tag for the CI Visibility Protocol. + // This constant is used to tag traces with the ID of the test session. + TestSessionIDTag string = "test_session_id" + + // TestModuleIDTag defines the test module ID tag for the CI Visibility Protocol. + // This constant is used to tag traces with the ID of the test module. + TestModuleIDTag string = "test_module_id" + + // TestSuiteIDTag defines the test suite ID tag for the CI Visibility Protocol. + // This constant is used to tag traces with the ID of the test suite. + TestSuiteIDTag string = "test_suite_id" + + // ItrCorrelationIDTag defines the correlation ID for the intelligent test runner tag for the CI Visibility Protocol. + // This constant is used to tag traces with the correlation ID for intelligent test runs. + ItrCorrelationIDTag string = "itr_correlation_id" +) + +// Coverage tags +const ( + // CodeCoverageEnabledTag defines if code coverage has been enabled. + // This constant is used to tag traces to indicate whether code coverage measurement is enabled. + CodeCoverageEnabledTag string = "test.code_coverage.enabled" + + // CodeCoveragePercentageOfTotalLines defines the percentage of total code coverage by a session. + // This constant is used to tag traces with the percentage of code lines covered during the test session. + CodeCoveragePercentageOfTotalLines string = "test.code_coverage.lines_pct" +) diff --git a/main/civisibility/constants/test_tags.go b/main/civisibility/constants/test_tags.go new file mode 100644 index 0000000..3a621a2 --- /dev/null +++ b/main/civisibility/constants/test_tags.go @@ -0,0 +1,90 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024 Datadog, Inc. + +package constants + +const ( + // TestModule indicates the test module name. + // This constant is used to tag traces with the name of the test module. + TestModule = "test.module" + + // TestSuite indicates the test suite name. + // This constant is used to tag traces with the name of the test suite. + TestSuite = "test.suite" + + // TestName indicates the test name. + // This constant is used to tag traces with the name of the test. + TestName = "test.name" + + // TestType indicates the type of the test (e.g., test, benchmark). + // This constant is used to tag traces with the type of the test. + TestType = "test.type" + + // TestFramework indicates the test framework name. + // This constant is used to tag traces with the name of the test framework. + TestFramework = "test.framework" + + // TestFrameworkVersion indicates the test framework version. + // This constant is used to tag traces with the version of the test framework. + TestFrameworkVersion = "test.framework_version" + + // TestStatus indicates the test execution status. + // This constant is used to tag traces with the execution status of the test. + TestStatus = "test.status" + + // TestSkipReason indicates the skip reason of the test. + // This constant is used to tag traces with the reason why the test was skipped. + TestSkipReason = "test.skip_reason" + + // TestSourceFile indicates the source file where the test is located. + // This constant is used to tag traces with the file path of the test source code. + TestSourceFile = "test.source.file" + + // TestSourceStartLine indicates the line of the source file where the test starts. + // This constant is used to tag traces with the line number in the source file where the test starts. + TestSourceStartLine = "test.source.start" + + // TestCodeOwners indicates the test code owners. + // This constant is used to tag traces with the code owners responsible for the test. + TestCodeOwners = "test.codeowners" + + // TestCommand indicates the test command. + // This constant is used to tag traces with the command used to execute the test. + TestCommand = "test.command" + + // TestCommandExitCode indicates the test command exit code. + // This constant is used to tag traces with the exit code of the test command. + TestCommandExitCode = "test.exit_code" + + // TestCommandWorkingDirectory indicates the test command working directory relative to the source root. + // This constant is used to tag traces with the working directory path relative to the source root. + TestCommandWorkingDirectory = "test.working_directory" +) + +// Define valid test status types. +const ( + // TestStatusPass marks test execution as passed. + // This constant is used to tag traces with a status indicating that the test passed. + TestStatusPass = "pass" + + // TestStatusFail marks test execution as failed. + // This constant is used to tag traces with a status indicating that the test failed. + TestStatusFail = "fail" + + // TestStatusSkip marks test execution as skipped. + // This constant is used to tag traces with a status indicating that the test was skipped. + TestStatusSkip = "skip" +) + +// Define valid test types. +const ( + // TestTypeTest defines test type as test. + // This constant is used to tag traces indicating that the type of test is a standard test. + TestTypeTest = "test" + + // TestTypeBenchmark defines test type as benchmark. + // This constant is used to tag traces indicating that the type of test is a benchmark. + TestTypeBenchmark = "benchmark" +) |