Merge pull request #35 from navi-ppl/TP-5555/optimise-symbolicator

TP-5555 |  elastic error handling
This commit is contained in:
Varnit Goyal
2024-11-18 19:00:24 +05:30
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -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
} }

View File

@@ -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
}
} }