IndexerDAO / IndexerDAO

3 stars 0 forks source link

Investigate how to use AutoAgora #30

Open Web3Slimchance opened 1 year ago

Web3Slimchance commented 1 year ago

https://github.com/semiotic-ai/autoagora

An Agora cost model automation tool for The Graph indexers:

AutoAgora will continously:

Dependencies

For AutoAgora to function correctly, you will also need to set up:

Build

docker build -t autoagora .

https://github.com/semiotic-ai/autoagora-indexer-service

A wrapper around the indexer-service that captures and filters its logs.

The point of this is to capture "query timing" logs from the indexer-service and send them to the AutoAgora Processor through RabbitMQ. All the other logs are sent back to stdout.

Works only with indexer-service v0.20.1+, which generates the logs that are needed for AutoAgora (see https://github.com/graphprotocol/indexer/pull/428).

Build

docker build --build-arg "INDEXER_SERVICE_TAG=v0.20.3" -t autoagora-indexer-service:v0.1.2-0.20.3 .

https://github.com/semiotic-ai/autoagora-processor

Processes raw indexer-service logs from a RabbitMQ queue, saves the results to a PostgreSQL database.

The processing:

Build

docker build -t autoagora-processor .

alex-pakalniskis commented 1 year ago

Notes from [MIPs Workshop] The Graph's Cost Model & AutoAgora

Zoom link: https://us06web.zoom.us/j/86758885752

Agora & AutoAgora

GraphQL query cost modeling and automation

Agora: A primer

Indexer components and the gateway (only showing flow of queries)

Indexer service serves a cost model to the gateway

Agora domain specific language

query {
    swaps(first: $first) {
        id
        transaction
    }
}  => 0.042 + ..... (more cost info goes here)

Agora cost modeling

  1. Run query-node with GRAPH_LOG_QUERY_TIMING=qgl + Capture logs
  2. Run the logs through github.com/graphprotocol/qlog for analysis + generate .jsonl log files
  3. Write Agora models for each subgraph
  4. Try the Agora models using the .jsonl files + gihub.com/graphprotocol/agora

Writing Agora models is hard and repetitive :(


default => 0.00001;

AutoAgora