Skip to content

Commit ab41a4d

Browse files
authored
add website link to zenduty alert (#76)
* add website link to zenduty alert, add safety check in zd alert logic * lint * bump version
1 parent d665017 commit ab41a4d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ignore_missing_imports = true
44

55
[tool.poetry]
66
name = "pyth-observer"
7-
version = "0.2.11"
7+
version = "0.2.12"
88
description = "Alerts and stuff"
99
authors = []
1010
readme = "README.md"

pyth_observer/dispatch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ async def process_zenduty_events(self, current_time):
208208
logger.debug(f"Raising Zenduty alert {identifier}")
209209
self.open_alerts[identifier]["sent"] = True
210210
self.open_alerts[identifier]["last_alert"] = current_time.isoformat()
211-
to_alert.append(self.zenduty_events[identifier].send())
211+
event = self.zenduty_events.get(identifier)
212+
if event:
213+
to_alert.append(event.send())
212214

213215
await asyncio.gather(*to_alert)
214216
for identifier in to_remove:

pyth_observer/event.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ async def send(self):
170170
state = self.check.state()
171171
if isinstance(state, PublisherState):
172172
alert_identifier += f"-{state.publisher_name}"
173+
symbol = (
174+
self.check.state().symbol.replace(".", "-").replace("/", "-").lower()
175+
)
176+
cluster = (
177+
"solana-mainnet-beta"
178+
if self.context["network"] == "mainnet"
179+
else self.context["network"]
180+
)
181+
publisher_key = state.public_key.key
182+
summary += f"https://pyth.network/metrics?price-feed={symbol}&cluster={cluster}&publisher={publisher_key}\n"
173183

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

0 commit comments

Comments
 (0)