Skip to content

Architect plugin for tracing Lambdas with OpenTelemetry and shipping results to AWS X-Ray

License

Notifications You must be signed in to change notification settings

nasa-gcn/architect-plugin-tracing

Repository files navigation

npm

Architect plugin for OpenTelemetry + AWS X-Ray

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.

Usage

  1. Install this package using npm:

    npm i -D @nasa-gcn/architect-plugin-tracing
    
  2. Add the following to your project's app.arc configuration file:

    @plugins
    nasa-gcn/architect-plugin-tracing
    
  3. 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's config.arc file:

    @aws
    tracing true
    
  4. 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(),
      ]
    }
    ```
    

About

Architect plugin for tracing Lambdas with OpenTelemetry and shipping results to AWS X-Ray

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published