diff --git a/lambda/logserver/logserver.go b/lambda/logserver/logserver.go index 083c186..a94b63e 100644 --- a/lambda/logserver/logserver.go +++ b/lambda/logserver/logserver.go @@ -15,6 +15,7 @@ import ( const ( platformLogBufferSize = 100 defaultHost = "sandbox" + fallbackHost = "169.254.79.130" ) type LogLine struct { @@ -127,9 +128,13 @@ func Start() (*LogServer, error) { } func startInternal(host string) (*LogServer, error) { - listener, err := net.Listen("tcp", host+":") + // TODO: replace fallbackHost with host and remove the fallback in the error handler once 'sandbox' resolves. + listener, err := net.Listen("tcp", fallbackHost+":") if err != nil { - return nil, err + listener, err = net.Listen("tcp", host+":") + if err != nil { + return nil, err + } } server := http.Server{} diff --git a/main.go b/main.go index 4afd854..b3af47e 100644 --- a/main.go +++ b/main.go @@ -154,6 +154,11 @@ func mainLoop(invocationClient *client.InvocationClient, batch *telemetry.Batch, // Await agent telemetry. This may time out, so we race the timeout against the telemetry channel // timeoutInstant is when the invocation will time out timeoutInstant := time.Unix(0, event.DeadlineMs*int64(time.Millisecond)) + // TODO: Delete this after the deadlineMs bug is fixed in all regions + if timeoutInstant.Before(time.Now()) { + timeoutInstant = eventStart.Add(15 * time.Minute) // Max timeout; disables timeout detection + } + // Set the timeout timer for a smidge before the actual timeout; we can recover from early. timeout := time.NewTimer(timeoutInstant.Sub(time.Now()) - time.Millisecond) select { diff --git a/telemetry/request.go b/telemetry/request.go index 732e03e..f4fecba 100644 --- a/telemetry/request.go +++ b/telemetry/request.go @@ -65,7 +65,7 @@ func CompressedPayloadsForLogEvents(logsEvents []LogsEvent, functionName string, FunctionName: functionName, InvokedFunctionARN: invokedFunctionARN, LogGroupName: logGroupName, - LogStreamName: "newrelic-lambda-extension:1.0.0", + LogStreamName: "newrelic-lambda-extension:1.0.1", } data := RequestData{Context: context, Entry: string(entry)}