Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
2 changes: 1 addition & 1 deletion packages/datadog-plugin-cypress/src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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, TEST_FRAMEWORK_NAME)

return {
childOf,
Expand Down
5 changes: 4 additions & 1 deletion packages/dd-trace/src/plugins/ci_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ module.exports = class CiPlugin extends Plugin {
const childOf = getTestParentSpan(this.tracer)

let testTags = {
...getTestCommonTags(testName, testSuite, this.frameworkVersion),
...getTestCommonTags(testName,
testSuite,
this.frameworkVersion,
this.constructor.id),
[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 getTestTypeFromFramework (testFramework) {
if (testFramework === 'playwright' || testFramework === '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,
getTestTypeFromFramework,
getCIMetadata () {
const { env } = process

Expand Down
6 changes: 3 additions & 3 deletions packages/dd-trace/src/plugins/util/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ignore = require('ignore')

const { getGitMetadata } = require('./git')
const { getUserProviderGitMetadata } = require('./user-provided-git')
const { getCIMetadata } = require('./ci')
const { getCIMetadata, getTestTypeFromFramework } = require('./ci')
const { getRuntimeAndOSMetadata } = require('./env')
const {
GIT_BRANCH,
Expand Down Expand Up @@ -188,10 +188,10 @@ function getTestParentSpan (tracer) {
})
}

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