To use the plugin, you need to download and install it, and then register it with your tracer.

See Lightstep’s GitHub for a full example.

Download and Install the Plugin

The npm packages are available from npm.

From a shell, run the following, using the prompt for either Split.io or LaunchDarkly.

Start tabs

Split

1
$ npm_config_registry=https://npm.pkg.github.com/lightstep npm install @lightstep/opentelemetry-plugin-splitio --save

LaunchDarkly

1
$ npm_config_registry=https://npm.pkg.github.com/lightstep npm install @lightstep/opentelemetry-plugin-launchdarkly-node-server --save

End code tabs

Initialize the Plugin

In your OpenTelemetry initialization code, use registerInstrumentation() to load plugins. See the Demo app for a full example.

Start tabs

Split

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: {
      '@splitsoftware/splitio': {
        path: 'opentelemetry-plugin-splitio',
        enabled: true,
        },  
      },
    },
    ],
  }),
};  

LaunchDarkly

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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: {
      'launchdarkly-node-server-sdk': {
        path: 'opentelemetry-plugin-launchdarkly-node-server',
        enabled: true,
        },  
      },
    },
    ],
  }),
};  

End code tabs

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 feature flag data in Lightstep.