diff --git a/src/meta-srv/Cargo.toml b/src/meta-srv/Cargo.toml index 4804b3ba71..d875095f75 100644 --- a/src/meta-srv/Cargo.toml +++ b/src/meta-srv/Cargo.toml @@ -11,6 +11,9 @@ pg_kvbackend = ["dep:tokio-postgres", "common-meta/pg_kvbackend"] [lints] workspace = true +[target.'cfg(not(target_os = "android"))'.dependencies] +local-ip-address.workspace = true + [dependencies] api.workspace = true async-trait = "0.1" @@ -45,7 +48,6 @@ humantime.workspace = true humantime-serde.workspace = true itertools.workspace = true lazy_static.workspace = true -local-ip-address.workspace = true once_cell.workspace = true parking_lot.workspace = true prometheus.workspace = true diff --git a/src/meta-srv/src/metasrv.rs b/src/meta-srv/src/metasrv.rs index 029b049d68..092b6a3359 100644 --- a/src/meta-srv/src/metasrv.rs +++ b/src/meta-srv/src/metasrv.rs @@ -204,6 +204,7 @@ impl Configurable for MetasrvOptions { impl MetasrvOptions { /// Detect server address if `auto_server_addr` is true. + #[cfg(not(target_os = "android"))] pub fn detect_server_addr(&mut self) { if self.server_addr.is_empty() { match local_ip_address::local_ip() { @@ -225,6 +226,13 @@ impl MetasrvOptions { } } } + + #[cfg(target_os = "android")] + pub fn detect_hostname(&mut self) { + if self.server_addr.is_empty() { + common_telemetry::debug!("detect local IP is not supported on Android"); + } + } } pub struct MetasrvInfo { diff --git a/src/servers/Cargo.toml b/src/servers/Cargo.toml index 2013b6e1e6..bc1992ddee 100644 --- a/src/servers/Cargo.toml +++ b/src/servers/Cargo.toml @@ -14,6 +14,9 @@ testing = [] [lints] workspace = true +[target.'cfg(not(target_os = "android"))'.dependencies] +local-ip-address.workspace = true + [dependencies] ahash = "0.8" api.workspace = true @@ -65,7 +68,6 @@ influxdb_line_protocol = { git = "https://github.com/evenyag/influxdb_iox", bran itertools.workspace = true jsonb.workspace = true lazy_static.workspace = true -local-ip-address.workspace = true log-query.workspace = true loki-api = "0.1" mime_guess = "2.0" diff --git a/src/servers/src/grpc.rs b/src/servers/src/grpc.rs index 8225f7cd8c..795884d492 100644 --- a/src/servers/src/grpc.rs +++ b/src/servers/src/grpc.rs @@ -67,6 +67,7 @@ pub struct GrpcOptions { impl GrpcOptions { /// Detect hostname if `auto_hostname` is true. + #[cfg(not(target_os = "android"))] pub fn detect_hostname(&mut self) { if self.hostname.is_empty() { match local_ip_address::local_ip() { @@ -88,6 +89,13 @@ impl GrpcOptions { } } } + + #[cfg(target_os = "android")] + pub fn detect_hostname(&mut self) { + if self.hostname.is_empty() { + common_telemetry::debug!("detect local IP is not supported on Android"); + } + } } const DEFAULT_GRPC_ADDR_PORT: &str = "4001";