Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: disable local IP detection feature in Android binary #5327

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/meta-srv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/meta-srv/src/metasrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/servers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions src/servers/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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";
Expand Down
Loading