Merge pull request #35 from navi-ppl/TP-5555/optimise-symbolicator
TP-5555 | elastic error handling
This commit is contained in:
@@ -34,12 +34,14 @@ func NewElasticClient(elasticConfig configs.ElasticConfig) (*ElasticSearchClient
|
|||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (el *ElasticSearchClient) IndexDocument(document interface{}) {
|
func (el *ElasticSearchClient) IndexDocument(document interface{}) error {
|
||||||
_, err := el.client.Index("cybertron").
|
_, err := el.client.Index("cybertron").
|
||||||
Request(document).
|
Request(document).
|
||||||
Do(context.Background())
|
Do(context.Background())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error ingesting the doc: %s", err)
|
log.Printf("Error ingesting the doc: %v", err)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,5 +196,9 @@ func (ep *ErrorProcessor) ProcessError(error []byte) {
|
|||||||
Extra: payload.Extra,
|
Extra: payload.Extra,
|
||||||
Request: payload.Request,
|
Request: payload.Request,
|
||||||
}
|
}
|
||||||
ep.elasticSearchClient.IndexDocument(errorDocument)
|
elastic_err := ep.elasticSearchClient.IndexDocument(errorDocument)
|
||||||
|
if elastic_err != nil {
|
||||||
|
ep.logger.Info("error occured in elasticsearch", zap.Error(elastic_err))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user