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

[PLATFORM-1399]: Update otel deps #83

Merged
merged 4 commits into from
Nov 30, 2023
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
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- New `opentelemetry_sdk` dependency, which inherits the `rt-tokio` feature

### Changed

- Bump `opentelemetry` to 0.21 and remove the `rt-tokio` feature
- Bump `opentelemetry-otlp` to 0.14
- Bump `tracing-opentelemetry` to 0.22
- Move `rt-tokio-current-thread` to map to `["opentelemetry_sdk/rt-tokio-current-thread"]`, the tokio stuff has been moved to `opentelemetry_sdk`

---

## [0.7.2] - 2023-10-26

### Changed

- Bump `tracing-log` to 0.2

---
Expand Down Expand Up @@ -102,7 +115,6 @@ If you are using Jaeger to collect traces locally on your machine, you will need
COLLECTOR_OTLP_HTTP_HOST_PORT: 55681
```


[Unreleased]: https://github.com/primait/prima_tracing.rs/compare/0.7.2...HEAD
[0.7.2]: https://github.com/primait/prima_tracing.rs/compare/0.7.1...0.7.2
[0.7.1]: https://github.com/primait/prima_tracing.rs/compare/0.7.0...0.7.1
Expand Down
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ traces = ["tracing-opentelemetry", "opentelemetry", "opentelemetry-otlp"]
dev = ["traces"]
live = ["json-logger", "datadog", "traces"]

rt-tokio-current-thread = ["opentelemetry/rt-tokio-current-thread"]
rt-tokio-current-thread = ["opentelemetry_sdk/rt-tokio-current-thread"]

[[example]]
name = "custom-json-subscriber"
Expand All @@ -37,11 +37,12 @@ required-features = ["json-logger"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
opentelemetry = {version = "0.20", features = ["rt-tokio"], optional = true}
opentelemetry-otlp = {version = "0.13", features = ["http-proto", "reqwest-client"], default-features = false, optional = true}
opentelemetry = {version = "0.21", optional = true}
opentelemetry-otlp = {version = "0.14", features = ["http-proto", "reqwest-client"], default-features = false, optional = true}
opentelemetry_sdk = {version = "0.21", features = ["rt-tokio"], optional = true}
tracing = {version = "0.1", features = ["max_level_debug", "release_max_level_info"]}
tracing-log = {version = "0.2"}
tracing-opentelemetry = {version = "0.21", optional = true}
tracing-opentelemetry = {version = "0.22", optional = true}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly worried about this being 0.22, while the other otel libraries are 0.21, are you sure these are compatible?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracing-opentelemetry 0.22 has "opentelemetry 0.21.0" in its deps (that is a bit nonsense)

Copy link
Contributor

@cottinisimone cottinisimone Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One attention point could be prima_bridge and tracing-actix-web that both still have tracing-opentelemetry 0.21.0 (that carries opentelemetry 0.20.0)

Edit: but they are in the dev-dependencies.. So not an issue i guess

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice this, thanks! tracing-actix-web we can easily be bumped, prima_bridge (bridge.rs?) cannot and I don't like having incompatible deps but it's used in an example...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I guess it's fine this way and we can think about updating bridge.rs otel deps later on

tracing-subscriber = {version = "0.3", features = ["env-filter"]}

# serialization/deserialization
Expand All @@ -56,4 +57,4 @@ chrono = {version = "^0.4", default-features = false, features = ["serde", "cloc
actix-web = "4.0.1"
prima_bridge = "0.15"
tokio = {version = "1.17", features = ["rt", "macros", "rt-multi-thread"]}
tracing-actix-web = {version = "0.7.0", features = ["opentelemetry_0_20"]}
tracing-actix-web = {version = "0.7.0", features = ["opentelemetry_0_21"]}
3 changes: 2 additions & 1 deletion src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ pub fn init_subscriber(subscriber: impl Subscriber + Sync + Send) -> Uninstall {

#[cfg(feature = "traces")]
{
use opentelemetry::{global, sdk::propagation::TraceContextPropagator};
use opentelemetry::global;
use opentelemetry_sdk::propagation::TraceContextPropagator;
global::set_text_map_propagator(TraceContextPropagator::new());
};
Uninstall
Expand Down
16 changes: 7 additions & 9 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use opentelemetry::{
sdk::{
trace::{self, Tracer},
Resource,
},
KeyValue,
};
use opentelemetry::KeyValue;
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{
trace::{self, Tracer},
Resource,
};
use tracing::{span, Subscriber};
use tracing_opentelemetry::OtelData;
use tracing_subscriber::{layer::Context, Layer};
Expand All @@ -21,11 +19,11 @@ pub fn configure<T>(config: &SubscriberConfig<T>) -> Tracer {
let runtime = {
#[cfg(feature = "rt-tokio-current-thread")]
{
opentelemetry::runtime::TokioCurrentThread
opentelemetry_sdk::runtime::TokioCurrentThread
}
#[cfg(not(feature = "rt-tokio-current-thread"))]
{
opentelemetry::runtime::Tokio
opentelemetry_sdk::runtime::Tokio
}
};

Expand Down