-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: tammy-baylis-swi <[email protected]>
- Loading branch information
1 parent
5a61ea6
commit c2d9ae3
Showing
34 changed files
with
1,483 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
instrumentation/github.com/aws/aws-lambda-go/swolambda/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Instrumentation for AWS Lambda | ||
|
||
This package instruments the AWS Lambda `Handler` interface. | ||
|
||
## Usage | ||
|
||
### Add the `Otelcol` extension layer | ||
|
||
Follow the [SolarWinds Observability | ||
documentation](https://documentation.solarwinds.com/en/success_center/observability/content/intro/services/aws-lambda-overview.htm) | ||
to add the Otelcol extension layer. | ||
|
||
**Note**: Unlike other languages, Golang does not require an additional | ||
extension, so the "Instrumentation extension" section on that page does not | ||
apply. | ||
|
||
### Modify your code | ||
|
||
First, install the dependency: | ||
```shell | ||
go get -u github.com/solarwinds/apm-go/instrumentation/github.com/aws/aws-lambda-go/swolambda | ||
``` | ||
|
||
Then, wrap your handler with `swolambda.WrapHandler`: | ||
|
||
```go | ||
package main | ||
import ( | ||
"context" | ||
"github.com/aws/aws-lambda-go/lambda" | ||
"github.com/solarwinds/apm-go/instrumentation/github.com/aws/aws-lambda-go/swolambda" | ||
) | ||
|
||
// Example incoming type | ||
type MyEvent struct {} | ||
|
||
// This is an example handler, yours may have a different signature and a | ||
// different name. It will work ass long as it adheres to what the Lambda SDK | ||
// expects. (See "Valid handler signatures"[0]) | ||
// [0] https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html | ||
func ExampleHandler(ctx context.Context, event *MyEvent) (string, error) { | ||
return "hello world", nil | ||
} | ||
func main() { | ||
// We wrap our handler here and pass the result to `lambda.Start` | ||
lambda.Start(swolambda.WrapHandler(ExampleHandler)) | ||
} | ||
``` | ||
|
||
Now that you've instrumented your code, you should be able to send requests and | ||
see the resulting metrics and traces in SWO. |
Oops, something went wrong.