Skip to content

Commit

Permalink
add website link to zenduty alert, add safety check in zd alert logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ayazabbas committed May 28, 2024
1 parent d665017 commit 216f09d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyth_observer/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ async def process_zenduty_events(self, current_time):
logger.debug(f"Raising Zenduty alert {identifier}")
self.open_alerts[identifier]["sent"] = True
self.open_alerts[identifier]["last_alert"] = current_time.isoformat()
to_alert.append(self.zenduty_events[identifier].send())
event = self.zenduty_events.get(identifier)
if event:
to_alert.append(event.send())

await asyncio.gather(*to_alert)
for identifier in to_remove:
Expand Down
4 changes: 4 additions & 0 deletions pyth_observer/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ async def send(self):
state = self.check.state()
if isinstance(state, PublisherState):
alert_identifier += f"-{state.publisher_name}"
symbol = self.check.state().symbol.replace(".", "-").replace("/", "-").lower()
cluster = "solana-mainnet-beta" if self.context.network == "mainnet" else self.context.network
publisher_key = state.public_key.key
summary += f"https://pyth.network/metrics?price-feed={symbol}&cluster={cluster}&publisher={publisher_key}\n"

logger.debug(f"Sending Zenduty alert for {alert_identifier}")
await send_zenduty_alert(
Expand Down

0 comments on commit 216f09d

Please sign in to comment.