From 0e4bd59fac0018d116c1a4a4dcb6a1d8635272f9 Mon Sep 17 00:00:00 2001 From: ozewr <94829827+ozewr@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:09:39 +0800 Subject: [PATCH] build: Update Loki proto (#5484) * build: mv loki-api to loki-proto * fmt: fmt toml * fix: loki-proto using rev --------- Co-authored-by: wangrui --- Cargo.lock | 22 ++++++++++++---------- Cargo.toml | 2 +- src/servers/Cargo.toml | 2 +- src/servers/src/http/loki.rs | 6 +++--- tests-integration/Cargo.toml | 2 +- tests-integration/tests/http.rs | 8 ++++++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e374f8b6e..3398cdcc1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1053,7 +1053,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.11.0", "proc-macro2", "quote", "regex", @@ -6128,7 +6128,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -6264,12 +6264,14 @@ dependencies = [ ] [[package]] -name = "loki-api" -version = "0.1.2" -source = "git+https://github.com/shuiyisong/tracing-loki?branch=chore%2Fprost_version#ad135292a77b6ce638d126571804c19fdaa36215" +name = "loki-proto" +version = "0.1.0" +source = "git+https://github.com/GreptimeTeam/loki-proto.git?rev=1434ecf23a2654025d86188fb5205e7a74b225d3#1434ecf23a2654025d86188fb5205e7a74b225d3" dependencies = [ "prost 0.13.3", "prost-types 0.13.3", + "tonic 0.12.3", + "tonic-build 0.12.3", ] [[package]] @@ -8741,7 +8743,7 @@ checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.13.0", + "itertools 0.11.0", "log", "multimap", "once_cell", @@ -8787,7 +8789,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.90", @@ -10400,7 +10402,7 @@ dependencies = [ "lazy_static", "local-ip-address", "log-query", - "loki-api", + "loki-proto", "mime_guess", "mysql_async", "notify", @@ -11773,7 +11775,7 @@ dependencies = [ "hyper-util", "itertools 0.10.5", "log-query", - "loki-api", + "loki-proto", "meta-client", "meta-srv", "moka", @@ -13248,7 +13250,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index de50b357a3..3c03169309 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -138,7 +138,7 @@ itertools = "0.10" jsonb = { git = "https://github.com/databendlabs/jsonb.git", rev = "8c8d2fc294a39f3ff08909d60f718639cfba3875", default-features = false } lazy_static = "1.4" local-ip-address = "0.6" -loki-api = { git = "https://github.com/shuiyisong/tracing-loki", branch = "chore/prost_version" } +loki-proto = { git = "https://github.com/GreptimeTeam/loki-proto.git", rev = "1434ecf23a2654025d86188fb5205e7a74b225d3" } meter-core = { git = "https://github.com/GreptimeTeam/greptime-meter.git", rev = "5618e779cf2bb4755b499c630fba4c35e91898cb" } mockall = "0.11.4" moka = "0.12" diff --git a/src/servers/Cargo.toml b/src/servers/Cargo.toml index 74b3781f64..6ac32cff13 100644 --- a/src/servers/Cargo.toml +++ b/src/servers/Cargo.toml @@ -70,7 +70,7 @@ itertools.workspace = true jsonb.workspace = true lazy_static.workspace = true log-query.workspace = true -loki-api.workspace = true +loki-proto.workspace = true mime_guess = "2.0" notify.workspace = true object-pool = "0.5" diff --git a/src/servers/src/http/loki.rs b/src/servers/src/http/loki.rs index 219db16986..0315c318a7 100644 --- a/src/servers/src/http/loki.rs +++ b/src/servers/src/http/loki.rs @@ -31,7 +31,7 @@ use common_telemetry::{error, warn}; use hashbrown::HashMap; use headers::ContentType; use lazy_static::lazy_static; -use loki_api::prost_types::Timestamp; +use loki_proto::prost_types::Timestamp; use prost::Message; use quoted_string::test_utils::TestSpec; use session::context::{Channel, QueryContext}; @@ -241,7 +241,7 @@ async fn handle_pb_req( schemas: &mut Vec, ) -> Result>> { let decompressed = prom_store::snappy_decompress(&bytes).unwrap(); - let req = loki_api::logproto::PushRequest::decode(&decompressed[..]) + let req = loki_proto::logproto::PushRequest::decode(&decompressed[..]) .context(DecodeOtlpRequestSnafu)?; let mut column_indexer: HashMap = HashMap::new(); @@ -435,7 +435,7 @@ macro_rules! unwrap_or_warn_continue { mod tests { use std::collections::BTreeMap; - use loki_api::prost_types::Timestamp; + use loki_proto::prost_types::Timestamp; use crate::error::Error::InvalidLokiLabels; use crate::http::loki::{parse_loki_labels, prost_ts_to_nano}; diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml index 3ededb0769..32c220b75b 100644 --- a/tests-integration/Cargo.toml +++ b/tests-integration/Cargo.toml @@ -47,7 +47,7 @@ futures.workspace = true futures-util.workspace = true hyper-util = { workspace = true, features = ["tokio"] } log-query = { workspace = true } -loki-api.workspace = true +loki-proto.workspace = true meta-client.workspace = true meta-srv = { workspace = true, features = ["mock"] } moka.workspace = true diff --git a/tests-integration/tests/http.rs b/tests-integration/tests/http.rs index 81b31fe767..f60fa3a35a 100644 --- a/tests-integration/tests/http.rs +++ b/tests-integration/tests/http.rs @@ -23,8 +23,8 @@ use common_error::status_code::StatusCode as ErrorCode; use flate2::write::GzEncoder; use flate2::Compression; use log_query::{Context, Limit, LogQuery, TimeFilter}; -use loki_api::logproto::{EntryAdapter, PushRequest, StreamAdapter}; -use loki_api::prost_types::Timestamp; +use loki_proto::logproto::{EntryAdapter, PushRequest, StreamAdapter}; +use loki_proto::prost_types::Timestamp; use opentelemetry_proto::tonic::collector::logs::v1::ExportLogsServiceRequest; use opentelemetry_proto::tonic::collector::metrics::v1::ExportMetricsServiceRequest; use opentelemetry_proto::tonic::collector::trace::v1::ExportTraceServiceRequest; @@ -2027,10 +2027,14 @@ pub async fn test_loki_pb_logs(store_type: StorageType) { EntryAdapter { timestamp: Some(Timestamp::from_str("2024-11-07T10:53:50").unwrap()), line: "this is a log message".to_string(), + structured_metadata: vec![], + parsed: vec![], }, EntryAdapter { timestamp: Some(Timestamp::from_str("2024-11-07T10:53:50").unwrap()), line: "this is a log message".to_string(), + structured_metadata: vec![], + parsed: vec![], }, ], hash: rand::random(),