Skip to content

Commit

Permalink
feat: enabled code_level_metrics by default (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcanzanella authored Jul 14, 2023
1 parent 9be2139 commit 0b96de3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ defaultConfig.definition = () => ({
code_level_metrics: {
enabled: {
formatter: boolean,
default: false
default: true
}
},

Expand Down
4 changes: 2 additions & 2 deletions test/unit/config/config-defaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ tap.test('with default properties', (t) => {
t.end()
})

t.test('should default `code_level_metrics.enabled` to false', (t) => {
t.equal(configuration.code_level_metrics.enabled, false)
t.test('should default `code_level_metrics.enabled` to true', (t) => {
t.equal(configuration.code_level_metrics.enabled, true)
t.end()
})

Expand Down
17 changes: 12 additions & 5 deletions test/unit/shim/webframework-shim.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,14 @@ test('WebFrameworkShim', function (t) {
const segment = wrapped(req)

t.ok(segment.attributes)
t.same(segment.getAttributes(), {
'request.parameters.route.foo': 'bar',
'request.parameters.route.biz': 'bang'
})
const attrs = segment.getAttributes()
t.equal(attrs['request.parameters.route.foo'], 'bar')
t.equal(attrs['request.parameters.route.biz'], 'bang')
const filePathSplit = attrs['code.filepath'].split('/')
t.equal(filePathSplit[filePathSplit.length - 1], 'webframework-shim.test.js')
t.equal(attrs['code.function'], 'getActiveSegment')
t.equal(attrs['code.lineno'], 37)
t.equal(attrs['code.column'], 50)
t.end()
})
})
Expand All @@ -618,7 +622,10 @@ test('WebFrameworkShim', function (t) {
const segment = wrapped(req)

t.ok(segment.attributes)
t.same(segment.getAttributes(), {})
const attrs = Object.keys(segment.getAttributes())
const requestParameters = /request\.parameters.*/

t.notOk(attrs.some((attr) => requestParameters.test(attr)))
t.end()
})
})
Expand Down

0 comments on commit 0b96de3

Please sign in to comment.