Node.js SDK
How to add nodejs sdk into your application
1. Installing node-SDK package
HyperTest's npm packages are hosted on a github private NPM registry To Install and use HyperTest's node-sdk package in your application, we will do the following steps:
Create NPM_TOKEN - The Hypertest Team share this with you.
set NPM_TOKEN in
.npmrc
fileInstall HyperTest's node-sdk package
Add the following content in your .npmrc
1st line in this file has authToken for pulling packages from NPM registry.
2nd line indicates to use https://npm.pkg.github.com registry to pull packages scoped with @hypertestco
2. Initializing sdk
2.1 Adding SDK in code
Add these lines at the top of your app.
This needs to happen as early in your app as possible.
2.2 Initialize open telemetry sdk with hypetest
Initialize opentelemtry sdk with HtTraceExporter. Set the trace exporter url to hypertest logger as shown below.
Set tracer provider generated by opentelemetry's SDK for proper tracing.
Call the markAppAsReady method when the app is ready to receive traffic, it indicates that tests can be started (ONLY FOR REPLAY mode).
To enable hypertest, set the HT_MODE
env variable to RECORD
and start your app
OR
4. Verifying traffic is captured
Start sending http requests on your app running with hypertest sdk.
You should start seeing requests under All requests section on the dashboard
Last updated