Skip to content

Commit 02b3ea2

Browse files
authored
feat: telemetry (risingwavelabs#7384)
1 parent 3d4bca7 commit 02b3ea2

File tree

38 files changed

+1458
-265
lines changed

38 files changed

+1458
-265
lines changed

Cargo.lock

Lines changed: 214 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ env_scripts = [
2222
'''
2323
#!@duckscript
2424
25+
set_env ENABLE_TELEMETRY "false"
26+
2527
is_sanitizer_enabled = get_env ENABLE_SANITIZER
2628
is_all_in_one_enabled = get_env ENABLE_ALL_IN_ONE
2729
is_hdfs_backend = get_env ENABLE_HDFS
@@ -164,7 +166,7 @@ script = '''
164166
#!/usr/bin/env bash
165167
set -e
166168
167-
if [[ -z "$1" ]]; then
169+
if [[ -z "$1" ]]; then
168170
echo "Please pass a parameter to this script, defining which logs you want to follow"
169171
echo "Available logs are..."
170172
ls ${PREFIX_LOG}
@@ -176,7 +178,7 @@ if [[ ! -f ${PREFIX_LOG}/$1 ]]; then
176178
echo "Available logs are..."
177179
ls ${PREFIX_LOG}
178180
exit 1
179-
fi
181+
fi
180182
181183
tail -f -n 5 ${PREFIX_LOG}/$1
182184
'''

ci/scripts/common.env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ export PROTOC_NO_VENDOR=true
33
export CARGO_HOME=/risingwave/.cargo
44
export RISINGWAVE_CI=true
55
export RUST_BACKTRACE=1
6+
export ENABLE_TELEMETRY=false
7+
68
if [ -n "${BUILDKITE_COMMIT:-}" ]; then
79
export GIT_SHA=$BUILDKITE_COMMIT
810
fi

dashboard/proto/gen/meta.ts

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration_tests/scripts/run_demos.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def run_demo(demo: str, format: str):
2525
demo_dir = os.path.join(project_dir, demo)
2626
print("Running demo: {}".format(demo))
2727

28-
subprocess.run(["docker", "compose", "up", "-d"],
29-
cwd=demo_dir, check=True)
28+
subprocess.run(["docker", "compose", "up", "-d", "-e",
29+
"ENABLE_TELEMETRY=false"], cwd=demo_dir, check=True)
3030
sleep(40)
3131

3232
sql_files = ['create_source.sql', 'create_mv.sql', 'query.sql']
@@ -50,8 +50,7 @@ def run_iceberg_demo():
5050
demo_dir = os.path.join(project_dir, demo)
5151
print("Running demo: iceberg-sink")
5252

53-
subprocess.run(["docker", "compose", "up", "-d"],
54-
cwd=demo_dir, check=True)
53+
subprocess.run(["docker", "compose", "up", "-d", "-e", "ENABLE_TELEMETRY=false"], cwd=demo_dir, check=True)
5554
sleep(40)
5655

5756
subprocess.run(["docker", "compose", "exec", "spark", "bash", "/spark-script/run-sql-file.sh", "create-table"],

proto/meta.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ import "user.proto";
1313
option java_package = "com.risingwave.proto";
1414
option optimize_for = SPEED;
1515

16+
message GetTelemetryInfoRequest {}
17+
18+
message TelemetryInfoResponse {
19+
optional string tracking_id = 1;
20+
}
21+
22+
service TelemetryInfoService {
23+
// Request telemetry info from meta node
24+
rpc GetTelemetryInfo(GetTelemetryInfoRequest) returns (TelemetryInfoResponse);
25+
}
26+
1627
message HeartbeatRequest {
1728
message ExtraInfo {
1829
oneof info {
@@ -344,6 +355,7 @@ message SystemParams {
344355
optional string data_directory = 7;
345356
optional string backup_storage_url = 8;
346357
optional string backup_storage_directory = 9;
358+
optional bool telemetry_enabled = 10;
347359
}
348360

349361
message GetSystemParamsRequest {}

src/common/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ prometheus = { version = "0.13" }
5656
prost = "0.11"
5757
rand = "0.8"
5858
regex = "1"
59+
reqwest = { version = "0.11", features = ["json"] }
5960
risingwave_pb = { path = "../prost" }
6061
rust_decimal = { version = "1", features = ["db-tokio-postgres"] }
6162
ryu = "1.0"
@@ -78,6 +79,7 @@ toml = "0.5"
7879
tonic = { version = "0.2", package = "madsim-tonic" }
7980
tracing = "0.1"
8081
url = "2"
82+
uuid = "1.2.2"
8183

8284
[target.'cfg(not(madsim))'.dependencies]
8385
workspace-hack = { path = "../workspace-hack" }

src/common/src/config.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ pub struct ServerConfig {
222222
/// >0 = open metrics
223223
pub metrics_level: u32,
224224

225+
#[serde(default = "default::server::telemetry_enabled")]
226+
pub telemetry_enabled: bool,
227+
225228
#[serde(flatten)]
226229
pub unrecognized: HashMap<String, Value>,
227230
}
@@ -498,6 +501,9 @@ pub struct SystemConfig {
498501
/// Remote directory for storing snapshots.
499502
#[serde(default = "default::system::backup_storage_directory")]
500503
pub backup_storage_directory: String,
504+
505+
#[serde(default = "default::system::telemetry_enabled")]
506+
pub telemetry_enabled: bool,
501507
}
502508

503509
impl Default for SystemConfig {
@@ -518,6 +524,7 @@ impl SystemConfig {
518524
data_directory: Some(self.data_directory),
519525
backup_storage_url: Some(self.backup_storage_url),
520526
backup_storage_directory: Some(self.backup_storage_directory),
527+
telemetry_enabled: Some(self.telemetry_enabled),
521528
}
522529
}
523530
}
@@ -588,6 +595,10 @@ mod default {
588595
pub fn metrics_level() -> u32 {
589596
0
590597
}
598+
599+
pub fn telemetry_enabled() -> bool {
600+
true
601+
}
591602
}
592603

593604
pub mod storage {
@@ -776,5 +787,9 @@ mod default {
776787
pub fn backup_storage_directory() -> String {
777788
system_param::default::backup_storage_directory()
778789
}
790+
791+
pub fn telemetry_enabled() -> bool {
792+
system_param::default::telemetry_enabled()
793+
}
779794
}
780795
}

src/common/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ pub mod monitor;
5454
pub mod row;
5555
pub mod session_config;
5656
pub mod system_param;
57+
pub mod telemetry;
58+
5759
#[cfg(test)]
5860
pub mod test_utils;
5961
pub mod types;

src/common/src/system_param/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ macro_rules! for_all_undeprecated_params {
4242
{ data_directory, String, "hummock_001".to_string() },
4343
{ backup_storage_url, String, "memory".to_string() },
4444
{ backup_storage_directory, String, "backup".to_string() },
45+
{ telemetry_enabled, bool, true},
4546
$({ $field, $type, $default },)*
4647
}
4748
};
@@ -291,6 +292,10 @@ impl ValidateOnSet for OverrideValidateOnSet {
291292
// TODO
292293
Ok(())
293294
}
295+
296+
fn telemetry_enabled(_: &bool) -> Result<()> {
297+
Ok(())
298+
}
294299
}
295300

296301
for_all_undeprecated_params!(impl_default_from_other_params);
@@ -315,6 +320,7 @@ mod tests {
315320
(DATA_DIRECTORY_KEY, "a"),
316321
(BACKUP_STORAGE_URL_KEY, "a"),
317322
(BACKUP_STORAGE_DIRECTORY_KEY, "a"),
323+
(TELEMETRY_ENABLED_KEY, "false"),
318324
];
319325

320326
// To kv - missing field.

src/common/src/system_param/reader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ impl SystemParamsReader {
7676
self.prost.backup_storage_directory.as_ref().unwrap()
7777
}
7878

79+
pub fn telemetry_enabled(&self) -> bool {
80+
self.prost.telemetry_enabled.unwrap()
81+
}
82+
7983
pub fn to_kv(&self) -> Vec<(String, String)> {
8084
system_params_to_kv(&self.prost).unwrap()
8185
}

0 commit comments

Comments
 (0)