jaeger-go

command
v0.0.0-...-67ec40b Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

OpenTracing and Jaeger in AWS Lambda Go 1.x Runtime

This is an example of a simple, traced Lambda function using the Jaeger Go tracer with SignalFx. See main.go for the example code.

Building and Creating a Deployment Package

A Go deployment package for AWS Lambda is a .zip file consisting of your built project's executable. To build this application and create the deployable archive follow these instructions from the root tracing-examples directory:

$ pwd  # Confirm this is <your_local_path/tracing-examples>
$ mkdir -p $GOPATH/src/github.com/signalfx
$ ln -s $(pwd) $GOPATH/src/github.com/signalfx/tracing-examples
$ cd $GOPATH/src/github.com/signalfx/tracing-examples/aws-lambda/jaeger-go
$ GOOS=linux go build .  # GOOS=linux is needed for the Lambda runtime environment
$ zip my_traced_golang_lambda.zip ./jaeger-go

The resulting my_traced_golang_lambda.zip can be uploaded to S3 or in your browser via the AWS Console during function creation. Register your handler as jaeger-go and don't forget to set the SIGNALFX_INGEST_URL environment variable to point to your Gateway. You should be able test the application with the following test event:

{
  "queryStringParameters": {
    "choice": "00"
  }
}

The execution result should succeed with a response similar to:

{
  "statusCode": 404,
  "body": "{\"TraceId\":\"2296bd21606fc2e4\",\"Result\":\"You Lost! The ball landed on 35.\",\"Choice\":\"00\"}"
}

Resources

Documentation

Overview

This Lambda function is an example of an OpenTracing-instrumented Roulette game using the Jaeger Go tracer where requests containing a chosen number made to an API Gateway resource are compared to a random number from the wheel.

GET /my_resource/?choice=36 -> 404 Loss GET /my_resource/?choice=00 -> 200 Win

Winning requests will produce a logged error. You can trigger a winning event by setting a "win" query parameter with an arbitrary value.

GET /my_resource/?win=true

Jump to

Keyboard shortcuts

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