lib/instrumentation/express-utils.js
function getPathFromRequest (req, useBase, usePathAsTransactionName) {
  // Static serving route
  if (req[symbols.staticFile]) {
    return 'static file'
  }

  var path = getStackPath(req)
  var route = routePath(req.route)

  if (route) {
    return path ? join([ path, route ]) : route
  }

  if (useBase) {
    return path
  }

  // Enable usePathAsTransactionName config
  if (usePathAsTransactionName) {
    const parsed = parseUrl(req)
    return parsed && parsed.pathname
  }
}
function getPathFromRequest (req, useBase, usePathAsTransactionName) {
  // Static serving route
  if (req[symbols.staticFile]) {
    return 'static file'
  }

  var path = getStackPath(req)
  var route = routePath(req.route)

  if (route) {
    return path ? join([ path, route ]) : route
  }

  if (useBase) {
    return path
  }

  // Enable usePathAsTransactionName config
  if (usePathAsTransactionName) {
    const parsed = parseUrl(req)
    return parsed && parsed.pathname
  }
}
function getPathFromRequest ( req , useBase , usePathAsTransactionName ) { // Static serving route if ( req [ symbols . staticFile ] ) { return 'static file' } var path = getStackPath ( req ) var route = routePath ( req . route ) if ( route ) { return path ? join ( [ path , route ] ) : route } if ( useBase ) { return path } // Enable usePathAsTransactionName config if ( usePathAsTransactionName ) { const parsed = parseUrl ( req ) return parsed && parsed . pathname } }
This function is also able to extract the path from a Restify request as it's storing the route name on req.route.path as well
This function is also able to extract the path from a Restify request as it s storing the route name on req . route . path as well