regen-ledger icon indicating copy to clipboard operation
regen-ledger copied to clipboard

Add ability to query all events on a per module basis

Open ryanchristo opened this issue 2 years ago • 6 comments

Summary

The Regen Registry interface has a page that lists all events emitted by the ecocredit module and the implementation requires adding each event type. It's possible to query all events per module in the sdk and should be possible within regen-ledger.

Problem Definition

A user should be able to query all events on a per module basis.

Proposal

Add ability to query all events on a per module basis. Needs further investigation.


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned

ryanchristo avatar May 18 '22 22:05 ryanchristo

For reference:

  // TODO: until ledger API supports "message.module='ecocredit'",
  // we must send separate requests for each message action type:

https://github.com/regen-network/regen-web/blob/master/web-registry/src/lib/ecocredit.ts#L100-L101

ryanchristo avatar May 26 '22 15:05 ryanchristo

It looks like the following only works with legacy events and not typed events:

regen q txs --events message.modules='ecocredit'

It is possible to query all events but not per module:

regen q txs --events message.action=''

ryanchristo avatar May 31 '22 20:05 ryanchristo

For reference, to query a single event / should not be included after Msg:

No results using the format specified in the sdk documentation:

regen q txs --events message.action='/regen.ecocredit.v1.Msg/CreateClass'

Expected results provided without / after Msg:

regen q txs --events message.action='/regen.ecocredit.v1.MsgCreateClass'

ryanchristo avatar May 31 '22 20:05 ryanchristo

We should try the postgres indexer: https://docs.tendermint.com/master/app-dev/indexing-transactions.html

aaronc avatar May 31 '22 20:05 aaronc

Removing this as nice to have for v4.0 and moving this to the backlog. Querying for all events per module is currently not possible with typed events and experimenting with the postgres indexer seems like more work than necessary for v4.0.

ryanchristo avatar May 31 '22 22:05 ryanchristo

Removing this as nice to have for v4.0 and moving this to the backlog. Querying for all events per module is currently not possible with typed events and experimenting with the postgres indexer seems like more work than necessary for v4.0.

Well it's a devops task not a dev task. So not for 4.0 specifically, but the registry team could set this up if they need to do these queries

aaronc avatar May 31 '22 22:05 aaronc

I tried tendermint postgres indexer and events are syncing. The only issue is tendermint events queries are not implemented for postgres indexer.

We have to write our own client to query events from postgres database.

This doc contains instructions to setup Postgres indexer Doc. cc: @clevinson

aleem1314 avatar Sep 26 '22 14:09 aleem1314

Thanks @aleem1314 !

@dpdanpittman will take a look at integrating this into our docs.

clevinson avatar Oct 24 '22 15:10 clevinson

We should have a Postgres database in heroku with all our events indexed already. Why can't we just use that?

aaronc avatar Oct 24 '22 16:10 aaronc

I've reassigned this issue to myself. I'm going to try to move this forward alongside the state machine work.

ryanchristo avatar Feb 07 '23 16:02 ryanchristo