diff --git a/pyproject.toml b/pyproject.toml index 307ea62..1e74088 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ ignore_missing_imports = true [tool.poetry] name = "pyth-observer" -version = "0.1.6" +version = "0.1.7" description = "Alerts and stuff" authors = [] readme = "README.md" diff --git a/pyth_observer/event.py b/pyth_observer/event.py index c69a7d2..334e2ea 100644 --- a/pyth_observer/event.py +++ b/pyth_observer/event.py @@ -11,6 +11,7 @@ from loguru import logger from pyth_observer.check import Check +from pyth_observer.check.publisher import PublisherCheck class Context(TypedDict): @@ -35,8 +36,17 @@ async def send(self): # Publisher checks expect the key -> name mapping of publishers when # generating the error title/message. text = self.check.error_message() + + # An example is: PriceFeedOfflineCheck-Crypto.AAVE/USD + aggregation_key = f"{self.check.__class__.__name__}-{self.check.state().symbol}" + + if self.check.__class__.__bases__ == (PublisherCheck,): + # Add publisher key to the aggregation key to separate different faulty publishers + # An example would be: PublisherPriceCheck-Crypto.AAVE/USD-9TvAYCUkGajRXs.... + aggregation_key += "-" + self.check.state().public_key + event = DatadogAPIEvent( - aggregation_key=f"{self.check.__class__.__name__}-{self.check.state().symbol}", + aggregation_key=aggregation_key, title=text.split("\n")[0], text=text, tags=[