Giter Club home page Giter Club logo

pylambda_cputrace's Introduction

pylambda_cputrace

Lambda Layers to measure cpu in Python3 applications.

How to use

Create Lambda layers

make package S3_BACKET='backet_name' S3_PREFIX='prefix_name'
make deploy STACK_NAME='stack_name'

Note: make package uses the dokcer image of pylambda-packer for build. It is because some Python module requires build on AmazonLinux.

Use with the Lambda function

Add AWSLambda-Python3-TraceUtil to Layers of your Lambda function. Import the package and add the decorator in the lambda function.

import json
from traceutil import cpu_trace
import time 

@cpu_trace
def lambda_handler(event, context):
    time.sleep(1)

    # TODO implement
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }

The CloudWatch Log shows the CPU utilization when running Lambda.

{'user': 0.0510204081633397, 'nice': 0.0, 'system': 0.010204081632644737, 'idle': 0.9285714285713672, 'iowait': 0.0, 'irq': 0.0, 'softirq': 0.005102040816322369, 'steal': 0.005102040816325994, 'guest': 0.0, 'guest_nice': 0.0}

pylambda_cputrace's People

Contributors

kanga333 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.