thundra-lambda-agent-go

module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2018 License: Apache-2.0

README

Lambda Go Agent CircleCI Go Report Card

Trace your AWS lambda functions with async monitoring by Thundra!

Check out example projects for a quick start and Thundra docs for more information.

Usage

In order to trace your lambda usages with Thundra all you need to do is wrap your function.

package main

import (
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/thundra-io/thundra-lambda-agent-go/thundra"
	"github.com/thundra-io/thundra-lambda-agent-go/trace"
	"github.com/thundra-io/thundra-lambda-agent-go/metric"
)

//Your lambda handler
func hello() (string, error) {
	return "Hello ƛ!", nil
}

func main() {
	// Instantiate Thundra Agent with Trace & Metric Support
	tr := trace.New()
	m := metric.New()
	t := thundra.NewBuilder().
	            AddPlugin(tr).
	            AddPlugin(m).
	            SetAPIKey(/*TODO login https://console.thundra.io to get your APIKey*/).
	            Build()
	
	// Wrap your lambda function with Thundra
	lambda.Start(thundra.Wrap(hello, t))
}

Later just build and deploy your executable to AWS as regular. Test your function on lambda console and visit Thundra to observe your function metrics.

Environment variables
Name Type Default Value
thundra_apiKey string -
thundra_applicationProfile string default
thundra_disable bool false
thundra_lambda_trace_request_disable bool false
thundra_lambda_trace_response_disable bool false
thundra_lambda_publish_cloudwatch_enable bool false
thundra_lambda_warmup_warmupAware bool false
thundra_lambda_publish_rest_baseUrl string https://collector.thundra.io/api
thundra_log_logLevel string -
thundra_lambda_debug_enable string false
thundra_lambda_timeout_margin int 200
Async Monitoring

Check out our docs to see how to configure Thundra and async monitoring to visualize your functions in Thundra.

Warmup Support

You can cut down cold starts easily by deploying our lambda function thundra-lambda-warmup.

Our agent handles warmup requests automatically so you don't need to make any code changes.

You just need to deploy thundra-lambda-warmup once, then you can enable warming up for your lambda by

  • setting its environment variable thundra_lambda_warmup_warmupAware true OR
  • adding its name to thundra-lambda-warmup's environment variable thundra_lambda_warmup_function.

Check out this part in our docs for more information.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL