newrelic / go-agent

New Relic Go Agent
Apache License 2.0
762 stars 297 forks source link

agent with nrzap is not forwarding logs to newrelic #857

Closed yehudamakarov closed 5 months ago

yehudamakarov commented 5 months ago

Description

Steps to Reproduce

Expected Behavior

logs should arrive at newrelic

Your Environment

go container in google cloud run

yehudamakarov commented 5 months ago

i'm making a logger like this: and please note: the first message does not even come through to newrelic

func logger(app *newrelic.Application) (*zap.Logger, *zapcore.Core, error) {
    core := zapcore.NewCore(zapcore.NewJSONEncoder(zap.NewProductionEncoderConfig()), zapcore.AddSync(os.Stdout), zap.InfoLevel)

    backgroundCore, err := nrzap.WrapBackgroundCore(core, app)
    if err != nil && err != nrzap.ErrNilApp {
        panic(err)
    }

    logger, err := zap.New(backgroundCore), nil
    logger.Info("this is working!")
    return logger, &core, err
}
yehudamakarov commented 5 months ago

i'm setting up app like so:

    app, err := newrelic.NewApplication(
        newrelic.ConfigAppName("my-service"),
        newrelic.ConfigLicense("my-license"),
        newrelic.ConfigDistributedTracerEnabled(true),
        newrelic.ConfigAppLogForwardingEnabled(true),
    )
    if err != nil {
        log.Fatal("could not init agent")
    }
yehudamakarov commented 5 months ago

looks like they are coming in after a lot of delay, but they are missing transaction data. probably because i need to wrap with a transaction