-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support multiple indexer-service endpoints (#49)
* feat: combine query count from multiple service endpoints Signed-off-by: Marc-André Dumas <[email protected]> * fix: remove unused code Signed-off-by: Marc-André Dumas <[email protected]> * fix: move pcrpy dependency to dev Signed-off-by: Marc-André Dumas <[email protected]> * fix: lint Signed-off-by: Marc-André Dumas <[email protected]> * fix: moved argparse Signed-off-by: Marc-André Dumas <[email protected]> * fix: add mandatory arguments Signed-off-by: Marc-André Dumas <[email protected]> * docs: args for multiple indexer-service endpoints Signed-off-by: Marc-André Dumas <[email protected]> Signed-off-by: Marc-André Dumas <[email protected]>
- Loading branch information
Showing
8 changed files
with
12,880 additions
and
924 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import asyncio | ||
|
||
import vcr | ||
|
||
import autoagora.query_metrics | ||
from autoagora.config import init_config | ||
|
||
|
||
class TestQueryMetrics: | ||
def test_subgraph_query_count(self): | ||
init_config( | ||
[ | ||
"--indexer-agent-mgmt-endpoint", | ||
"http://nowhere", | ||
"--postgres-host", | ||
"nowhere", | ||
"--postgres-username", | ||
"nowhere", | ||
"--postgres-password", | ||
"nowhere", | ||
"--indexer-service-metrics-endpoint", | ||
"http://indexer-service.default.svc.cluster.local:7300/metrics", | ||
] | ||
) | ||
with vcr.use_cassette("vcr_cassettes/test_subgraph_query_count.yaml"): | ||
res = asyncio.run( | ||
autoagora.query_metrics.subgraph_query_count( | ||
"Qmadj8x9km1YEyKmRnJ6EkC2zpJZFCfTyTZpuqC3j6e1QH" | ||
) | ||
) | ||
assert res == 938 | ||
|
||
def test_subgraph_query_count_multiple_endpoints(self): | ||
init_config( | ||
[ | ||
"--indexer-agent-mgmt-endpoint", | ||
"http://nowhere", | ||
"--postgres-host", | ||
"nowhere", | ||
"--postgres-username", | ||
"nowhere", | ||
"--postgres-password", | ||
"nowhere", | ||
"--indexer-service-metrics-endpoint", | ||
"http://indexer-service-0:7300/metrics,http://indexer-service-1:7300/metrics", | ||
] | ||
) | ||
with vcr.use_cassette( | ||
"vcr_cassettes/test_subgraph_query_count_multiple_endpoints.yaml" | ||
): | ||
res = asyncio.run( | ||
autoagora.query_metrics.subgraph_query_count( | ||
"Qmadj8x9km1YEyKmRnJ6EkC2zpJZFCfTyTZpuqC3j6e1QH" | ||
) | ||
) | ||
assert res == 2607 |
Oops, something went wrong.