go-agent icon indicating copy to clipboard operation
go-agent copied to clipboard

logcontext-v2 does not work with Serverless / nrlambda

Open mariusgrigaitis opened this issue 1 year ago • 11 comments

Description

No context is attached to log messages. No information in debug messages from agent itself on why.

Setup: go-agent + nrlambda + logcontext-v2 + https://github.com/newrelic/newrelic-lambda-extension + logrus

Steps to Reproduce

  1. Run setup
  2. Notice that context is not added on logs

Expected Behavior

Context is added to log messages of lambda as well.

Why?

https://github.com/newrelic/go-agent/blob/72ecc0e307fcbecd6e6350b9cd25c5a7ef3398fa/v3/newrelic/log_event.go#L189 skips adding context if EntityGUID is empty or App Name is empty which is true in case of serverless.

Also does it silently.

EntityGUID is empty because no actual agent connection happens in case of serverless https://github.com/newrelic/go-agent/blob/72ecc0e307fcbecd6e6350b9cd25c5a7ef3398fa/v3/newrelic/internal_app.go#L453

mariusgrigaitis avatar Mar 14 '23 22:03 mariusgrigaitis