Skip to content

Commit 72e3de5

Browse files
authored
Merge pull request #33 from vabka/otlp-tls
Add tls client config for tracing
2 parents 88d4d54 + 8ce0f79 commit 72e3de5

File tree

2 files changed

+37
-32
lines changed

2 files changed

+37
-32
lines changed

Cargo.toml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "uxum"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
authors = ["Alex Unigovsky <unik@devrandom.ru>"]
55
license = "MIT OR Apache-2.0"
66
edition = "2021"
@@ -37,70 +37,71 @@ sign-tag = false
3737
tag-message = "uxum {{version}}"
3838

3939
[dependencies]
40-
uxum-macros = {path = "uxum-macros", version = "0.4"}
40+
uxum-macros = { path = "uxum-macros", version = "0.4" }
4141

4242
argon2 = "0.5"
4343
askama = "0.13"
4444
async-trait = "0.1"
45-
axum = {version = "0.8", features = ["macros"]}
46-
axum-server = {version = "0.7", features = ["tls-rustls"]}
45+
axum = { version = "0.8", features = ["macros"] }
46+
axum-server = { version = "0.7", features = ["tls-rustls"] }
4747
base64 = "0.22"
48-
bytes = {version = "1.10", features = ["serde"]}
49-
config = {version = "0.15", features = ["yaml"]}
48+
bytes = { version = "1.10", features = ["serde"] }
49+
config = { version = "0.15", features = ["yaml"] }
5050
dashmap = "6.1"
5151
forwarded-header-value = "0.1"
5252
futures = "0.3"
5353
gettid = "0.1"
5454
governor = "0.10"
5555
humantime-serde = "1.1"
5656
http = "1.3"
57-
hyper = {version = "1.6", features = ["http1", "http2", "server"]}
58-
hyper-util = {version = "0.1", features = ["http1", "http2", "server"]}
57+
hyper = { version = "1.6", features = ["http1", "http2", "server"] }
58+
hyper-util = { version = "0.1", features = ["http1", "http2", "server"] }
5959
inventory = "0.3"
6060
iso8601-duration = "0.2"
6161
maplit = "1.0"
6262
mime = "0.3"
63-
okapi = {version = "0.7", features = ["preserve_order"]}
63+
okapi = { version = "0.7", features = ["preserve_order"] }
6464
once_cell = "1.21"
6565
parking_lot = "0.12"
6666
pin-project = "1.1"
67-
opentelemetry = {version = "0.29", features = ["metrics"]}
68-
opentelemetry-otlp = {version = "0.29", features = ["trace", "metrics", "logs", "grpc-tonic", "zstd-tonic", "tls-roots"]}
67+
opentelemetry = { version = "0.29", features = ["metrics"] }
68+
opentelemetry-otlp = { version = "0.29", features = ["trace", "metrics", "logs", "grpc-tonic", "zstd-tonic", "tls-roots"] }
6969
opentelemetry-resource-detectors = "0.8"
70-
opentelemetry_sdk = {version = "0.29", features = ["rt-tokio", "spec_unstable_metrics_views"]}
71-
opentelemetry-prometheus = {version = "0.29", features = ["prometheus-encoding"]}
70+
opentelemetry_sdk = { version = "0.29", features = ["rt-tokio", "spec_unstable_metrics_views"] }
71+
opentelemetry-prometheus = { version = "0.29", features = ["prometheus-encoding"] }
7272
opentelemetry-semantic-conventions = "0.29"
73-
password-hash = {version = "0.5", features = ["alloc"]}
74-
problemdetails = {version = "0.5", features = ["axum"]}
73+
password-hash = { version = "0.5", features = ["alloc"] }
74+
problemdetails = { version = "0.5", features = ["axum"] }
7575
prometheus = "0.14"
76-
prost = {version = "0.13", optional = true}
76+
prost = { version = "0.13", optional = true }
7777
recloser = "1.1"
78-
reqwest = {version = "0.12", default-features = false, features = ["charset", "hickory-dns", "http2", "json", "macos-system-configuration", "rustls-tls-native-roots"]}
79-
reqwest-middleware = {version = "0.4", features = ["multipart", "json"]}
80-
reqwest-tracing = {version = "0.5.7", features = ["opentelemetry_0_29"]}
78+
reqwest = { version = "0.12", default-features = false, features = ["charset", "hickory-dns", "http2", "json", "macos-system-configuration", "rustls-tls-native-roots"] }
79+
reqwest-middleware = { version = "0.4", features = ["multipart", "json"] }
80+
reqwest-tracing = { version = "0.5.7", features = ["opentelemetry_0_29"] }
8181
subtle = "2.5"
82-
rustls = {version = "0.23", features = ["std", "aws_lc_rs", "custom-provider"]}
83-
schemars = {version = "0.8", features = ["bytes", "chrono", "preserve_order", "semver", "url"]}
84-
serde = {version = "1.0", features = ["derive"]}
85-
serde_json = {version = "1.0", features = ["alloc", "arbitrary_precision", "preserve_order"]}
86-
socket2 = {version = "0.5"}
82+
rustls = { version = "0.23", features = ["std", "aws_lc_rs", "custom-provider"] }
83+
schemars = { version = "0.8", features = ["bytes", "chrono", "preserve_order", "semver", "url"] }
84+
serde = { version = "1.0", features = ["derive"] }
85+
serde_json = { version = "1.0", features = ["alloc", "arbitrary_precision", "preserve_order"] }
86+
socket2 = { version = "0.5" }
8787
thiserror = "2.0"
88-
tonic = {version = "0.13", optional = true}
89-
tokio = {version = "1.44", features = ["full"]}
90-
tower = {version = "0.5", features = ["buffer", "filter", "limit", "retry", "timeout", "util"]}
91-
tower-http = {version = "0.6", features = ["catch-panic", "cors", "request-id", "sensitive-headers", "set-header", "trace", "util"]}
88+
tonic = { version = "0.13", optional = true }
89+
tonic_012 = { version = "0.12.3", package = "tonic" }
90+
tokio = { version = "1.44", features = ["full"] }
91+
tower = { version = "0.5", features = ["buffer", "filter", "limit", "retry", "timeout", "util"] }
92+
tower-http = { version = "0.6", features = ["catch-panic", "cors", "request-id", "sensitive-headers", "set-header", "trace", "util"] }
9293
tracing = "0.1"
9394
tracing-appender = "0.2"
9495
tracing-log = "0.2"
9596
tracing-opentelemetry = "0.30"
9697
tracing-serde = "0.2"
97-
tracing-subscriber = {version = "0.3", features = ["env-filter", "json", "local-time", "parking_lot", "time", "tracing-log"]}
98-
url = {version = "2.5", features = ["serde"]}
98+
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "local-time", "parking_lot", "time", "tracing-log"] }
99+
url = { version = "2.5", features = ["serde"] }
99100

