npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-java-instrument

v0.0.6

Published

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

Downloads

3

Readme

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.