Skip to content

Commit c21e0de

Browse files
authored
Revert "feat(reliability) Add flag to disable telegram notifications (#92)"
This reverts commit 4ba3310.
1 parent 4ba3310 commit c21e0de

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

pyth_observer/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ def __init__(
5555
config: Dict[str, Any],
5656
publishers: Dict[str, Publisher],
5757
coingecko_mapping: Dict[str, Symbol],
58-
disable_telegram: bool = False,
5958
):
6059
self.config = config
61-
self.dispatch = Dispatch(config, publishers, disable_telegram)
60+
self.dispatch = Dispatch(config, publishers)
6261
self.publishers = publishers
6362
self.pyth_client = PythClient(
6463
solana_endpoint=config["network"]["http_endpoint"],
@@ -76,7 +75,6 @@ def __init__(
7675
metrics.set_observer_info(
7776
network=config["network"]["name"],
7877
config=config,
79-
telegram_enabled=not disable_telegram,
8078
)
8179

8280
async def run(self):

pyth_observer/cli.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@
3737
envvar="PROMETHEUS_PORT",
3838
default="9001",
3939
)
40-
@click.option(
41-
"--disable-telegram",
42-
help="Disable sending Telegram notifications",
43-
envvar="DISABLE_TELEGRAM",
44-
is_flag=True,
45-
default=False,
46-
)
47-
def run(config, publishers, coingecko_mapping, prometheus_port, disable_telegram):
40+
def run(config, publishers, coingecko_mapping, prometheus_port):
4841
config_ = yaml.safe_load(open(config, "r"))
4942
# Load publishers YAML file and convert to dictionary of Publisher instances
5043
publishers_raw = yaml.safe_load(open(publishers, "r"))
@@ -61,7 +54,11 @@ def run(config, publishers, coingecko_mapping, prometheus_port, disable_telegram
6154
for publisher in publishers_raw
6255
}
6356
coingecko_mapping_ = yaml.safe_load(open(coingecko_mapping, "r"))
64-
observer = Observer(config_, publishers_, coingecko_mapping_, disable_telegram)
57+
observer = Observer(
58+
config_,
59+
publishers_,
60+
coingecko_mapping_,
61+
)
6562

6663
start_http_server(int(prometheus_port))
6764

pyth_observer/dispatch.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ class Dispatch:
2929
notifiers for the checks that failed.
3030
"""
3131

32-
def __init__(self, config, publishers, disable_telegram=False):
32+
def __init__(self, config, publishers):
3333
self.config = config
3434
self.publishers = publishers
35-
self.disable_telegram = disable_telegram
3635
if "ZendutyEvent" in self.config["events"]:
3736
self.open_alerts_file = os.environ["OPEN_ALERTS_FILE"]
3837
self.open_alerts = self.load_alerts()
@@ -68,8 +67,6 @@ async def run(self, states: List[State]):
6867
current_time = datetime.now()
6968
for check in failed_checks:
7069
for event_type in self.config["events"]:
71-
if event_type == "TelegramEvent" and self.disable_telegram:
72-
continue
7370
event: Event = globals()[event_type](check, context)
7471

7572
if event_type in ["ZendutyEvent", "TelegramEvent"]:

pyth_observer/metrics.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ def __init__(self, registry: CollectorRegistry = REGISTRY):
148148
registry=registry,
149149
)
150150

151-
def set_observer_info(
152-
self, network: str, config: Dict[str, Any], telegram_enabled: bool = False
153-
):
151+
def set_observer_info(self, network: str, config: Dict[str, Any]):
154152
"""Set static information about the observer instance."""
155153
self.observer_info.info(
156154
{
@@ -165,7 +163,6 @@ def set_observer_info(
165163
)
166164
),
167165
"event_handlers": ",".join(config.get("events", [])),
168-
"telegram_enabled": str(int(telegram_enabled)),
169166
}
170167
)
171168

0 commit comments

Comments
 (0)