6

AWS Offers a TypeScript Interface for Lambda Observability

 2 years ago
source link: https://thenewstack.io/aws-offers-a-typescript-interface-for-lambda-observability/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

AWS Offers a TypeScript Interface for Lambda Observability

6 Jan 2022 7:22am, by Joab Jackson
Tracer

Software engineers at Amazon Web Services, with the help of outside volunteers, have released an open source library to help TypeScript developers extract meaningful observability data from their serverless AWS Lambda jobs.

Introduced in Beta, the AWS Lambda Powertools TypeScript “provides a suite of utilities for Node.js Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics,” wrote AWS Senior Solutions Architect Sara Gerion, in a Tweet thread Tuesday.

The suite provides a set of TypeScript calls for managing AWS Lambda “serverless” functions running on a Node.js runtime. TypeScript is JavaScript with strong typing, which provides a platform for more refined debugging tools such as these.

According to Gerion, the logger utility can:
  • Capture key fields from Lambda context, cold start and structures logging output as JSON.
  • Log Lambda context when instructed.
  • Log sampling prints all logs for a percentage of invocations.
  • Append keys to structured log at any point in time.

Logger

The Metrics utility can:

  • Aggregate up to 100 metrics using a single CloudWatch EMF object.
  • Validate against common metric definitions mistakes.
  • Metrics are created async by CloudWatch.
  • Context manager to create a one-off metric with a different dimension.

And the Tracer utility can:

  • Auto capture cold start, responses, errors.
  • Auto-disable when not running in AWS Lambda environment.
  • Support tracing functions via decorators, middleware, and manual instrumentation.
  • Support tracing AWS SDK v2 and v3 via AWS X-Ray SDK.

The suite also includes a Typescript Cloud Development Kit (CDK) for working with CloudFormation and other AWS resources.

Each TypeScript utility is installed as a standalone NPM package and follows the format of the AWS SDK v3 for JavaScript.

AWS has released similar Lambda Powertool packages for Java and Python.

Amazon Web Services is a sponsor of The New Stack.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK