go-agent
go-agent copied to clipboard
logcontext-v2 does not work with Serverless / nrlambda
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
- Run setup
- 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