Skip to content

Commit

Permalink
add example to configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankcorn committed Apr 4, 2024
1 parent 44f157b commit 7a25af9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions aws_lambda.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tracing AWS Lambda Functions

Manually Instrument your AWS Lambda Functions `withOpenTelemetry`.
Manually Instrument your AWS Lambda Functions using `withOpenTelemetry` wrapper.

If you want to instrument your lambda function with no code changes please read the docs [here](https://baselime.io/docs/sending-data/platforms/aws/aws-lambda/traces/node.js/).

Expand Down Expand Up @@ -79,8 +79,27 @@ Finally add the `BASELIME_API_KEY` environment variable to send traces to your [

## Configuration Options

The `withOpenTelemetry` middleware can be configured with the following options.
The `withOpenTelemetry` takes a second argument, an object with the following properties.

```javascript
export const handler = withOpenTelemetry(async (e: APIGatewayProxyEventV2) => {

return {
statusCode: 200,
body: JSON.stringify({
message: 'Hello from Lambda!',
})
};
}, {
captureEvent: false,
captureResponse: false,
proactiveInitializationThreshold: 1000,
timeoutThreshold: 500,
extractContext(service, event) {
console.log('Extracting context', service, event);
}
});
```

| Field | Type | Description |
|------------------------------|---------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
Expand Down

0 comments on commit 7a25af9

Please sign in to comment.