opentelemetry-rust icon indicating copy to clipboard operation
opentelemetry-rust copied to clipboard

[Feature]: support for esp32 / 32 bit applications

Open gb6881 opened this issue 1 year ago • 4 comments

Related Problems?

i wanted to use opentelemetry on a ESP32, but the sdk won't compile

  --> /Users/gb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opentelemetry_sdk-0.27.1/src/metrics/internal/mod.rs:12:37
   |
12 | use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, AtomicUsize, Ordering};
   |                                     ^^^^^^^^^  ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
   |                                     |
   |                                     no `AtomicI64` in `sync::atomic`
   |
help: a similar name exists in the module
   |
12 | use std::sync::atomic::{AtomicBool, AtomicI32, AtomicU64, AtomicUsize, Ordering};
   |                                     ~~~~~~~~~
help: a similar name exists in the module
   |
12 | use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU32, AtomicUsize, Ordering};

Describe the solution you'd like:

it would be great to be able to use it :)

Considered Alternatives

No response

Additional Context

No response

gb6881 avatar Dec 12 '24 09:12 gb6881

@gb6881 Can you check if #2301 fixes the issue?

lalitb avatar Dec 12 '24 09:12 lalitb

that was quick :)

if i add target_arch = "xtensa" to the preprocesor instructions that seems to work for me

From d93d254dec0a4d2e83fab73819c1972df5f39eaf Mon Sep 17 00:00:00 2001
Date: Thu, 12 Dec 2024 11:02:44 +0100
Subject: [PATCH] support xtensa as well

---
 opentelemetry-sdk/Cargo.toml                  | 2 +-
 opentelemetry-sdk/src/metrics/internal/mod.rs | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/opentelemetry-sdk/Cargo.toml b/opentelemetry-sdk/Cargo.toml
index 602860e5..88345fb7 100644
--- a/opentelemetry-sdk/Cargo.toml
+++ b/opentelemetry-sdk/Cargo.toml
@@ -30,7 +30,7 @@ tokio-stream = { workspace = true, optional = true }
 http = { workspace = true, optional = true }
 tracing = {workspace = true, optional = true}

-[target.'cfg(any(target_arch = "powerpc", target_arch = "mips"))'.dependencies]
+[target.'cfg(any(target_arch = "powerpc", target_arch = "mips", target_arch = "xtensa"))'.dependencies]
 portable-atomic = {workspace = true}

 [package.metadata.docs.rs]
diff --git a/opentelemetry-sdk/src/metrics/internal/mod.rs b/opentelemetry-sdk/src/metrics/internal/mod.rs
index 1bc260f7..da0f66fb 100644
--- a/opentelemetry-sdk/src/metrics/internal/mod.rs
+++ b/opentelemetry-sdk/src/metrics/internal/mod.rs
@@ -18,10 +18,10 @@ pub(crate) use exponential_histogram::{EXPO_MAX_SCALE, EXPO_MIN_SCALE};
 use once_cell::sync::Lazy;
 use opentelemetry::{otel_warn, KeyValue};

-#[cfg(any(target_arch = "mips", target_arch = "powerpc"))]
+#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa"))]
 use portable_atomic::{AtomicBool, AtomicI64, AtomicU64, AtomicUsize};

-#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
+#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa")))]
 use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, AtomicUsize};

 use crate::metrics::AttributeSet;
--
2.47.1

gb6881 avatar Dec 12 '24 09:12 gb6881

any update about this issue?

brunobrolesi avatar Jan 25 '25 23:01 brunobrolesi

Looks like #2773 should fix this but has stalled in the PR process

scottgerring avatar Nov 11 '25 11:11 scottgerring