Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/datadog-plugin-cypress/src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const {
getTestSuitePath,
addIntelligentTestRunnerSpanTags
} = require('../../dd-trace/src/plugins/util/test')
const {
getTestType
} = require('../../dd-trace/src/plugins/util/ci')
const { ORIGIN_KEY, COMPONENT } = require('../../dd-trace/src/constants')
const log = require('../../dd-trace/src/log')

Expand All @@ -37,7 +40,7 @@ const CYPRESS_STATUS_TO_TEST_STATUS = {
function getTestSpanMetadata (tracer, testName, testSuite, cypressConfig) {
const childOf = getTestParentSpan(tracer)

const commonTags = getTestCommonTags(testName, testSuite, cypressConfig.version)
const commonTags = getTestCommonTags(testName, testSuite, cypressConfig.version, getTestType(TEST_FRAMEWORK_NAME))

return {
childOf,
Expand Down
11 changes: 9 additions & 2 deletions packages/dd-trace/src/plugins/ci_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ const {
TEST_MODULE_ID,
TEST_SESSION_ID,
TEST_COMMAND,
TEST_MODULE
TEST_MODULE,
TEST_FRAMEWORK
} = require('./util/test')
const {
getTestType
} = require('./util/ci')
const Plugin = require('./plugin')
const { COMPONENT } = require('../constants')
const log = require('../log')
Expand Down Expand Up @@ -111,7 +115,10 @@ module.exports = class CiPlugin extends Plugin {
const childOf = getTestParentSpan(this.tracer)

let testTags = {
...getTestCommonTags(testName, testSuite, this.frameworkVersion),
...getTestCommonTags(testName,
testSuite,
this.frameworkVersion,
getTestType(this.testEnvironmentMetadata[TEST_FRAMEWORK])),
[COMPONENT]: this.constructor.id,
...extraTags
}
Expand Down
8 changes: 8 additions & 0 deletions packages/dd-trace/src/plugins/util/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ function filterSensitiveInfoFromRepository (repositoryUrl) {
}
}

function getTestType (frameworkName) {
if (frameworkName === 'playwright' || frameworkName === 'cypress') {
return 'browser'
}
return 'test'
}

function resolveTilde (filePath) {
if (!filePath || typeof filePath !== 'string') {
return ''
Expand All @@ -94,6 +101,7 @@ function resolveTilde (filePath) {

module.exports = {
normalizeRef,
getTestType,
getCIMetadata () {
const { env } = process

Expand Down
4 changes: 2 additions & 2 deletions packages/dd-trace/src/plugins/util/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ function getTestParentSpan (tracer) {
})
}

function getTestCommonTags (name, suite, version) {
function getTestCommonTags (name, suite, version, testType = 'test') {
return {
[SPAN_TYPE]: 'test',
[TEST_TYPE]: 'test',
[TEST_TYPE]: testType,
[SAMPLING_RULE_DECISION]: 1,
[SAMPLING_PRIORITY]: AUTO_KEEP,
[TEST_NAME]: name,
Expand Down