Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about possible misconfiguration #205

Open
tomas-bareikis opened this issue Apr 8, 2024 · 1 comment
Open

Warn about possible misconfiguration #205

tomas-bareikis opened this issue Apr 8, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@tomas-bareikis
Copy link

Summary

I was setting up a NR integration for a Golang lambda function. There was a mistake done from my side. I have added a New Relic lambda layer to the lambda, but forgot to use github.com/newrelic/go-agent/v3/integrations/nrlambda package.

So, I had (A):

package main
import (
	"context"
	"fmt"
	"github.com/aws/aws-lambda-go/lambda"
)
func handler(ctx context.Context) {
	fmt.Println("Hello New Relic")
}
func main() {
	lambda.Start(handler)
}

Instead of (B):

package main
import (
	"context"
	"fmt"
	"github.com/newrelic/go-agent/v3/integrations/nrlambda"
	"github.com/newrelic/go-agent/v3/newrelic"
)
func handler(ctx context.Context) {
	fmt.Println("Hello New Relic")
}
func main() {
	app, err := newrelic.NewApplication(nrlambda.ConfigOption())
	if nil != err {
		fmt.Println("error creating app (invalid config):", err)
	}
	nrlambda.Start(handler, app)
}

The timeout for the lambda was set to 15 seconds. Option A was running for 14 seconds and 799.66ms. It finished successfully just before the timeout.

Lambda output was:

INIT_START Runtime Version: provided:al2.v34	Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:a38a7c2b20823ad5a2a1318d6dcec1bc0e12078c15888f062e9dc49b3d20d010
[NR_EXT] New Relic Lambda Extension starting up
[NR_EXT] Initializing version 2.3.11 of the New Relic Lambda Extension...
[NR_EXT] Fetching license key from secret id <redacted>
[NR_EXT] Starting log server.
LOGS	Name: newrelic-lambda-extension	State: Subscribed	Types: [Platform]
EXTENSION	Name: newrelic-lambda-extension	State: Ready	Events: [INVOKE, SHUTDOWN]
START RequestId: 65fc5476-7586-4452-8280-cc0ad3891d4c Version: $LATEST
Hello New Relic
END RequestId: 65fc5476-7586-4452-8280-cc0ad3891d4c
REPORT RequestId: 65fc5476-7586-4452-8280-cc0ad3891d4c	Duration: 14799.66 ms	Billed Duration: 15021 ms	Memory Size: 128 MB	Max Memory Used: 41 MB	Init Duration: 221.25 ms	
[NR_EXT] New Relic Extension shutting down after 2 events
[NR_EXT] Log server terminating: http: Server closed
[NR_EXT] Extension shutdown after 342737ms

I understand that the NR lambda extension was waiting for telemetry until the timeout - 200ms as defined here. However, there were no obvious hints of possible misconfiguration.

Desired Behavior

In case of lambda code in the example A, the New Relic lambda layer outputs a warning indicating that no telemetry data was received after waiting x ms.

Additional context

In case of misconfiguration like this, I spent a few hours investigating the weird behaviour of lambda getting stuck. A warning message hinting towards possible misconfiguration would be great.

  • AWS lambda runtime: provided.al2
  • AWS runtime arch: arm64
  • Go version: 1.22.2
  • New Relic lambda layer: arn:aws:lambda:eu-west-1:451483290750:layer:NewRelicLambdaExtensionARM64:20
@tomas-bareikis tomas-bareikis added the enhancement New feature or request label Apr 8, 2024
@chaudharysaket chaudharysaket self-assigned this Apr 9, 2024
@workato-integration
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants