Thundra APM
Search…
Deployment Integrations
Hapi

Step 1: Install Thundra

1
npm install @thundra/core --save
Copied!

Step 2: Configure Integration

After installing the @thundra/core module, there is no need to add any plugins. Thundra will monitor your application automatically.
app.js
1
const thundra = require("@thundra/core");
2
const Hapi = require('@hapi/hapi');
3
4
thundra.init();
5
6
const startServer = async () => {
7
const server = Hapi.server({
8
...
9
});
10
11
server.route([{
12
method: 'GET',
13
path: '/',
14
handler: (request, h) => {
15
return 'Hello Thundra';
16
}
17
}]);
18
19
await server.start();
20
}
21
22
startServer();
23
Copied!

Step 3: Add Thundra API Key

Set the thundra_apiKey environment variable to the API key value you got from the Thundra console. You can add api key in different ways:
app.js
1
const thundra = require("@thundra/core");
2
// adding apiKey programmatically
3
thundra.init({
4
apiKey:<Thundra-ApiKey>
5
})
Copied!
Shell
1
export thundra_apiKey=<Thundra-ApiKey>
Copied!
Dockerfile
1
ENV thundra_apiKey=<Thundra-ApiKey>
Copied!
By default, the name of your app will be thundra-app. When you are monitoring multiple Hapi applications you might want to set this to different names for each application, or in general, you might want to describe your applications better. To change the default application name, you can set the thundra_agent_application_name environment variable to anything you want.
Last modified 3mo ago