Skip to content

Commit

Permalink
query tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
mangas committed Feb 24, 2025
1 parent b27502c commit 2f11488
Show file tree
Hide file tree
Showing 21 changed files with 810 additions and 37 deletions.
52 changes: 36 additions & 16 deletions Cargo.lock

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

19 changes: 16 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ bs58 = "0.5.1"
chrono = "0.4.38"
clap = { version = "4.5.4", features = ["derive", "env"] }
derivative = "2.2.0"
diesel = { version = "2.2.4", features = ["postgres", "serde_json", "numeric", "r2d2", "chrono", "uuid", "i-implement-a-third-party-backend-and-opt-into-breaking-changes"] }
diesel = { version = "2.2.4", features = [
"postgres",
"serde_json",
"numeric",
"r2d2",
"chrono",
"uuid",
"i-implement-a-third-party-backend-and-opt-into-breaking-changes",
] }
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
diesel-dynamic-schema = { version = "0.2.1", features = ["postgres"] }
diesel_derives = "2.1.4"
Expand All @@ -56,19 +64,24 @@ serde_derive = "1.0.125"
serde_json = { version = "1.0", features = ["arbitrary_precision"] }
serde_regex = "1.1.0"
serde_yaml = "0.9.21"
slog = { version = "2.7.0", features = ["release_max_level_trace", "max_level_trace"] }
slog = { version = "2.7.0", features = [
"release_max_level_trace",
"max_level_trace",
] }
sqlparser = "0.46.0"
strum = { version = "0.26", features = ["derive"] }
syn = { version = "2.0.66", features = ["full"] }
test-store = { path = "./store/test-store" }
thiserror = "1.0.25"
tokio = { version = "1.38.0", features = ["full"] }
tokio = { version = "1", features = ["full"] }
tonic = { version = "0.11.0", features = ["tls-roots", "gzip"] }
tonic-build = { version = "0.11.0", features = ["prost"] }
tower-http = { version = "0.5.2", features = ["cors"] }
wasmparser = "0.118.1"
wasmtime = "15.0.1"

indexer-watcher = { git = "https://github.com/graphprotocol/indexer-rs", tag = "indexer-service-rs-v1.4.2" }

# Incremental compilation on Rust 1.58 causes an ICE on build. As soon as graph node builds again, these can be removed.
[profile.test]
incremental = false
Expand Down
17 changes: 7 additions & 10 deletions graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ atomic_refcell = "0.1.13"
# We require this precise version of bigdecimal. Updating to later versions
# has caused PoI differences; if you update this version, you will need to
# make sure that it does not cause PoI changes
old_bigdecimal = { version = "=0.1.2", features = ["serde"], package = "bigdecimal" }
old_bigdecimal = { version = "=0.1.2", features = [
"serde",
], package = "bigdecimal" }
bytes = "1.0.1"
bs58 = { workspace = true }
cid = "0.11.1"
Expand Down Expand Up @@ -64,14 +66,7 @@ slog-envlogger = "2.1.0"
slog-term = "2.7.0"
petgraph = "0.6.5"
tiny-keccak = "1.5.0"
tokio = { version = "1.38.0", features = [
"time",
"sync",
"macros",
"test-util",
"rt-multi-thread",
"parking_lot",
] }
tokio.workspace = true
tokio-stream = { version = "0.1.15", features = ["sync"] }
tokio-retry = "0.3.0"
toml = "0.8.8"
Expand All @@ -92,11 +87,13 @@ defer = "0.2"
# Our fork contains patches to make some fields optional for Celo and Fantom compatibility.
# Without the "arbitrary_precision" feature, we get the error `data did not match any variant of untagged enum Response`.
web3 = { git = "https://github.com/graphprotocol/rust-web3", branch = "graph-patches-onto-0.18", features = [
"arbitrary_precision", "test"
"arbitrary_precision",
"test",
] }
serde_plain = "1.0.2"
csv = "1.3.0"
object_store = { version = "0.11.0", features = ["gcp"] }
indexer-watcher.workspace = true

[dev-dependencies]
clap.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions graph/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ fn main() {
.out_dir("src/substreams_rpc")
.compile(&["proto/substreams-rpc.proto"], &["proto"])
.expect("Failed to compile Substreams RPC proto(s)");

tonic_build::configure()
.out_dir("src/grpc/pb")
.include_file("mod.rs")
.compile(&["proto/tracing.proto"], &["proto"])
.expect("Failed to compile Tracing proto(s)");
}
19 changes: 19 additions & 0 deletions graph/proto/tracing.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";

package graph.tracing.v1;

service Stream { rpc QueryTrace(Request) returns (stream Response); }

message Request { int32 deployment_id = 1; }

message Response { repeated Trace traces = 1; }

message Trace {
int32 deployment_id = 1;
string query = 2;
uint64 duration_millis = 3;
uint32 children = 4;
optional uint64 conn_wait_millis = 5;
optional uint64 permit_wait_millis = 6;
optional uint64 entity_count = 7;
}
2 changes: 2 additions & 0 deletions graph/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ pub mod metrics;
/// Components dealing with versioning
pub mod versions;

pub mod tracing;

/// A component that receives events of type `T`.
pub trait EventConsumer<E> {
/// Get the event sink.
Expand Down
Loading

0 comments on commit 2f11488

Please sign in to comment.