Fix #1220: catch and log any errors during the es index (#1220)

This commit is contained in:
Sriharsha Chintalapani 2022-02-28 22:57:50 -08:00 committed by GitHub
parent 06d9329ae3
commit 15d0440599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ import json
import logging
import ssl
import time
import traceback
from datetime import datetime
from typing import List, Optional
@ -205,6 +206,7 @@ class ElasticsearchSink(Sink[Entity]):
)
def write_record(self, record: Entity) -> None:
try:
if isinstance(record, Table):
table_doc = self._create_table_es_doc(record)
self.elasticsearch_client.index(
@ -270,6 +272,9 @@ class ElasticsearchSink(Sink[Entity]):
self.status.records_written(record.name.__root__)
else:
self.status.records_written(record.name)
except Exception as e:
logger.error(f"Failed to index entity {record} due to {e}")
logger.debug(traceback.print_exc())
def _create_table_es_doc(self, table: Table):
fqdn = table.fullyQualifiedName