100101
[features]
101102
default = []
102103
grpc = ["prost", "tonic"]
103104
systemd = ["libsystemd"]
104105

105106
[target.'cfg(target_os = "linux")'.dependencies]
106-
libsystemd = {version = "0.7", optional = true}
107+
libsystemd = { version = "0.7", optional = true }

src/tracing/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
33
use std::{num::NonZeroUsize, time::Duration};
44

5-
use opentelemetry_otlp::{ExporterBuildError, Protocol, SpanExporter, WithExportConfig};
5+
use opentelemetry_otlp::{
6+
ExporterBuildError, Protocol, SpanExporter, WithExportConfig, WithTonicConfig,
7+
};
68
use opentelemetry_sdk::{
79
trace::{
810
BatchConfig, BatchConfigBuilder, BatchSpanProcessor, Sampler, SdkTracerProvider, Tracer,
@@ -11,6 +13,7 @@ use opentelemetry_sdk::{
1113
};
1214
use serde::{Deserialize, Serialize};
1315
use thiserror::Error;
16+
use tonic_012::transport::ClientTlsConfig;
1417
use tracing::{debug_span, Level, Subscriber};
1518
use tracing_opentelemetry::OpenTelemetryLayer;
1619
use tracing_subscriber::{
@@ -104,6 +107,7 @@ impl TracingConfig {
104107
.with_protocol(self.protocol.into())
105108
.with_endpoint(self.endpoint.to_string())
106109
.with_timeout(self.timeout)
110+
.with_tls_config(ClientTlsConfig::new().with_native_roots())
107111
.build()
108112
}
109113

0 commit comments

Comments
 (0)