Skip to content

Commit 4878672

Browse files
committed
Add telemetry
This is an experimental feature. To try it: ```sh docker run -p4317:4317 -p16686:16686 jaegertracing/all-in-one ``` and run Icechunk setting an env variable such as ```sh ICECHUNK_TELEMETRY_ENDPOINT=http://localhost:431 ``` Then navigate to `http://192.168.122.213:16686/`
1 parent c9e1aba commit 4878672

File tree

5 files changed

+320
-12
lines changed

5 files changed

+320
-12
lines changed

Cargo.lock

Lines changed: 225 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

icechunk-python/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use conflicts::{
2525
PyConflictType, PyVersionSelection,
2626
};
2727
use errors::{IcechunkError, PyConflictError, PyRebaseFailedError};
28+
use icechunk::TelemetryConfig;
2829
use icechunk::{format::format_constants::SpecVersionBin, initialize_tracing};
2930
use pyo3::prelude::*;
3031
use pyo3::wrap_pyfunction;
@@ -72,7 +73,13 @@ fn cli_entrypoint(_py: Python) -> PyResult<()> {
7273
#[pyfunction]
7374
fn initialize_logs() -> PyResult<()> {
7475
if env::var("ICECHUNK_NO_LOGS").is_err() {
75-
initialize_tracing()
76+
let logs_config = Default::default();
77+
let telemetry = env::var("ICECHUNK_TELEMETRY_ENDPOINT")
78+
.map(|endpoint| TelemetryConfig { endpoint, ..Default::default() })
79+
.ok();
80+
pyo3_async_runtimes::tokio::get_runtime().block_on(async move {
81+
initialize_tracing(Some(&logs_config), telemetry.as_ref()).await;
82+
});
7683
}
7784
Ok(())
7885
}

icechunk/Cargo.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ dirs = { version = "6.0.0", optional = true }
6363
assert_fs = { version = "1.1.3", optional = true }
6464
flatbuffers = "25.2.10"
6565

66+
opentelemetry = { version = "0.29.0", optional = true }
67+
opentelemetry_sdk = { version = "0.29.0", optional = true }
68+
tracing-opentelemetry = { version = "0.30.0", optional = true }
69+
opentelemetry-otlp = { version = "0.29.0", features = [
70+
"grpc-tonic",
71+
"tonic",
72+
], optional = true }
73+
6674
[dev-dependencies]
6775
icechunk-macros = { path = "../icechunk-macros", version = "0.1.0" }
6876
pretty_assertions = "1.4.1"
@@ -78,7 +86,13 @@ test-log = { version = "0.2.17", default-features = false, features = [
7886
workspace = true
7987

8088
[features]
81-
logs = ["dep:tracing-subscriber"]
89+
logs = [
90+
"dep:tracing-subscriber",
91+
"dep:opentelemetry",
92+
"dep:opentelemetry_sdk",
93+
"dep:opentelemetry-otlp",
94+
"dep:tracing-opentelemetry",
95+
]
8296
cli = ["dep:clap", "dep:anyhow", "dep:dialoguer", "dep:dirs", "dep:assert_fs"]
8397

8498
[[bin]]

icechunk/src/config.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,3 +583,26 @@ pub enum Credentials {
583583
Gcs(GcsCredentials),
584584
Azure(AzureCredentials),
585585
}
586+
587+
#[derive(Clone, Debug)]
588+
pub struct TelemetryConfig {
589+
pub endpoint: String,
590+
pub tracer_name: String,
591+
}
592+
593+
impl Default for TelemetryConfig {
594+
fn default() -> Self {
595+
Self { endpoint: "localhost".to_string(), tracer_name: "icechunk".to_string() }
596+
}
597+
}
598+
599+
#[derive(Clone, Debug)]
600+
pub struct LogsConfig {
601+
pub env_var_name: String,
602+
}
603+
604+
impl Default for LogsConfig {
605+
fn default() -> Self {
606+
Self { env_var_name: "ICECHUNK_LOG".to_string() }
607+
}
608+
}

0 commit comments

Comments
 (0)