Socket
Socket
Sign inDemoInstall

@sap/e2e-trace

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/e2e-trace - npm Package Compare versions

Comparing version 1.1.3 to 1.3.0

CHANGELOG.md

1

lib/passport/validation.js

@@ -17,2 +17,3 @@ 'use strict';

assert(/^[0-9A-F]+$/i.test(value), util.format('%s does not represent a valid hex', name));
assert(value.length % 2 === 0, 'Hex string must contain even number of characters');
},

@@ -19,0 +20,0 @@

2

package.json

@@ -1,1 +0,1 @@

{"dependencies":{"request-stats":"2.0.1"},"description":"Provides functionalities for handling SAP Passports","devDependencies":{"capture-stream":"0.1.2","chai":"3.5.0","connect":"3.4.1","eslint":"3.2.2","filter-node-package":"^2.0.0","istanbul":"0.4.4","lodash":"4.17.4","mocha":"3.0.2","node-style":"^2.0.0","proxyquire":"1.7.10","sinon":"1.17.5","supertest":"2.0.0"},"engines":{"node":"^0.12.7 || ^4.4.7 || ^6.0.0"},"main":"index.js","maintainers":[{"name":"https-support.sap.com","email":"do-not-reply@sap.com"}],"name":"@sap/e2e-trace","optionalDependencies":{},"readme":"# @sap/e2e-trace\n\nNode.js package with end to end tracing capabilities.\n\n\n## Overview\n\n### SAP Passport\n\nSAP Passports allow to identify a specific request in an end-to-end scenario involving several components communicating with each other.\nThis is especially helpful in the task of following the state of a business transaction across different systems.\nTo achieve that, the client should send a special header ('sap-passport') containing the SAP Passport to the first component.\nThe SAP Passport is a hex string with a special structure. The client can send one via a browser plugin or via SAPUI5 application frontend.\nWhenever an SAP Passport comes into a component, this component should also include the unique identifiers of the SAP Passport in its logs/traces,\nupdate it with component specific data and then forward it to the next system.\n\nSee the diagram below:\n\n![SAP Passport overview diagram](diagram.png \"Overview diagram\")\n\nAn application receives an SAP Passport in the 'sap-passport' header. The same header is used when the SAP Passport is getting forwarded over the HTTP protocol to another system.\nIf it is being sent to HANA, the SAP Passport should be set as the 'SAP_PASSPORT' session variable of the database connection.\n\n#### API\n\n- Loading the package:\n\n```js\nvar SAPPassport = require('@sap/e2e-trace').Passport;\n```\n\n- Creating an SAP Passport instance\n\n```js\nfunction requestHandler(req, res) {\n var encodedPassport = req.headers[SAPPassport.HEADER_NAME];\n if (encodedPassport) {\n var passport = new SAPPassport(encodedPassport);\n }\n}\n```\n\nThe library provides a constant for the 'sap-passport' header: `SAPPassport.HEADER_NAME`.\n\nThe `passport` variable is an instance with which you may read/modify the SAP Passport in your component.\n\n- Reading the unique identifiers of an SAP Passport\n\n```js\nvar identifiers = passport.readUniqueIdentifiers();\n```\n\nThe returned value (assigned to the `identifiers` variable) is an object that has the following properties: `transactionID`, `rootContextID`, `connectionID`, `connectionCounter`.\nThese SAP Passport fields got to be present in the logs/traces of the component.\nIf you are using the `sap-logging` library, refer to its documentation to check whether the specific version is capable of handling SAP Passports or not.\n\n\n- Updating the SAP Passport - this is done right before forwarding it to the next component.\n\n```js\npassport.update({\n previousComponent: 'my-application',\n connectionID: '00112233445566778899AABBCCDDEEFF',\n connectionCounter: 36\n});\n```\n\nThis method takes an object with the following properties:\n\nProperty | Value | Mandatory | Semantics\n------------- | ---------- | --------- | --------------------------\n`previousComponent` | ASCII string. Up to 32 characters. | | This is the name of the current component which is about to make an outbound connection to another component. Defaults to _XSA Node.js_.\n`connectionID` | GUID, 16-byte hex | yes | Every connection between the current component and the next component should have an ID which is passed as that property.\n`connectionCounter`| Positive integer, up to 4 bytes | yes | States for which time the connection with the given `connectionID` is being reused.\n\n- Compacting the SAP Passport - HANA DB has a limitation over the SAP Passport size.\nThis is why it is recommended to call the method `compact` before forwarding an SAP Passport to HANA.\n\n```js\npassport.compact();\n```\n\n- Generating a hex string out of the updated SAP Passport - the SAP Passport can be send to other components in this format.\n\n```js\nvar http = require('http');\nvar url = require('url');\n\nvar encodedPassport = passport.serialize();\n\nvar options = url.parse('http://my-host:1234/my/path');\noptions.headers = {};\noptions.headers[SAPPassport.HEADER_NAME] = encodedPassport;\n\nvar request = http.request(options);\nrequest.on('error', function (err) { /* ... */ });\nrequest.on('response', function (response) { /* ... */ });\nrequest.end();\n```\n\n\n### DSR records\n\nDistributed Statistics Records contain statistical information regarding an incoming request.\nThe library writes every record on the standard output in a JSON format.\nGathering DSR statistics is triggered when a request containing an SAP passport is received.\n\n#### API\n\n```js\nvar connect = require('connect');\nvar createDsrMiddleware = require('@sap/e2e-trace').createDsrMiddleware;\n\nvar app = connect();\n\napp.use(createDsrMiddleware());\napp.use('/path', function (req, res, next) {\n // ...\n});\n```\n\nThe DSR middleware should be the first middleware in the request processing flow.\n\nExample DSR record:\n\n```json\n{\"action\":\"https://host:5555/path?a=1&b=2\",\"receivedBytes\":1230,\"sentBytes\":110,\"respTime\":18,\"transId\":\"104A7DB661D31EE69DE912281546ED81\",\"userId\":\"n.a.\",\"startTime\":1473506434377}\n```\n\nProperties in a DSR record:\n\nProperty | Description\n------------- | -----------\nstartTime | Time at which request processing starts (milliseconds elapsed since 1 January 1970 00:00:00 UTC).\naction | The requested URL.\nreceivedBytes | Number of bytes the incoming HTTP request contains (lengths of request line, headers section and body included). **Note**: due to a bug in Node.js, this field might be 0 in some runtime versions. Refer to the `engines/node` property in _package.json_ for recommended Node.js versions.\nsentBytes | Number of bytes the outgoing HTTP response contains (lengths of status line, headers section and body included).\nrespTime | Number of milliseconds spent in request processing (until the whole outgoing HTTP response has been handed off to the operating system for transmission over the network).\ntransId | The Transaction ID field of the SAP Passport that has triggered the DSR record.\nuserId | User ID of the current user taken from the request object. Defaults to `n.a.`.\n","readmeFilename":"README.md","repository":{},"scripts":{"lint":"eslint -c node_modules/node-style/.eslintrc -f stylish lib/","prepareRelease":"clean-packages && npm prune --production","test":"node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha test -- --recursive --check-leaks"},"version":"1.1.3","license":"SEE LICENSE IN developer-license-3.1.txt"}
{"dependencies":{"request-stats":"3.0.0"},"description":"Provides functionalities for handling SAP Passports","devDependencies":{"capture-stream":"0.1.2","chai":"3.5.0","connect":"3.4.1","eslint":"3.2.2","filter-node-package":"^2.0.0","istanbul":"0.4.5","lodash":"4.17.4","mocha":"3.0.2","node-style":"^2.0.0","proxyquire":"1.7.10","sinon":"1.17.5","supertest":"2.0.0"},"engines":{"node":"^0.12.7 || ^4.4.7 || ^6.0.0 || ^8.0.0"},"main":"index.js","maintainers":[{"name":"https-support.sap.com","email":"do-not-reply@sap.com"}],"name":"@sap/e2e-trace","optionalDependencies":{},"readme":"# @sap/e2e-trace\n\nNode.js package with end to end tracing capabilities.\n\n\n## Overview\n\n### SAP Passport\n\nSAP Passports allow to identify a specific request in an end-to-end scenario involving several components communicating with each other.\nThis is especially helpful in the task of following the state of a business transaction across different systems.\nTo achieve that, the client should send a special header ('sap-passport') containing the SAP Passport to the first component.\nThe SAP Passport is a hex string with a special structure. The client can send one via a browser plugin or via SAPUI5 application frontend.\nWhenever an SAP Passport comes into a component, this component should also include the unique identifiers of the SAP Passport in its logs/traces,\nupdate it with component specific data and then forward it to the next system.\n\nSee the diagram below:\n\n![SAP Passport overview diagram](diagram.png \"Overview diagram\")\n\nAn application receives an SAP Passport in the 'sap-passport' header. The same header is used when the SAP Passport is getting forwarded over the HTTP protocol to another system.\nIf it is being sent to HANA, the SAP Passport should be set as the 'SAP_PASSPORT' session variable of the database connection.\n\n#### API\n\n- Loading the package:\n\n```js\nvar SAPPassport = require('@sap/e2e-trace').Passport;\n```\n\n- Creating an SAP Passport instance\n\n```js\nfunction requestHandler(req, res) {\n var encodedPassport = req.headers[SAPPassport.HEADER_NAME];\n if (encodedPassport) {\n var passport = new SAPPassport(encodedPassport);\n }\n}\n```\n\nThe library provides a constant for the 'sap-passport' header: `SAPPassport.HEADER_NAME`.\n\nThe `passport` variable is an instance with which you may read/modify the SAP Passport in your component.\n\n- Reading the unique identifiers of an SAP Passport\n\n```js\nvar identifiers = passport.readUniqueIdentifiers();\n```\n\nThe returned value (assigned to the `identifiers` variable) is an object that has the following properties: `transactionID`, `rootContextID`, `connectionID`, `connectionCounter`.\nThese SAP Passport fields got to be present in the logs/traces of the component.\nIf you are using the `sap-logging` library, refer to its documentation to check whether the specific version is capable of handling SAP Passports or not.\n\n\n- Updating the SAP Passport - this is done right before forwarding it to the next component.\n\n```js\npassport.update({\n previousComponent: 'my-application',\n connectionID: '00112233445566778899AABBCCDDEEFF',\n connectionCounter: 36\n});\n```\n\nThis method takes an object with the following properties:\n\nProperty | Value | Mandatory | Semantics\n------------- | ---------- | --------- | --------------------------\n`previousComponent` | ASCII string. Up to 32 characters. | | This is the name of the current component which is about to make an outbound connection to another component. Defaults to _XSA Node.js_.\n`connectionID` | GUID, 16-byte hex | yes | Every connection between the current component and the next component should have an ID which is passed as that property.\n`connectionCounter`| Positive integer, up to 4 bytes | yes | States for which time the connection with the given `connectionID` is being reused.\n\n- Compacting the SAP Passport - HANA DB has a limitation over the SAP Passport size.\nThis is why it is recommended to call the method `compact` before forwarding an SAP Passport to HANA.\n\n```js\npassport.compact();\n```\n\n- Generating a hex string out of the updated SAP Passport - the SAP Passport can be send to other components in this format.\n\n```js\nvar http = require('http');\nvar url = require('url');\n\nvar encodedPassport = passport.serialize();\n\nvar options = url.parse('http://my-host:1234/my/path');\noptions.headers = {};\noptions.headers[SAPPassport.HEADER_NAME] = encodedPassport;\n\nvar request = http.request(options);\nrequest.on('error', function (err) { /* ... */ });\nrequest.on('response', function (response) { /* ... */ });\nrequest.end();\n```\n\n\n### DSR records\n\nDistributed Statistics Records contain statistical information regarding an incoming request.\nThe library writes every record on the standard output in a JSON format.\nGathering DSR statistics is triggered when a request containing an SAP passport is received.\n\n#### API\n\n```js\nvar connect = require('connect');\nvar createDsrMiddleware = require('@sap/e2e-trace').createDsrMiddleware;\n\nvar app = connect();\n\napp.use(createDsrMiddleware());\napp.use('/path', function (req, res, next) {\n // ...\n});\n```\n\nThe DSR middleware should be the first middleware in the request processing flow.\n\nExample DSR record:\n\n```json\n{\"action\":\"https://host:5555/path?a=1&b=2\",\"receivedBytes\":1230,\"sentBytes\":110,\"respTime\":18,\"transId\":\"104A7DB661D31EE69DE912281546ED81\",\"userId\":\"n.a.\",\"startTime\":1473506434377}\n```\n\nProperties in a DSR record:\n\nProperty | Description\n------------- | -----------\nstartTime | Time at which request processing starts (milliseconds elapsed since 1 January 1970 00:00:00 UTC).\naction | The requested URL.\nreceivedBytes | Number of bytes the incoming HTTP request contains (lengths of request line, headers section and body included). **Note**: due to a bug in Node.js, this field might be 0 in some runtime versions. Refer to the `engines/node` property in _package.json_ for recommended Node.js versions.\nsentBytes | Number of bytes the outgoing HTTP response contains (lengths of status line, headers section and body included).\nrespTime | Number of milliseconds spent in request processing (until the whole outgoing HTTP response has been handed off to the operating system for transmission over the network).\ntransId | The Transaction ID field of the SAP Passport that has triggered the DSR record.\nuserId | User ID of the current user taken from the request object. Defaults to `n.a.`.\n","readmeFilename":"README.md","repository":{},"scripts":{"lint":"eslint -f stylish --ignore-path .gitignore .","prepareRelease":"clean-packages && npm prune --production","test":"node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha test -- --recursive --check-leaks"},"version":"1.3.0","license":"SEE LICENSE IN developer-license-3.1.txt"}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc