GithubHelp home page GithubHelp logo

isabella232 / wavefront-lambda-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wavefronthq/wavefront-lambda-python

0.0 0.0 0.0 15 KB

Wavefront Python Wrapper for AWS Lambda

License: Apache License 2.0

Python 100.00%

wavefront-lambda-python's Introduction

wavefront-lambda-python travis build status

This is a Wavefront python wrapper for AWS Lambda python function handler to send metrics directly to wavefront.

Requirements

Python 2.7 or 3.6.

Installation

To install from PyPi

pip install wavefront_lambda

Environment variables

WAVEFRONT_URL = https://<INSTANCE>.wavefront.com
WAVEFRONT_API_TOKEN = Wavefront API token with Direct Data Ingestion permission. (not required if using WAVEFRONT_PROXY) REPORT_STANDARD_METRICS = Set to False or false to not report standard lambda metrics directly to wavefront.

WAVEFRONT_PROXY = If this environment exist and set to any non-zero value. Will use wavefront proxy. (WAVEFRONT_URL need to set to wavefront proxy hostname)

WAVEFRONT_PORT # wavefront proxy port. default 2878

Usage

Decorate your AWS Lambda handler function with @wavefront_lambda.wrapper.

import wavefront_lambda

@wavefront_lambda.wrapper
def handler(event, context):
    # your code

Standard Lambda Metrics reported by Wavefront Lambda wrapper

The Lambda wrapper sends the following standard lambda metrics to wavefront:

Metric Name Type Description
aws.lambda.wf.invocations.count Delta Counter Count of number of lambda function invocations aggregated at the server.
aws.lambda.wf.errors.count Delta Counter Count of number of errors aggregated at the server.
aws.lambda.wf.coldstarts.count Delta Counter Count of number of cold starts aggregated at the server.
aws.lambda.wf.duration.value Gauge Execution time of the Lambda handler function in milliseconds.

The Lambda wrapper adds the following point tags to all metrics sent to wavefront:

Point Tag Description
LambdaArn ARN(Amazon Resource Name) of the Lambda function.
Region AWS Region of the Lambda function.
accountId AWS Account ID from which the Lambda function was invoked.
ExecutedVersion The version of Lambda function.
FunctionName The name of Lambda function.
Resource The name and version/alias of Lambda function. (Ex: DemoLambdaFunc:aliasProd)
EventSourceMappings AWS Event source mapping Id. (Set in case of Lambda invocation by AWS Poll-Based Services)

Custom Lambda Metrics

The wavefront lambda wrapper reports custom business metrics via a metrics registry provided by the pyformance plugin.
Please refer to the code sample which shows how you can send custom business metrics to wavefront from your lambda function.

Note: Having the same metric name for any two types of metrics will result in only one time series at the server and thus cause collisions. In general, all metric names should be different. In case you have metrics that you want to track as both a Counter and Delta Counter, consider adding a relevant suffix to one of the metrics to differentiate one metric name from another.

wavefront-lambda-python's People

Contributors

akodali18 avatar ruivapps avatar vikramraman 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.