Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-java-instrument

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-java-instrument

Serverless Framework Plugin that auto-instruments JVM-based Lambda functions

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Serverless Java Instrument Plugin (Alpha)

This Serverless plugin auto-instruments JVM-based package artifacts specified in the package.artifact configuration of the serverless.yml

For now, the only thing the plugin does is inject additional logging post function invocation. It does this via bytecode instrumentation to your Serverless function without additional source code changes on your part.

Example post-invocation log output of an instrumented function:

START RequestId: 024cecab-ba19-40c7-acae-2d2f4695edbe Version: $LATEST
2019-11-10 20:35:08 <024cecab-ba19-40c7-acae-2d2f4695edbe> INFO  com.serverless.Handler:31 - received: {}
{
  "threadId" : 1,
  "jvm" : {
    "vmName" : "OpenJDK 64-Bit Server VM",
    "availableProcessors" : 2,
    "heapMemory" : {
      "committed" : 20316160,
      "init" : 20971520,
      "max" : 883884032,
      "used" : 9277952
    },
    "nonHeapMemory" : {
      "committed" : 16187392,
      "init" : 2555904,
      "max" : 260046848,
      "used" : 10566024
    },
    "threadCount" : 4,
    "vmVendor" : "Oracle Corporation",
    "uptime" : "7106ms",
    "threadUserTime" : 660000000,
    "systemLoadAverage" : 0.07,
    "vmVersion" : "25.201-b09",
    "daemonThreadCount" : 3,
    "peakThreadCount" : 4,
    "threadCpuTime" : 750872982
  },
  "context" : {
    "awsRequestId" : "024cecab-ba19-40c7-acae-2d2f4695edbe",
    "functionName" : "jtest-dev-hello",
    "functionVersion" : "$LATEST",
    "identity" : {
      "identityId" : "",
      "identityPoolId" : ""
    },
    "invokedFunctionArn" : "arn:aws:lambda:us-east-1:xxxxxxxxxx:function:jtest-dev-hello",
    "logGroupName" : "/aws/lambda/jtest-dev-hello",
    "logStreamName" : "2019/11/10/[$LATEST]e1e60c451d4141c0b881a9fb403a7b1c",
    "logger" : { },
    "memoryLimitInMB" : 1024,
    "remainingTimeInMillis" : 5374
  },
  "methodName" : "handleRequest",
  "className" : "com.serverless.Handler",
  "durationMs" : 566
}
END RequestId: 024cecab-ba19-40c7-acae-2d2f4695edbe
REPORT RequestId: 024cecab-ba19-40c7-acae-2d2f4695edbe  Duration: 682.41 ms     Billed Duration: 700 ms Memory Size: 1024 MB    Max Memory Used: 106 MB Init Duration: 430.46 ms      

Additional logging, metrics and insights will be added in the future!

Installation

First, add Serverless Java Instrument to your project:

serverless plugin install --name serverless-java-instrument

Then inside your project's serverless.yml file verify the following entry to the plugins section: serverless-java-instrument.

It should look something like this:

plugins:
  - serverless-java-instrument

Usage

You must have Java 8 installed. To install Java 8, see SDKMAN.

At its current state, the plugin will instrument any method where the the last parameter is of type com.amazonaws.services.lambda.runtime.Context. See the AWS Documentation for building Lambda handlers in Java.

The instrumentation occurs automatically either after serverless package or before serverless deploy.

Keywords

FAQs

Package last updated on 07 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc