Giter Club home page Giter Club logo

awshoney's People

Contributors

aidansteele avatar jdub avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jdub syllogy

awshoney's Issues

A default Lambda function handler wrapper

I've forgotten - on more than one occasion - to flush outstanding Honeycomb spans yet to be sent. Maybe we should include something like:

package honeyflush

import (
	"context"
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/honeycombio/beeline-go"
)

type wrapper struct {
	inner lambda.Handler
}

func (w *wrapper) Invoke(ctx context.Context, payload []byte) ([]byte, error) {
	ctx, _ = beeline.StartSpan(ctx, "lambda")
	// we could also include the aws lambda "request id" for correlation with cloudwatch logs
	defer beeline.Flush(ctx)
	return w.inner.Invoke(ctx, payload)
}

func Wrap(inner lambda.Handler) lambda.Handler {
	return &wrapper{inner: inner}
}

Usage would be something like

package main

import (
	"context"
	"github.com/aws/aws-lambda-go/events"
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/glassechidna/flow/pkg/honeyflush"
)

func mainx() {
	handler := lambda.NewHandler(handlerFn)
	wrapped := honeyflush.Wrap(handler)
	lambda.StartHandler(wrapped)
}

func handlerFn(ctx context.Context, event events.SQSEvent) error {
	return nil
}

More fields for AWS API calls

There are a couple of options:

The first option is to make a judgment call and enumerate the most popular APIs and add some high-value fields to those calls. For example, S3 API calls could include bucket names (and object keys), DynamoDB could include table names.

The second option is including the input (and maybe output?) as a single JSON-encoded field and users enabling automatic unpacking of nested JSON values (as per Honeycomb docs). Maybe this one should be an opt-in / opt-out.

Anyone have any thoughts?

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.