Skip to content

Set Up the Lambda Telemetry Extension

You’ll take one Lambda function from no telemetry to logs, metrics, and traces in KloudMate. It’s about five minutes, and nothing in your function code changes.

  • A KloudMate ingest API key. Create one under API Keys.
  • Your KloudMate OTLP endpoint — https://otel.kloudmate.com:4318 for most accounts.
  • Permission to update the function’s configuration (its layers and environment variables).
  1. Find the layer ARN for your function. It has to match the function’s Region and architecture (x86_64 or arm64). Copy the matching ARN from Layer ARNs.

  2. Add the layer to the function. A function can carry up to five layers, so this one sits alongside any you already use.

  3. Set the environment variables:

    OTEL_EXPORTER_OTLP_ENDPOINT=https://otel.kloudmate.com:4318
    OTEL_EXPORTER_OTLP_HEADERS=Authorization=YOUR_KLOUDMATE_API_KEY
    OTEL_SERVICE_NAME=my-service        # optional; defaults to the function name
  4. Deploy and invoke the function. The change takes effect on the next invocation. Open the function in KloudMate to confirm data is arriving.

Drop the same layer ARN and environment variables into whatever you use to manage the function. The examples below use us-east-1 (x86_64) — swap in the ARN for your Region and architecture, and your own API key.

resource "aws_lambda_function" "my_function" {
  function_name = "my-service"
  # ...your existing configuration...

  layers = [
    "arn:aws:lambda:us-east-1:429321095007:layer:lambda-telemetry-extension:4",
  ]

  environment {
    variables = {
      OTEL_EXPORTER_OTLP_ENDPOINT = "https://otel.kloudmate.com:4318"
      OTEL_EXPORTER_OTLP_HEADERS  = "Authorization=YOUR_KLOUDMATE_API_KEY"
      OTEL_SERVICE_NAME           = "my-service"
    }
  }
}

Invoke the function once, then check KloudMate:

  • Logs — the function’s output shows up in Log Explorer, tagged with its service name.
  • Metricsfaas.invoke_duration and the related metrics appear for the function.
  • Traces — with X-Ray active tracing enabled, each invocation produces a trace.

Nothing within a minute? Set OTEL_LOG_LEVEL=debug and check the function’s own CloudWatch logs — the extension reports what it’s doing on lines tagged [KloudMate].

What you seeLikely cause and fix
No data in KloudMateCheck that the API key in OTEL_EXPORTER_OTLP_HEADERS is valid and the endpoint is reachable. Turn on OTEL_LOG_LEVEL=debug and read the [KloudMate] lines.
export rejected (401)The API key is missing or wrong. Recheck the Authorization value against API Keys.
Function fails to startThe layer’s architecture doesn’t match the function. Use the ARN that matches x86_64 or arm64.
Logs and metrics work, but no tracesTraces need X-Ray active tracing on the function. Turn it on, or expect logs and metrics only.