0

Have a opentelementry lambda extension that is running waiting for events. Have the collector to export out to Elasticsearch. I am seeing the service map of the services that lambda is hitting, but not seeing trace data. I am following the documentation in these links. Think a step is missing, but not able to find documentation on exactly how to do this.

https://aws-otel.github.io/docs/getting-started/lambda/lambda-js

https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-aws-sdk

https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-aws-lambda

I added the OpenTelemetry collector as a lambda extension. Pass in the ES endpoint and token as environment variables. I set the configuration in the collector config yml. I then added instrumentation in the lambda code to export trace data to collector. This is my collector config:

receivers:
  otlp:
    protocols:
      http:
      grpc:

exporters:
  logging:
    loglevel: debug # can be: info, error, debug, warning (default info)
  otlp/elastic:
    endpoint: "${ELASTIC_OTLP_ENDPOINT}" 
    headers:
      # Elastic APM Server secret token
      Authorization: "Bearer ${ELASTIC_OTLP_TOKEN}" 

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logging, otlp/elastic]
    metrics:
      receivers: [otlp]
      exporters: [logging, otlp/elastic]
    logs:
      receivers: [otlp]
      exporters: [logging, otlp/elastic]

I can see in log that the collector is starting up and says its listening. The lambda is connected to api gateway endpoint. The ES endpoint and token passed in as environment variables. The lambda adds a record to dynamodb. When api request goes through it looks like it is exporting some spans to ES. One span has status code STATUS_CODE_OK. Another span has status code STATUS_CODE_UNSENT. Besides that not seeing any obvious error info. I can see the connection from lambda to dynamodb in the ElasticSearch Service Map, but not seeing any trace data on the trace page. Something is not getting exported.

Seeing this error from collector:

{
    "kind": "exporter",
    "name": "otlp/elastic",
    "error": "max elapsed time expired failed to push trace data via OTLP exporter: rpc error: code = DeadlineExceeded desc = context deadline exceeded",
    "dropped_items": 2
}
Andy N
  • 1,013
  • 9
  • 25
  • You should to provide reproducible example, pls? I really would like to see how did you achieve `have the collector to export out to elastic search`. Debugging should be easy: enable debug mode and you will see if you are receiving any traces or if there is any error from the exporters. – Jan Garaj Dec 05 '21 at 14:44
  • Are you able to share the log output that your trace exporter produces? I've occasionally seen OTLP vendors (LightStep?) reject certain spans that didn't contain expected property names like `service.name`. Can you also confirm that your `ELASTIC_OTLP_ENDPOINT` variable takes the form: `hostname:port` and excludes the protocol, e.g., `https`` – ericksoen Dec 20 '21 at 20:24
  • @ericksoen it is in hostname:port format. There is no https – Andy N Feb 03 '22 at 22:41
  • It seems the trace data was in ES this whole time. I was just looking through the traces tab and was not showing up there. When I go through the services and click on the specific service transactions I can see the trace data. Weird does not show up on traces page. – Andy N Feb 04 '22 at 01:09
  • I notice that there is no node name. Is that why does not show up in traces page? – Andy N Feb 04 '22 at 01:11

0 Answers0