skip to Main Content

I am following this repo https://github.com/open-telemetry/opentelemetry-lambda/blob/main/collector/README.md to deploy a lambda with opentelemetry extension.

I have build the repo and created a lambda layer by uploading the file nodejs/packages/layer/build/layer.zip. Then I created a lambda who uses this layer and added 2 env var:

AWS_LAMBDA_EXEC_WRAPPER = /opt/otel-handler
OPENTELEMETRY_COLLECTOR_CONFIG_FILE = /var/task/collector.yaml

I created a file collector.yaml under project root directory:

receivers:
  otlp:
    protocols:
      grpc:

exporters:
  logging:
    loglevel: debug
  otlp:
    endpoint: http://localhost

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logging, otlp]

when I run the lambda I got this error:

2022-12-14T11:50:07.070+11:00   Registering OpenTelemetry

2022-12-14T11:50:07.098+11:00   Exporter "otlp" requested through environment variable is unavailable.

2022-12-14T11:50:07.122+11:00   2022-12-14T00:50:07.121Z undefined WARN Failed extracting version /var/task

it says otlp is unavailable. Do I miss anything? I am not sure what this mean.

2

Answers


  1. To enable OpenTelemetry in your AWS Lambda functions using custom layers; besides providing the two environment variables you described, you also need to add the custom layer to the function manually. You can do this using the AWS CLI:

    aws lambda update-function-configuration --function-name Function --layers <your Lambda layer ARN>
    

    You can use the AWS Console as well:

    enter image description here

    Keep in mind though, that you don’t need to create a custom Lambda layer to enable OpenTelemetry. AWS provides different pre-built layers for you to use:

    Login or Signup to reply.
  2. I don’t think it’s necessarily related to the custom Lambda layer.
    I use the "AWS managed Lambda Layer for ADOT JavaScript SDK and ADOT Collector" with the default collector.yaml and get the same error:

    2023-01-03T13:40:58.367Z    undefined   WARN    Failed extracting version /var/task
    2023-01-03T13:40:58.373Z    undefined   ERROR   Exporter "otlp" requested through environment variable is unavailable.
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search