fix(backend/clickhouse): fixed batch insert panic because of wrong error source (#900)

This commit is contained in:
Alexander 2022-12-24 20:53:11 +01:00 committed by GitHub
parent 2c85c6c05b
commit 205fdcba42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -289,7 +289,13 @@ func (c *connectorImpl) InsertWebErrorEvent(session *types.Session, msg *types.E
keys = append(keys, k)
values = append(values, v)
}
// Check error source before insert to avoid panic from clickhouse lib
switch msg.Source {
case "js_exception", "bugsnag", "cloudwatch", "datadog", "elasticsearch", "newrelic", "rollbar", "sentry", "stackdriver", "sumologic":
default:
return fmt.Errorf("unknown error source: %s", msg.Source)
}
// Insert event to batch
if err := c.batches["errors"].Append(
session.SessionID,
uint16(session.ProjectID),