Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update http status code temporarily to always be a string #838

Merged
merged 4 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions packages/datadog-plugin-connect/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -377,7 +377,7 @@ describe('Plugin', () => {

expect(spans[0]).to.have.property('error', 1)
expect(spans[0]).to.have.property('resource', 'GET /user')
expect(spans[0].metrics).to.have.property('http.status_code', 500)
expect(spans[0].meta).to.have.property('http.status_code', '500')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -411,7 +411,7 @@ describe('Plugin', () => {

expect(spans[0]).to.have.property('error', 0)
expect(spans[0]).to.have.property('resource', 'GET /user')
expect(spans[0].metrics).to.have.property('http.status_code', 400)
expect(spans[0].meta).to.have.property('http.status_code', '400')
})
.then(done)
.catch(done)
Expand All @@ -438,7 +438,7 @@ describe('Plugin', () => {
const spans = sort(traces[0])

expect(spans[0]).to.have.property('error', 1)
expect(spans[0].metrics).to.have.property('http.status_code', 500)
expect(spans[0].meta).to.have.property('http.status_code', '500')
})
.then(done)
.catch(done)
Expand Down
14 changes: 7 additions & 7 deletions packages/datadog-plugin-express/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/app/user/1`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/app/user/1`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -690,7 +690,7 @@ describe('Plugin', () => {

expect(spans[0]).to.have.property('error', 1)
expect(spans[0]).to.have.property('resource', 'GET /user')
expect(spans[0].metrics).to.have.property('http.status_code', 500)
expect(spans[0].meta).to.have.property('http.status_code', '500')

done()
})
Expand Down Expand Up @@ -723,7 +723,7 @@ describe('Plugin', () => {

expect(spans[0]).to.have.property('error', 0)
expect(spans[0]).to.have.property('resource', 'GET /user')
expect(spans[0].metrics).to.have.property('http.status_code', 400)
expect(spans[0].meta).to.have.property('http.status_code', '400')

done()
})
Expand All @@ -750,7 +750,7 @@ describe('Plugin', () => {
const spans = sort(traces[0])

expect(spans[0]).to.have.property('error', 1)
expect(spans[0].metrics).to.have.property('http.status_code', 500)
expect(spans[0].meta).to.have.property('http.status_code', '500')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -846,7 +846,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/dd`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-fastify/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user/123`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
2 changes: 1 addition & 1 deletion packages/datadog-plugin-hapi/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'server')
expect(traces[0][0].meta).to.have.property('http.url', `http://localhost:${port}/user/123`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-http/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
expect(traces[0][0].meta).to.have.property('http.url', `${protocol}://localhost:${port}/user`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
2 changes: 1 addition & 1 deletion packages/datadog-plugin-http/test/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'server')
expect(traces[0][0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-http2/test/client.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'client')
expect(traces[0][0].meta).to.have.property('http.url', `${protocol}://localhost:${port}/user`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -326,7 +326,7 @@ describe('Plugin', () => {
getPort().then(port => {
agent
.use(traces => {
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-http2/test/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'server')
expect(traces[0][0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'server')
expect(traces[0][0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 200)
expect(traces[0][0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-plugin-koa/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')

expect(spans[1]).to.have.property('name', 'koa.middleware')
expect(spans[1]).to.have.property('service', 'test')
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')

expect(spans[1]).to.have.property('name', 'koa.middleware')
expect(spans[1]).to.have.property('service', 'test')
Expand Down
8 changes: 4 additions & 4 deletions packages/datadog-plugin-paperplane/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('Plugin', () => {
expect(spans[0].meta).to.have.property('span.kind', 'server')
expect(spans[0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(spans[0].meta).to.have.property('http.method', 'GET')
expect(spans[0].metrics).to.have.property('http.status_code', 200)
expect(spans[0].meta).to.have.property('http.status_code', '200')
})
.then(done)
.catch(done)
Expand Down Expand Up @@ -354,7 +354,7 @@ describe('Plugin', () => {

expect(spans[0]).to.have.property('error', 1)
expect(spans[0]).to.have.property('resource', 'GET /user')
expect(spans[0].metrics).to.have.property('http.status_code', 500)
expect(spans[0].meta).to.have.property('http.status_code', '500')

done()
})
Expand Down Expand Up @@ -386,7 +386,7 @@ describe('Plugin', () => {

expect(spans[0]).to.have.property('error', 0)
expect(spans[0]).to.have.property('resource', 'GET /user')
expect(spans[0].metrics).to.have.property('http.status_code', 400)
expect(spans[0].meta).to.have.property('http.status_code', '400')

done()
})
Expand Down Expand Up @@ -414,7 +414,7 @@ describe('Plugin', () => {
const spans = sort(traces[0])

expect(spans[0]).to.have.property('error', 1)
expect(spans[0].metrics).to.have.property('http.status_code', 500)
expect(spans[0].meta).to.have.property('http.status_code', '500')
})
.then(done)
.catch(done)
Expand Down
2 changes: 1 addition & 1 deletion packages/datadog-plugin-restify/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('span.kind', 'server')
expect(traces[0][0].meta).to.have.property('http.url', `http://localhost:${port}/user`)
expect(traces[0][0].meta).to.have.property('http.method', 'GET')
expect(traces[0][0].metrics).to.have.property('http.status_code', 404)
expect(traces[0][0].meta).to.have.property('http.status_code', '404')
})
.then(done)
.catch(done)
Expand Down
4 changes: 4 additions & 0 deletions packages/dd-trace/src/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ function extractTags (trace, span) {
case 'resource.name':
addTag(trace, {}, map[tag], tags[tag])
break
// HACK: remove when Datadog supports numeric status code
case 'http.status_code':
addTag(trace.meta, {}, tag, tags[tag] && String(tags[tag]))
break
case HOSTNAME_KEY:
case ANALYTICS:
break
Expand Down