Skip to content

Commit

Permalink
Merge branch 'main' of github.com:baselime/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastin committed Mar 6, 2024
2 parents 2984acb + b35ab1f commit 6bc3fa9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
51 changes: 51 additions & 0 deletions sending-data/platforms/aws/aws-lambda/traces/node.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,57 @@ export async function handler(event) {

---

## Tracing AWS SDK v3

If you bundle the AWS SDK v3 by default it is not traced. For CommonJS builds you can enable tracing with the following esbuild settings

1. mark `@smithy/middleware-stack` and `@aws-sdk/middleware-stack` as external
2. Ensure these packages are installed into the node_modules folder of your lambda

These packages are both extremely small and removing these from your bundle can also decrease your coldstarts

+++ AWS CDK

Add the following config to your `lambda.NodejsFunction` settings

```typescript #
new lambda.NodejsFunction(this, 'my-handler', {
bundling: {
nodeModules: ['@smithy/middleware-stack', '@aws-sdk/middleware-stack'],
format: lambda.OutputFormat.CJS
},
});
```

+++ SST

To add the config globally to your `sst.config.ts` file.

```typescript #
app.setDefaultFunctionProps({
nodejs: {
format: 'cjs',
install: ["@smithy/middleware-stack", "@aws-sdk/middleware-stack"]
},
});
```

+++ Serverless Framework

If using the [`serverless-esbuild`]() plugin set the following options in your `serverless.yml`

```yaml #
plugins:
- serverless-esbuild

custom:
esbuild:
external:
- "@smithy/middleware-stack"
- "@aws-sdk/middleware-stack"
```
## Sending data to another OpenTelemetry backend
OpenTelemetry is an open standard, and you can use the [Baselime Node.js OpenTelemetry tracer for AWS Lambda](https://github.com/Baselime/lambda-node-opentelemetry) to send telemetry data to another backend of your choice.
Expand Down
1 change: 0 additions & 1 deletion sending-data/sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ Baselime also surfaces the average sample rate in the query results in the [cons
### `COUNT_DISTINCT`

`COUNT_DISTINCT` enables you to compute the number of unique values a property take in your dataset. This is impossible to accurately compute with sampled data. When performing a `COUNT_DISTINCT` aggregation, Baselime will count the number of unique values present in the sampled dataset and will not compensate for the sampling rate.

0 comments on commit 6bc3fa9

Please sign in to comment.