airbrake / gobrake

Airbrake notifier for Golang
https://docs.airbrake.io/docs/platforms/go-lang
MIT License
104 stars 42 forks source link

zapbrake include fields in the Airbrake notice #369

Open davidoram opened 1 year ago

davidoram commented 1 year ago

I'm using the "github.com/airbrake/gobrake/v5/zap" package that allows me to send my zap logs to Airbrake and its working great.

When I call the zap logger, I'm typically passing through some fields like this example:

log.Error("error-msg",
   zap.Error(fmt.Errorf("Boom!")),
   zap.String("keyOne", "valueOne"),
   zap.Int32("keyTwo", 10))

When I look in airbrake thats being delivered with this context:

{
  "architecture": "arm64",
  "component": "<redacted>",
  "environment": "test",
  "gopath": "<redacted>",
  "hostname": "<redacted>",
  "language": "go1.20.1",
  "lastCheckout": {
    "email": "<redacted>",
    "revision": "cb7dbe5c549ca13e0cbbabe8d4400e09cf296bad",
    "time": "2023-02-16T13:40:16+13:00",
    "username": "<redacted>"
  },
  "messageParams": {
    "0": "error-msg"
  },
  "messagePattern": "{}",
  "notifier": {
    "name": "gobrake",
    "url": "https://github.com/airbrake/gobrake",
    "version": "5.6.1"
  },
  "os": "darwin",
  "remoteAddr": "<redacted>",
  "remoteCountry": "New Zealand",
  "remoteCountryCode": "NZ",
  "repository": "<redacted>",
  "revision": "f979edcda27bff4618dcdf6d5a09679973875a83",
  "rootDirectory": "<redacted>",
  "severity": "error"
}

I can see the error-msg coming through inside messageParams, but where is the other fields I sent in the log message, eg the error Boom! and the "keyOne": "valueOne" and "keyTwo": 10 values?