Skip to content

Commit

Permalink
Org id added to the logs (#1845)
Browse files Browse the repository at this point in the history
* Github actions implementation (#1833)

* Services alerts fix (#1835)

* Key fix in config (#1837)

* Opensearch logs introduction (#1839)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* Datetime fix (#1840)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* datetime fix

---------

Co-authored-by: Valery Geraskin <[email protected]>

* Changes to alert message structure (#1842)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* datetime fix

* Changes to alert message structure

---------

Co-authored-by: Valery Geraskin <[email protected]>

* Org id added to the logs (#1844)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* datetime fix

* Changes to alert message structure

* Org id added to the logs

---------

Co-authored-by: Valery Geraskin <[email protected]>

---------

Co-authored-by: Valery Geraskin <[email protected]>
  • Loading branch information
Deralden and Valery Geraskin authored Aug 21, 2024
1 parent e8cd5c0 commit e37ed06
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 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, endpoint):
def _send_logs_to_opensearch(self, service_id, debug_error_string, org_id, endpoint):
client = OpenSearch(
http_compress = True,
hosts = [{'host': HOST, 'port': 443}],
Expand All @@ -103,6 +103,7 @@ def _send_logs_to_opensearch(self, service_id, debug_error_string, endpoint):
'@timestamp': timestamp,
'Log': debug_error_string,
'Service': service_id,
'Organization': org_id,
'Endpoint': endpoint
}
response = client.index(
Expand Down Expand Up @@ -151,7 +152,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, endpoint=record["endpoint"])
self._send_logs_to_opensearch(service_id=service_id, debug_error_string=debug_error_string, org_id=org_id, 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 e37ed06

Please sign in to comment.