https://github.com/graphprotocol/agora
Cost model
https://github.com/graphprotocol/agora
Last synced: 10 months ago
JSON representation
Cost model
- Host: GitHub
- URL: https://github.com/graphprotocol/agora
- Owner: graphprotocol
- License: mit
- Created: 2020-09-03T22:46:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T12:50:50.000Z (over 1 year ago)
- Last Synced: 2025-04-09T16:18:04.361Z (10 months ago)
- Language: Rust
- Size: 378 KB
- Stars: 20
- Watchers: 24
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Agora
## The evaluation tool
The source for the evaluation tool lives under this repo at `./agora/`.
### Installation
To compile and run from source:
**Install Rustup**
If you don't have `cargo` already, install it by following the instructions here: https://www.rust-lang.org/tools/install
**Compile and Run**
The first step in using the tool is to compile it with `cargo`.
```shell
cd ./agora
cargo build --release
```
The tool will be compiled to `/target/release/`.
```shell
cd target/release/
./agora -h
```
This should print the available command-line arguments, which, at the time of this writing will look like this:
```
agora 0.1.0
USAGE:
agora [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-c, --cost A cost model to use for costing
--globals
--grt-per-time
-l, --load-log ... Load request log file(s) supports json and tree-buf
--sample Take a sample of the request log. Unit interval [default: 1.0]
--save-log Save the request log file. Only tree-buf is supported
```
**Usage**
The arguments to the tool are meant to be combined to instruct `agora` to accomplish tasks. What follows are just examples:
```shell
# Load two log files (from json lines format)
# Sample the logs at 10%
# Save the result as a single tree-buf file
./agora \
--load-log ./log1.jsonl \
--load-log ./log2.jsonl \
--sample 0.1 \
--save-log ./logs.treebuf
# Load the sampled/combined file
# And evaluate the effectiveness of our pricing
./agora \
--load-log ./logs.treebuf \
--globals ./globals.json \
--grt-per-time 0.0001 \
--cost ./cost-model.agora
```
**Cost Models**
Agora uses a specialized language for defining cost models that can react to changes in Query structure
and parameters. See the [documentation](https://github.com/graphprotocol/agora/blob/master/docs/README.md) to learn about the Agora cost model language.
## Copyright
Copyright © 2020 The Graph Foundation.
Licensed under the [MIT license](./LICENSE).