aws/aws-xray-sdk-ruby

Lambda runtime segments appearing in traces

bonybrown opened this issue · 3 comments

Adding x-ray instrumentation to a lambda causes segments in the trace that are due to the lambda runtime, like this:

image

These shouldn't appear, and should be filtered out by XRay::NetHttp::HTTPInstanceInterceptor#lambda_runtime_request? but the current implementation is not correct.

A correct implementation is below (can be used as a monkey-patch to fix the current sdk release)

module XRay
  module NetHttp
    module HTTPInstanceInterceptor
      def lambda_runtime_request?(_req)
        ENV['AWS_LAMBDA_RUNTIME_API'] == "#{address}:#{port}"
      end
    end
  end
end

I'll create a PR for this. Just need the issue to reference.

PR #39 ready for review.

Reopening since the fix is pending release.

This issue is fixed in v0.11.4