This is a plugin for Architect that automatically instruments your Node.js Lambdas with OpenTelemetry and sends tracing data and metrics to AWS X-Ray.
It adds the AWS Distro for OpenTelemetry Lambda layer to all of your Lambdas for which you have enabled tracing.
-
Install this package using npm:
npm i -D @nasa-gcn/architect-plugin-tracing
-
Add the following to your project's
app.arc
configuration file:@plugins nasa-gcn/architect-plugin-tracing
-
Enable tracing for all Lambdas by adding the folllowing lines to your
app.arc
file, or for an individual Lambda by adding it to the Lambda'sconfig.arc
file:@aws tracing true
-
Optionally, you can inject additional OpenTelemetry configuration into a Lambda by adding a file called
tracing.js
to its source directory. Here is an example that adds instrumentation for the Remix web framework:```js global.configureInstrumentations = () => { const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns') const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http') const { NetInstrumentation } = require('@opentelemetry/instrumentation-net') const { RemixInstrumentation, } = require('opentelemetry-instrumentation-remix') return [ new DnsInstrumentation(), new HttpInstrumentation(), new NetInstrumentation(), new RemixInstrumentation(), ] } ```