panic icon indicating copy to clipboard operation
panic copied to clipboard

Update managers to index sources by chain_id not chain name

Open Cherrett opened this issue 3 years ago • 2 comments

Currently, managers are indexing sources/data using the base chain name and the sub chain name. This will become an issue if we are to allow users to modify the name of sub chains.

In this ticket, we must make sure that all managers index sources by the sub chain ID.

Cherrett avatar Apr 28 '22 15:04 Cherrett

The issue is that if we allow the user to change the sub-chain name, the alerter would not be able to delete the configs belonging to the old sub-chain, thus we would have two monitors running for the same set of monitorables.

As a result we need to think about either updating the managers to index sources by chain_id (very messy because you would have monitors running with the old chain name), or we make stream watchers detect a sub-chain rename. In that case stream watchers must send empty configs for the old subchain name, and all the configs for that subchain under the new name.

dillu24 avatar May 06 '22 14:05 dillu24

Guzi's suggestion:

We could generate a unique chain ID when creating the document (similar to parent_id) and use that in the routing key. Like this we could allow the sub_chain_name to change. From the alerter side all we would need to do in order to parse the sub-chain name (if needed) is to read directly the name field from the configs (rather than parsing the routing key).

{
  id: 1,
  name: "Akash",
  // unique, generated when creating
  value: "udhwiuhiu23"
}
cosmos.udhwiuhiu23.nodes_config
cosmos.udhwiuhiu23.repos_config

dillu24 avatar May 06 '22 16:05 dillu24