Skip to content

Commit

Permalink
Add endpoint information to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Deralden committed Aug 19, 2024
1 parent 9188215 commit 39c6162
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions service_status/service_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _update_service_failed_status_count(self, failed_status_count, row_id):
response = self.repo.execute(update_query, [failed_status_count, row_id])
return response

def _send_logs_to_opensearch(self, service_id, debug_error_string):
def _send_logs_to_opensearch(self, service_id, debug_error_string, endpoint):
client = OpenSearch(
http_compress = True,
hosts = [{'host': HOST, 'port': 443}],
Expand All @@ -102,7 +102,8 @@ def _send_logs_to_opensearch(self, service_id, debug_error_string):
document = {
'@timestamp': timestamp,
'Log': debug_error_string,
'Service': service_id
'Service': service_id,
'Endpoint': endpoint
}
response = client.index(
index = index_name,
Expand Down Expand Up @@ -150,7 +151,7 @@ def update_service_status(self):
org_id = record["org_id"]
service_id = record["service_id"]
recipients = self._get_service_provider_email(org_id=org_id, service_id=service_id)
self._send_logs_to_opensearch(service_id=service_id, debug_error_string=debug_error_string)
self._send_logs_to_opensearch(service_id=service_id, debug_error_string=debug_error_string, endpoint=record["endpoint"])
if failed_status_count <= 10:
self._send_notification(org_id=org_id, service_id=service_id, recipients=recipients,
endpoint=record["endpoint"], error_details=error_details,
Expand Down

0 comments on commit 39c6162

Please sign in to comment.