Skip to content

Commit

Permalink
New endpoint that returns the Graphix API version (#101)
Browse files Browse the repository at this point in the history
* Don't use host networking (macOS issues)

Signed-off-by: Filippo Costa <filippo@neysofu.me>

* Update data sources and fix compose setup for macOS

* Fix accidental changes to `settings.default.json`

* Add version string to the API

Signed-off-by: Filippo Costa <filippo@neysofu.me>

* Some more dashboard changes

Signed-off-by: Filippo Costa <filippo@neysofu.me>

---------

Signed-off-by: Filippo Costa <filippo@neysofu.me>
  • Loading branch information
neysofu authored Jul 22, 2024
1 parent cedde28 commit 5022ef6
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 46 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = ["crates/*"]

[workspace.package]
authors = ["Edge & Node Ventures, Inc. & contributors"]
version = "1.0.0"
version = "1.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "A GraphQL API for monitoring and cross-checking PoIs on the The Graph network."
Expand Down
1 change: 1 addition & 0 deletions compose/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GRAPHIX_DB_URL=postgresql://postgres:password@localhost:5433/graphix
3 changes: 0 additions & 3 deletions compose/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ services:
user: ":"
depends_on:
- prometheus
network_mode: host
ports:
- "3000:3000"
environment:
Expand All @@ -27,7 +26,6 @@ services:
- --storage.tsdb.path=/prometheus
- --web.console.libraries=/usr/share/prometheus/console_libraries
- --web.console.templates=/usr/share/prometheus/consoles
network_mode: host
ports:
- "9090:9090"
logging:
Expand All @@ -38,7 +36,6 @@ services:
postgres:
image: postgres
restart: unless-stopped
network_mode: host
ports:
# We want to be able to connect to the Postgres database both from within
# the Docker-compose network, and outside of it, to share Graphix
Expand Down
Binary file modified compose/grafana/data/grafana.db
Binary file not shown.
4 changes: 4 additions & 0 deletions crates/autogen_graphql_schema/api_schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ type ProofOfIndexing {
}

type QueryRoot {
"""
Returns the version of the Graphix instance.
"""
version: String!
"""
Fetches all tracked subgraph deploymens in this Graphix instance and
filters them according to some filtering rules.
Expand Down
5 changes: 5 additions & 0 deletions crates/graphix_lib/src/graphql_api/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ pub struct QueryRoot;

#[Object]
impl QueryRoot {
/// Returns the version of the Graphix instance.
async fn version(&self) -> Result<String> {
Ok(crate::GRAPHIX_VERSION.to_string())
}

/// Fetches all tracked subgraph deploymens in this Graphix instance and
/// filters them according to some filtering rules.
async fn deployments(
Expand Down
112 changes: 78 additions & 34 deletions grafana/dashboards/Graphix_–_Main_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,8 @@
},
{
"datasource": {
"type": "fifemon-graphql-datasource",
"uid": "gYhzyBE4k"
"type": "yesoreyeram-infinity-datasource",
"uid": "cc061b34-ab8f-4ed4-8905-45ce2d70806f"
},
"description": "List of indexers monitored by Graphix",
"fieldConfig": {
Expand Down Expand Up @@ -817,13 +817,24 @@
"id": "displayName",
"value": "Default display name"
},
{
"id": "noValue",
"value": "-"
},
{
"id": "custom.filterable",
"value": true
},
{
"id": "mappings",
"value": [
{
"options": {
"null": {
"color": "text",
"index": 0,
"text": "-"
}
},
"type": "value"
}
]
}
]
},
Expand All @@ -838,6 +849,28 @@
"value": 445
}
]
},
{
"matcher": {
"id": "byName",
"options": "networkSubgraphMetadata"
},
"properties": [
{
"id": "mappings",
"value": [
{
"options": {
"null": {
"index": 0,
"text": "-"
}
},
"type": "value"
}
]
}
]
}
]
},
Expand Down Expand Up @@ -870,30 +903,36 @@
"pluginVersion": "9.3.16",
"targets": [
{
"aliasBy": "",
"annotationTags": "",
"annotationText": "",
"annotationTitle": "",
"constant": 6.5,
"dataPath": "indexers",
"columns": [],
"datasource": {
"type": "fifemon-graphql-datasource",
"uid": "gYhzyBE4k"
"type": "yesoreyeram-infinity-datasource",
"uid": "cc061b34-ab8f-4ed4-8905-45ce2d70806f"
},
"endTimePath": "endTime",
"groupBy": "",
"queryText": "query {\n indexers {\n address\n defaultDisplayName\n networkSubgraphMetadata {\n allocatedTokens\n }\n }\n}",
"filters": [],
"format": "table",
"global_query_id": "",
"refId": "A",
"timePath": ""
"root_selector": "data.indexers",
"source": "url",
"type": "graphql",
"url": "$graphix_baseurl",
"url_options": {
"body_content_type": "application/json",
"body_graphql_query": "query {\n indexers {\n address\n defaultDisplayName\n networkSubgraphMetadata {\n allocatedTokens\n }\n }\n}",
"body_graphql_variables": "{ }",
"body_type": "graphql",
"data": "",
"method": "POST"
}
}
],
"title": "Monitored indexers",
"type": "table"
},
{
"datasource": {
"type": "fifemon-graphql-datasource",
"uid": "gYhzyBE4k"
"type": "yesoreyeram-infinity-datasource",
"uid": "cc061b34-ab8f-4ed4-8905-45ce2d70806f"
},
"description": "",
"fieldConfig": {
Expand Down Expand Up @@ -994,21 +1033,26 @@
"pluginVersion": "9.3.16",
"targets": [
{
"aliasBy": "",
"annotationTags": "",
"annotationText": "",
"annotationTitle": "",
"constant": 6.5,
"dataPath": "networks",
"columns": [],
"datasource": {
"type": "fifemon-graphql-datasource",
"uid": "gYhzyBE4k"
"type": "yesoreyeram-infinity-datasource",
"uid": "cc061b34-ab8f-4ed4-8905-45ce2d70806f"
},
"endTimePath": "endTime",
"groupBy": "",
"queryText": "query {\n networks {\n name\n caip2\n }\n}",
"filters": [],
"format": "table",
"global_query_id": "",
"refId": "A",
"timePath": ""
"root_selector": "data.networks",
"source": "url",
"type": "graphql",
"url": "$graphix_baseurl",
"url_options": {
"body_content_type": "application/json",
"body_graphql_query": "query {\n networks {\n name\n caip2\n }\n}",
"body_type": "graphql",
"data": "",
"method": "POST"
}
}
],
"title": "Networks with known subgraphs",
Expand All @@ -1025,7 +1069,7 @@
{
"hide": 2,
"name": "graphix_baseurl",
"query": "http://localhost:8000/graphql",
"query": "http://host.docker.internal:8000/graphql",
"skipUrlSync": false,
"type": "constant"
}
Expand All @@ -1039,6 +1083,6 @@
"timezone": "",
"title": "Graphix – Main dashboard",
"uid": "dee4d09d-0dbc-4af2-b4a2-2fcb9ecf35cc",
"version": 33,
"version": 37,
"weekStart": ""
}

0 comments on commit 5022ef6

Please sign in to comment.