Skip to content

Commit

Permalink
add website link to zenduty alert (#76)
Browse files Browse the repository at this point in the history
* add website link to zenduty alert, add safety check in zd alert logic

* lint

* bump version
  • Loading branch information
ayazabbas authored May 28, 2024
1 parent d665017 commit ab41a4d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ignore_missing_imports = true

[tool.poetry]
name = "pyth-observer"
version = "0.2.11"
version = "0.2.12"
description = "Alerts and stuff"
authors = []
readme = "README.md"
Expand Down
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
10 changes: 10 additions & 0 deletions pyth_observer/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ 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 ab41a4d

Please sign in to comment.