Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Support for metadata filtering #11

Open
e1Ru1o opened this issue May 26, 2022 · 0 comments
Open

[FEATURE] Support for metadata filtering #11

e1Ru1o opened this issue May 26, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@e1Ru1o
Copy link

e1Ru1o commented May 26, 2022

Problem

There is no way for filtering based on metadata, that makes the developers iterate over large results pages in case where they can be significantly reduced by specifying some metadata fields to filter.

Metadata works as a Map<string, string> so adding a filter to match key-value pairs on it will allow less computation on the Forta API user side and more precise/powerful filters.

Proposed Solution

I have no details to provide about how to accomplish this feature programmatically, but I have one comment to share about how I would like it to looks like in the API.

By adding something like a metadataContains field in AlertsInput the user will be able to filter to filter alerts by specifying key-value pairs that should be present in the metadata, for example:

alertInput = {
  input: {
    ... // some filter parameters
     metadataContains: {
       key1: string1,
       key2: string2,
     }
  }
}

In that way users can filter all the alerts that contains string1 as key1 & string2 as key2.

Additional context

Some examples of usage:

  1. There is a race condition for calling a function. Each time it is called an event is emitted with the caller in the metadata. It is needed to filter all the alerts given a caller.
  2. There is an event containing hashes in the metadata as hash: "true" to simulate a set of hashes. It is needed to filter alerts containing an specific hash.
  3. There is a bot monitoring roles in some smart contract. There is needed to count how many times operator X granted the role R. (operator & role are metadata fields)
@e1Ru1o e1Ru1o added the enhancement New feature or request label May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant