Skip to content

Commit

Permalink
optional lambda collector layer
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay2897 committed Mar 12, 2024
1 parent 08067dc commit 543bd83
Show file tree
Hide file tree
Showing 7 changed files with 6,862 additions and 123 deletions.
7 changes: 6 additions & 1 deletion lambda/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
KM_WORKSPACE_SECRET=
KM_WORKSPACE_SECRET=
AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
OTEL_TRACES_SAMPLER=always_on
OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION=true
OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.kloudmate.com:4318
OTEL_EXPORTER_OTLP_HEADERS="Authorization=$KM_WORKSPACE_SECRET"
6 changes: 6 additions & 0 deletions lambda/.env.example-with-collector
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
KM_WORKSPACE_SECRET=
AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
OPENTELEMETRY_COLLECTOR_CONFIG_FILE=/var/task/collector.yaml
OTEL_TRACES_SAMPLER=always_on
OTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION=true
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
11 changes: 9 additions & 2 deletions lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@ An example demonstrating how to export logs and traces from a Nodejs lambda to K

## Lambda layers used
1. An auto instrumentation lambda [layer](https://github.com/open-telemetry/opentelemetry-lambda/releases/tag/layer-nodejs%2F0.4.0) for Nodejs. Read more [here](https://opentelemetry.io/docs/faas/lambda-auto-instrument/)
2. An Opentelemetry Collector [layer](https://github.com/open-telemetry/opentelemetry-lambda/releases/tag/layer-collector%2F0.4.0). Read more [here](https://opentelemetry.io/docs/faas/lambda-collector/)
2. <em>(Optional)</em> An Opentelemetry Collector [layer](https://github.com/open-telemetry/opentelemetry-lambda/releases/tag/layer-collector%2F0.4.0). Read more [here](https://opentelemetry.io/docs/faas/lambda-collector/)

Note: Since the auto-instrumentation layer does not have support for logs yet, an instrumentation file is provided that adds the required libraries to collect and export logs.

## Prerequisites
- SLS CLI

## Steps to stup
## Steps to setup
1. Copy ``.env.example`` to `.env` and set values .
2. `npm i`
3. `sls deploy`

You should now see traces and logs in your KloudMate account.

### <em>Optional</em><br>
If you want to use the collector layer then follow these steps instead:<br>
1. Copy ``.env.example-with-collector`` to `.env` and set values .
2. `npm i`
3. `sls -c serverless-with-collector.yml deploy`
Loading

0 comments on commit 543bd83

Please sign in to comment.