TP-5555 | elastic error handling
This commit is contained in:
@@ -34,12 +34,14 @@ func NewElasticClient(elasticConfig configs.ElasticConfig) (*ElasticSearchClient
|
||||
}, err
|
||||
}
|
||||
|
||||
func (el *ElasticSearchClient) IndexDocument(document interface{}) {
|
||||
func (el *ElasticSearchClient) IndexDocument(document interface{}) error {
|
||||
_, err := el.client.Index("cybertron").
|
||||
Request(document).
|
||||
Do(context.Background())
|
||||
|
||||
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,
|
||||
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