feat(db): removed js exception tags in CH
This commit is contained in:
parent
8e41c3ce91
commit
6c891cb131
3 changed files with 5 additions and 19 deletions
|
|
@ -501,11 +501,6 @@ func (c *connectorImpl) InsertWebClickEvent(session *sessions.Session, msg *mess
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *connectorImpl) InsertWebErrorEvent(session *sessions.Session, msg *types.ErrorEvent) error {
|
func (c *connectorImpl) InsertWebErrorEvent(session *sessions.Session, msg *types.ErrorEvent) error {
|
||||||
keys, values := make([]string, 0, len(msg.Tags)), make([]*string, 0, len(msg.Tags))
|
|
||||||
for k, v := range msg.Tags {
|
|
||||||
keys = append(keys, k)
|
|
||||||
values = append(values, v)
|
|
||||||
}
|
|
||||||
// Check error source before insert to avoid panic from clickhouse lib
|
// Check error source before insert to avoid panic from clickhouse lib
|
||||||
switch msg.Source {
|
switch msg.Source {
|
||||||
case "js_exception", "bugsnag", "cloudwatch", "datadog", "elasticsearch", "newrelic", "rollbar", "sentry", "stackdriver", "sumologic":
|
case "js_exception", "bugsnag", "cloudwatch", "datadog", "elasticsearch", "newrelic", "rollbar", "sentry", "stackdriver", "sumologic":
|
||||||
|
|
@ -514,12 +509,10 @@ func (c *connectorImpl) InsertWebErrorEvent(session *sessions.Session, msg *type
|
||||||
}
|
}
|
||||||
msgID, _ := msg.ID(session.ProjectID)
|
msgID, _ := msg.ID(session.ProjectID)
|
||||||
jsonString, err := json.Marshal(map[string]interface{}{
|
jsonString, err := json.Marshal(map[string]interface{}{
|
||||||
"source": msg.Source,
|
"source": msg.Source,
|
||||||
"name": nullableString(msg.Name),
|
"name": nullableString(msg.Name),
|
||||||
"message": msg.Message,
|
"message": msg.Message,
|
||||||
"error_id": msgID,
|
"error_id": msgID,
|
||||||
"error_tags_keys": keys,
|
|
||||||
"error_tags_values": values,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("can't marshal error event: %s", err)
|
return fmt.Errorf("can't marshal error event: %s", err)
|
||||||
|
|
|
||||||
|
|
@ -181,11 +181,6 @@ func (conn *Conn) InsertWebErrorEvent(sess *sessions.Session, e *types.ErrorEven
|
||||||
if err := conn.bulks.Get("webErrorEvents").Append(sess.SessionID, truncSqIdx(e.MessageID), e.Timestamp, errorID); err != nil {
|
if err := conn.bulks.Get("webErrorEvents").Append(sess.SessionID, truncSqIdx(e.MessageID), e.Timestamp, errorID); err != nil {
|
||||||
conn.log.Error(sessCtx, "insert web error event err: %s", err)
|
conn.log.Error(sessCtx, "insert web error event err: %s", err)
|
||||||
}
|
}
|
||||||
for key, value := range e.Tags {
|
|
||||||
if err := conn.bulks.Get("webErrorTags").Append(sess.SessionID, truncSqIdx(e.MessageID), errorID, key, value); err != nil {
|
|
||||||
conn.log.Error(sessCtx, "insert web error token err: %s", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ func parseTags(tagsJSON string) (tags map[string]*string, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func WrapJSException(m *JSException) (*ErrorEvent, error) {
|
func WrapJSException(m *JSException) (*ErrorEvent, error) {
|
||||||
meta, err := parseTags(m.Metadata)
|
|
||||||
return &ErrorEvent{
|
return &ErrorEvent{
|
||||||
MessageID: m.Meta().Index,
|
MessageID: m.Meta().Index,
|
||||||
Timestamp: m.Meta().Timestamp,
|
Timestamp: m.Meta().Timestamp,
|
||||||
|
|
@ -69,9 +68,8 @@ func WrapJSException(m *JSException) (*ErrorEvent, error) {
|
||||||
Name: m.Name,
|
Name: m.Name,
|
||||||
Message: m.Message,
|
Message: m.Message,
|
||||||
Payload: m.Payload,
|
Payload: m.Payload,
|
||||||
Tags: meta,
|
|
||||||
OriginType: m.TypeID(),
|
OriginType: m.TypeID(),
|
||||||
}, err
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func WrapIntegrationEvent(m *IntegrationEvent) *ErrorEvent {
|
func WrapIntegrationEvent(m *IntegrationEvent) *ErrorEvent {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue