Skip to content

Commit

Permalink
Bump opentelemetry to 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Nov 25, 2024
1 parent a98c67c commit 11790d7
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/grpc/helloworld_compressed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
poem-grpc-build.workspace = true

[[bin]]
name = "grpc-helloworld-client"
name = "grpc-helloworld-compressed-client"
path = "src/client.rs"
8 changes: 4 additions & 4 deletions examples/poem/opentelemetry-jaeger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ publish.workspace = true
poem = { workspace = true, features = ["opentelemetry"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tracing-subscriber.workspace = true
opentelemetry = { version = "0.24.0", features = ["metrics"] }
opentelemetry_sdk = { version = "0.24.1", features = ["rt-tokio"] }
opentelemetry-http = { version = "0.13.0" }
opentelemetry-otlp = { version = "0.17.0", features = ["trace"] }
opentelemetry = { version = "0.27.0", features = ["metrics"] }
opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio"] }
opentelemetry-http = { version = "0.27.0" }
opentelemetry-otlp = { version = "0.27.0", features = ["trace"] }
reqwest = "0.12"

[[bin]]
Expand Down
22 changes: 9 additions & 13 deletions examples/poem/opentelemetry-jaeger/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ use opentelemetry::{
Context, KeyValue,
};
use opentelemetry_http::HeaderInjector;
use opentelemetry_sdk::{
propagation::TraceContextPropagator,
trace::{Config, TracerProvider},
Resource,
};
use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::TracerProvider};
use reqwest::{Client, Method, Url};

fn init_tracer() -> TracerProvider {
global::set_text_map_propagator(TraceContextPropagator::new());
opentelemetry_otlp::new_pipeline()
.tracing()
.with_trace_config(
Config::default()
.with_resource(Resource::new(vec![KeyValue::new("service.name", "poem")])),
opentelemetry_sdk::trace::TracerProvider::builder()
.with_batch_exporter(
opentelemetry_otlp::SpanExporter::builder()
.with_tonic()
.build()
.expect("Trace exporter should initialize."),
opentelemetry_sdk::runtime::Tokio,
)
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("Trace Pipeline should initialize.")
.build()
}

#[tokio::main]
Expand Down
16 changes: 10 additions & 6 deletions examples/poem/opentelemetry-jaeger/src/server1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ use reqwest::{Client, Url};

fn init_tracer() -> TracerProvider {
global::set_text_map_propagator(TraceContextPropagator::new());
opentelemetry_otlp::new_pipeline()
.tracing()
.with_trace_config(
opentelemetry_sdk::trace::TracerProvider::builder()
.with_config(
Config::default().with_resource(Resource::new(vec![KeyValue::new(
"service.name",
"server1",
)])),
)
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("Trace Pipeline should initialize.")
.with_batch_exporter(
opentelemetry_otlp::SpanExporter::builder()
.with_tonic()
.build()
.expect("Trace exporter should initialize."),
opentelemetry_sdk::runtime::Tokio,
)
.build()
}

#[handler]
Expand Down
16 changes: 10 additions & 6 deletions examples/poem/opentelemetry-jaeger/src/server2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@ use poem::{

fn init_tracer() -> TracerProvider {
global::set_text_map_propagator(TraceContextPropagator::new());
opentelemetry_otlp::new_pipeline()
.tracing()
.with_trace_config(
opentelemetry_sdk::trace::TracerProvider::builder()
.with_config(
Config::default().with_resource(Resource::new(vec![KeyValue::new(
"service.name",
"server2",
)])),
)
.with_exporter(opentelemetry_otlp::new_exporter().tonic())
.install_batch(opentelemetry_sdk::runtime::Tokio)
.expect("Trace Pipeline should initialize.")
.with_batch_exporter(
opentelemetry_otlp::SpanExporter::builder()
.with_tonic()
.build()
.expect("Trace exporter should initialize."),
opentelemetry_sdk::runtime::Tokio,
)
.build()
}

#[handler]
Expand Down
4 changes: 4 additions & 0 deletions poem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [3.1.5] 2024-11-25

- Bump `opentelemetry` to `0.27.0`

# [3.1.4] 2024-11-20

- Add `Server::http2_max_header_list_size` method to set the max size of received header frames.
Expand Down
6 changes: 3 additions & 3 deletions poem/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem"
version = "3.1.4"
version = "3.1.5"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down Expand Up @@ -130,11 +130,11 @@ libcookie = { package = "cookie", version = "0.18", features = [
"key-expansion",
"secure",
], optional = true }
opentelemetry-http = { version = "0.13.0", optional = true }
opentelemetry-http = { version = "0.27.0", optional = true }
opentelemetry-semantic-conventions = { version = "0.16.0", optional = true }
opentelemetry-prometheus = { version = "0.17.0", optional = true }
libprometheus = { package = "prometheus", version = "0.13.0", optional = true }
libopentelemetry = { package = "opentelemetry", version = "0.24.0", features = [
libopentelemetry = { package = "opentelemetry", version = "0.27.0", features = [
"metrics",
], optional = true }
libtempfile = { package = "tempfile", version = "3.2.0", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions poem/src/middleware/opentelemetry_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ impl OpenTelemetryMetrics {
request_count: meter
.u64_counter("poem_requests_count")
.with_description("total request count (since start of service)")
.init(),
.build(),
error_count: meter
.u64_counter("poem_errors_count")
.with_description("failed request count (since start of service)")
.init(),
.build(),
duration: meter
.f64_histogram("poem_request_duration_ms")
.with_unit("milliseconds")
.with_description(
"request duration histogram (in milliseconds, since start of service)",
)
.init(),
.build(),
}
}
}
Expand Down

0 comments on commit 11790d7

Please sign in to comment.