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

Bump the otel group across 1 directory with 4 updates #111

Merged
merged 7 commits into from
Jul 24, 2024
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
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ and this project adheres to

---

## [0.11.0] - 2024-07-24

### Updated

- Bumped opentelemetry version to 0.24

---

## [0.10.0] - 2024-07-08

--
Expand Down Expand Up @@ -222,7 +230,9 @@ jaeger:
```


[Unreleased]: https://github.com/primait/prima_tracing.rs/compare/0.10.0...HEAD

[Unreleased]: https://github.com/primait/prima_tracing.rs/compare/0.11.0...HEAD
[0.11.0]: https://github.com/primait/prima_tracing.rs/compare/0.10.0...0.11.0
[0.10.0]: https://github.com/primait/prima_tracing.rs/compare/0.9.5...0.10.0
[0.9.4]: https://github.com/primait/prima_tracing.rs/compare/0.9.3...0.9.4
[0.9.3]: https://github.com/primait/prima_tracing.rs/compare/0.9.2...0.9.3
Expand Down
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
name = "prima-tracing"
readme = "README.md"
repository = "https://github.com/primait/prima_tracing.rs"
version = "0.10.0"
version = "0.11.0"

[features]
default = []
Expand Down Expand Up @@ -37,12 +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.23", optional = true}
opentelemetry-otlp = {version = "0.16", features = ["http-proto", "reqwest-client"], default-features = false, optional = true}
opentelemetry_sdk = {version = "0.23", features = ["rt-tokio"], optional = true}
opentelemetry = {version = "0.24", optional = true}
opentelemetry-otlp = {version = "0.17", features = ["http-proto", "reqwest-client"], default-features = false, optional = true}
opentelemetry_sdk = {version = "0.24", 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.24", optional = true}
tracing-opentelemetry = {version = "0.25", optional = true}
tracing-subscriber = {version = "0.3", features = ["env-filter"]}

# serialization/deserialization
Expand All @@ -60,3 +60,4 @@ opentelemetry-jaeger = {version = "0.22", features = ["integration_test"]}
prima_bridge = "0.16"
tokio = {version = "1.17", features = ["rt", "macros", "rt-multi-thread"]}
tracing-actix-web = {version = "0.7.11", features = ["opentelemetry_0_23"]}
uuid = {version = "1.10", features = ["v4"]}
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
app:
user: root
Expand Down Expand Up @@ -27,6 +25,7 @@ services:
jaeger:
image: jaegertracing/all-in-one:1.35
ports:
- "16685:16685"
- "16686:16686"
- "55681:55681"
environment:
Expand Down
15 changes: 12 additions & 3 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use opentelemetry::global;
use opentelemetry::trace::TracerProvider;
use opentelemetry::KeyValue;
use opentelemetry_otlp::WithExportConfig;
use opentelemetry_sdk::{
Expand Down Expand Up @@ -55,12 +57,19 @@ pub fn configure<T>(config: &SubscriberConfig<T>) -> Tracer {
KeyValue::new("service.name", telemetry.service_name.clone()),
]);

opentelemetry_otlp::new_pipeline()
let tracer_provider = opentelemetry_otlp::new_pipeline()
.tracing()
.with_exporter(otlp_exporter)
.with_trace_config(trace::config().with_resource(resource))
.with_trace_config(trace::Config::default().with_resource(resource))
.install_batch(runtime)
.expect("Failed to configure the OpenTelemetry tracer")
.expect("Failed to configure the OpenTelemetry tracer provider");

global::set_tracer_provider(tracer_provider.clone());

tracer_provider
.tracer_builder("prima-tracing")
.with_version(env!("CARGO_PKG_VERSION"))
.build()
}

#[cfg(test)]
Expand Down
8 changes: 6 additions & 2 deletions tests/e2e/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async fn get_spans(f: impl FnOnce(), collector_url: &str) -> Option<Vec<Span>> {
std::env::set_var("RUST_LOG", "info");

// Unique id for this test run
let seed = std::fs::read_to_string("/proc/sys/kernel/random/uuid").unwrap();
let seed = uuid::Uuid::new_v4();
let service_name = format!("e2e-test-{seed}");

let query_api_url = "http://jaeger:16685/";
Expand All @@ -27,6 +27,8 @@ async fn get_spans(f: impl FnOnce(), collector_url: &str) -> Option<Vec<Span>> {
f()
}

std::thread::sleep(std::time::Duration::from_secs(10));

let mut client = JaegerTestClient::new(query_api_url);

if !client.contain_service(&service_name).await {
Expand Down Expand Up @@ -125,7 +127,7 @@ async fn error_layer_enrich_errored_spans() {
std::env::set_var("RUST_LOG", "info");

// Unique id for this test run
let seed = std::fs::read_to_string("/proc/sys/kernel/random/uuid").unwrap();
let seed = uuid::Uuid::new_v4();
let service_name = format!("e2e-test-{seed}");

let query_api_url = "http://jaeger:16685/";
Expand All @@ -152,6 +154,8 @@ async fn error_layer_enrich_errored_spans() {
});
};

std::thread::sleep(std::time::Duration::from_secs(10));

let mut client = JaegerTestClient::new(query_api_url);

let spans = if !client.contain_service(&service_name).await {
Expand Down