To use the plugin, you need to download and install it, and then register it with your tracer.
See Lightstep’s GitHub repo for a full example.
Download and install the plugin
The npm packages are available from npm.
From a shell, run the following:
1
2
$ npm_config_registry=https://npm.pkg.github.com/lightstep npm install @lightstep/opentelemetry-plugin-rollbar --save
Initialize the plugin
In your OpenTelemetry initialization code, use registerInstrumentation()
to load plugins. See the Demo app for a full example.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const {
lightstep, opentelemetry,
} = require('lightstep-opentelemetry-launcher-node');
module.exports = async (serviceName) => {
const sdk = lightstep.configureOpenTelemetry({
accessToken: process.env.LS_ACCESS_TOKEN,
serviceName,
instrumentations: [
{
plugins: {
'rollbar': {
path: 'opentelemetry-plugin-rollbar',
enabled: true,
},
},
},
],
}),
};
In the next step, you’ll see the trace data generated by the new instrumentation.
What did we learn?
- Lightstep’s OpenTelemetry plugins automatically instrument your code to send and display Rollbar data in Lightstep.