metricq/metricq-manager

Remove legacy behavior in db.register handler

Closed this issue · 2 comments

Apparently, the handler for db.register emulates a call to db.subscribe if the database configuration contains a "metrics" key:

# TODO once all deployed databases support an explicit subscribe, this part can be removed
# this emulates the RPC format of db.subscribe
def convert_metric_config(metric_name, metric_config):
if "prefix" in metric_config and metric_config["prefix"]:
raise ValueError("prefix no longer supported in the manager")
elif "input" in metric_config:
return {"name": metric_name, "input": metric_config["input"]}
else:
return metric_name
subscribe_metrics = [
convert_metric_config(*metric_item)
for metric_item in metric_configs.items()
]
await self.handle_db_subscribe(
from_token, metrics=subscribe_metrics, metadata=False
)
# End of "removable" legacy stuff --- so we don't use the return value even if we could save some

Is this still necessary? Will the current databases issue a db.subscribe themselves?

Pinging @tilsche after playing the git blame game.

Closed by #29.