Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add website link to zenduty alert #76

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading