From d258fac580eda93ffa9621a7d3a5787fe00984b2 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Fri, 5 May 2023 18:46:23 +0800 Subject: [PATCH] chore: switch to compact greptimedb rust client --- Cargo.lock | 31 +++++++++++++++++++++++++++++++ Cargo.toml | 2 +- sample.toml | 19 ------------------- src/sinks/greptimedb/client.rs | 1 - 4 files changed, 32 insertions(+), 21 deletions(-) delete mode 100644 sample.toml diff --git a/Cargo.lock b/Cargo.lock index 43c46a2807d43..4c597b2a1f9c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3574,6 +3574,36 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "greptime-proto" +version = "0.1.0" +source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=e8abf8241c908448dce595399e89c89a40d048bd#e8abf8241c908448dce595399e89c89a40d048bd" +dependencies = [ + "prost", + "tonic 0.9.2", + "tonic-build", +] + +[[package]] +name = "greptimedb-client-rust" +version = "0.1.0" +source = "git+https://github.com/GreptimeTeam/greptimedb-client-rust.git?rev=2b5d575fd4aaff2955b20e59e752e1eba71c4b75#2b5d575fd4aaff2955b20e59e752e1eba71c4b75" +dependencies = [ + "dashmap", + "enum_dispatch", + "futures 0.3.28", + "futures-util", + "greptime-proto", + "parking_lot", + "prost", + "rand 0.8.5", + "snafu", + "tokio", + "tonic 0.9.2", + "tonic-build", + "tower", +] + [[package]] name = "grok" version = "2.0.0" @@ -9229,6 +9259,7 @@ dependencies = [ "glob", "goauth", "governor", + "greptimedb-client-rust", "grok", "h2", "hash_hasher", diff --git a/Cargo.toml b/Cargo.toml index dc5cb31d6f06d..c4b1f6e8eb482 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -229,7 +229,7 @@ hex = { version = "0.4.3", default-features = false, optional = true } sha2 = { version = "0.10.6", default-features = false, optional = true } # Greptime -greptimedb-client = { git = "https://github.com/GreptimeTeam/greptimedb.git", rev = "b5e5f8e555065da0ba1d3f13b6b76fad59cb4017", package = "client", optional = true } +greptimedb-client = { git = "https://github.com/GreptimeTeam/greptimedb-client-rust.git", rev = "2b5d575fd4aaff2955b20e59e752e1eba71c4b75", package = "greptimedb-client-rust", optional = true } # VRL Lang vrl = { package = "vrl", git = "https://github.com/vectordotdev/vrl", rev = "v0.2.0" } diff --git a/sample.toml b/sample.toml deleted file mode 100644 index 2698544b5f99c..0000000000000 --- a/sample.toml +++ /dev/null @@ -1,19 +0,0 @@ -[sources.in] -type = "host_metrics" - -# [sources.prom] -# type = "prometheus_scrape" -# endpoints = [ "http://localhost:9100/metrics" ] - -[sinks.out] -inputs = ["in"] -type = "greptimedb" -endpoint = "localhost:4001" - -# [sinks.cloud] -# inputs = ["in"] -# type = "greptimedb" -# endpoint = "ri90pr79jvuf.test-ap-southeast-1.aws.greptime.cloud:4001" -# dbname = "rhe8afku6uws-test" -# username = "8eXxD6lHdbDYBVByQ0KjDsvp" -# password = "I7vppnCLFCaJevlGlf5dUBzX" diff --git a/src/sinks/greptimedb/client.rs b/src/sinks/greptimedb/client.rs index 0ae96bdb6b9f9..5c156ee3b34c5 100644 --- a/src/sinks/greptimedb/client.rs +++ b/src/sinks/greptimedb/client.rs @@ -267,7 +267,6 @@ fn encode_histogram(buckets: &[Bucket], columns: &mut Vec) { fn encode_quantiles(quantiles: &[Quantile], columns: &mut Vec) { for quantile in quantiles { let column_name = format!("p{:02}", quantile.quantile * 100f64); - dbg!(&column_name); columns.push(f64_field(&column_name, quantile.value)); } }