Skip to content

Commit

Permalink
xray testing
Browse files Browse the repository at this point in the history
  • Loading branch information
bejavu committed Mar 7, 2017
1 parent 2aa4c8e commit bab5ec3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,21 @@ module.exports = function (properties) {
var error = properties.modules && properties.modules.error
var logger = properties.modules && properties.modules.logger
var requestid = properties.modules && properties.modules.requestid
var xray_sample = properties.xray && properties.xray.sample
var xray_service = properties.xray && properties.xray.service
var xray_app_name = properties.xray && properties.xray.app_name
// /////////////////////////Building the express server///////////////////////////

// Express Server
var app = express()
var AWSXRay
if (xray_sample) {
AWSXRay = require('aws-xray-sdk')
if (xray_service) {
AWSXRay.config([AWSXRay.plugins[xray_service]])
}
app.use(AWSXRay.express.openSegment(xray_app_name || 'default_app_name'))
}

// If proxy procotol is enabled we need to fix standard headers
if (proxy === 'true') {
Expand Down Expand Up @@ -151,6 +162,10 @@ module.exports = function (properties) {
})
error && app.use(error)

if (xray_sample) {
app.use(AWSXRay.express.closeSegment())
}

// ////////////////////Building The returned Server Object//////////////////////
var server = {
port: http_port,
Expand Down

0 comments on commit bab5ec3

Please sign in to comment.