Skip to content

Commit a5ec769

Browse files
committed
[express] Address PR feedback.
1 parent 9ca5a8d commit a5ec769

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/API.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Each integration also has its own list of default tags. These tags get automatic
144144
|------------------|---------------------------|----------------------------------------|
145145
| service | *Service name of the app* | The service name for this integration. |
146146
| validateStatus | `code => code < 500` | Callback function to determine if there was an error. It should take a status code as its only parameter and return `true` for success or `false` for errors. |
147-
| recordHeaders | `[]` | An array of headers to include in the span metadata. |
147+
| headers | `[]` | An array of headers to include in the span metadata. |
148148

149149
<h3 id="graphql">graphql</h3>
150150

src/plugins/express.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const pathToRegExp = require('path-to-regexp')
99
const OPERATION_NAME = 'express.request'
1010

1111
function createWrapMethod (tracer, config) {
12-
const recordHeaders = config.recordHeaders ? config.recordHeaders.map(key => key.toLowerCase()) : []
12+
const headersToRecord = Array.isArray(config.headers) ? config.headers.map(key => key.toLowerCase()) : []
1313

1414
const validateStatus = typeof config.validateStatus === 'function'
1515
? config.validateStatus
@@ -48,7 +48,7 @@ function createWrapMethod (tracer, config) {
4848
span.setTag(Tags.ERROR, true)
4949
}
5050

51-
recordHeaders.forEach(key => {
51+
headersToRecord.forEach(key => {
5252
const value = req.headers[key]
5353
if (value) {
5454
span.setTag(`http.headers.${key}`, value)

test/plugins/express.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ describe('Plugin', () => {
547547
config = {
548548
service: 'custom',
549549
validateStatus: code => code < 400,
550-
recordHeaders: ['User-Agent']
550+
headers: ['User-Agent']
551551
}
552552

553553
return agent.load(plugin, 'express', config)

0 commit comments

Comments
 (0)