Skip to content

Commit 6bed63e

Browse files
authored
Upgrade tonic to 0.14 and otel to 0.31 (#1028)
1 parent ee88c04 commit 6bed63e

File tree

12 files changed

+54
-67
lines changed

12 files changed

+54
-67
lines changed

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ derive_more = { version = "2.0", features = [
2525
"try_into",
2626
] }
2727
thiserror = "2"
28-
tonic = "0.13"
29-
tonic-build = "0.13"
30-
opentelemetry = { version = "0.30", features = ["metrics"] }
31-
prost = "0.13"
32-
prost-types = "0.13"
28+
tonic = "0.14"
29+
tonic-prost = "0.14"
30+
tonic-prost-build = "0.14"
31+
opentelemetry = { version = "0.31", features = ["metrics"] }
32+
prost = "0.14"
33+
prost-types = { version = "0.7", package = "prost-wkt-types" }
3334

3435
[workspace.lints.rust]
3536
unreachable_pub = "warn"

core-c-bridge/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ thiserror = { workspace = true }
5353
cbindgen = { version = "0.29", default-features = false }
5454

5555
[features]
56-
xz2-static = ["xz2/static"]
56+
xz2-static = ["xz2/static"]

core/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ itertools = "0.14"
6464
lru = "0.16"
6565
mockall = "0.13"
6666
opentelemetry = { workspace = true, features = ["metrics"], optional = true }
67-
opentelemetry_sdk = { version = "0.30", features = [
67+
opentelemetry_sdk = { version = "0.31", features = [
6868
"rt-tokio",
6969
"metrics",
7070
"spec_unstable_metrics_views",
7171
], optional = true }
72-
opentelemetry-otlp = { version = "0.30", features = [
72+
opentelemetry-otlp = { version = "0.31", features = [
7373
"tokio",
7474
"metrics",
7575
"tls",
@@ -81,7 +81,7 @@ pid = "4.0"
8181
pin-project = "1.1"
8282
prometheus = { version = "0.14", optional = true }
8383
prost = { workspace = true }
84-
prost-types = { version = "0.6", package = "prost-wkt-types" }
84+
prost-types = { workspace = true }
8585
rand = "0.9"
8686
reqwest = { version = "0.12", features = [
8787
"json",

core/src/core_tests/updates.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ async fn initial_request_sent_back(#[values(false, true)] reject: bool) {
114114
.returning(move |mut resp| {
115115
let msg = resp.messages.pop().unwrap();
116116
let orig_req = if reject {
117-
let acceptance = msg.body.unwrap().unpack_as(Rejection::default()).unwrap();
117+
let acceptance = msg.body.unwrap().to_msg::<Rejection>().unwrap();
118118
acceptance.rejected_request.unwrap()
119119
} else {
120-
let acceptance = msg.body.unwrap().unpack_as(Acceptance::default()).unwrap();
120+
let acceptance = msg.body.unwrap().to_msg::<Acceptance>().unwrap();
121121
acceptance.accepted_request.unwrap()
122122
};
123123
assert_eq!(orig_req, upd_req_body);

core/src/protosext/protocol_messages.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use anyhow::{anyhow, bail};
1+
use anyhow::anyhow;
22
use std::collections::HashMap;
33
use temporal_sdk_core_protos::temporal::api::{
44
common::v1::Payload,
@@ -108,16 +108,9 @@ impl TryFrom<Option<prost_types::Any>> for IncomingProtocolMessageBody {
108108

109109
fn try_from(v: Option<prost_types::Any>) -> Result<Self, Self::Error> {
110110
let v = v.ok_or_else(|| anyhow!("Protocol message body must be populated"))?;
111-
// Undo explicit type url checks when https://github.com/fdeantoni/prost-wkt/issues/48 is
112-
// fixed
113-
Ok(match v.type_url.as_str() {
114-
"type.googleapis.com/temporal.api.update.v1.Request" => {
115-
IncomingProtocolMessageBody::UpdateRequest(
116-
v.unpack_as(update::v1::Request::default())?.try_into()?,
117-
)
118-
}
119-
o => bail!("Could not understand protocol message type {o}"),
120-
})
111+
Ok(IncomingProtocolMessageBody::UpdateRequest(
112+
v.to_msg::<update::v1::Request>()?.try_into()?,
113+
))
121114
}
122115
}
123116

core/src/worker/workflow/workflow_stream.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ impl WFStream {
578578
#[derive(derive_more::From, Debug)]
579579
enum WFStreamInput {
580580
NewWft(Box<PermittedWFT>),
581-
Local(LocalInput),
581+
Local(Box<LocalInput>),
582582
/// The stream given to us which represents the poller (or a mock) terminated.
583583
PollerDead,
584584
/// The stream given to us which represents the poller (or a mock) encountered a non-retryable
@@ -590,6 +590,11 @@ enum WFStreamInput {
590590
auto_reply_fail_tt: Option<TaskToken>,
591591
},
592592
}
593+
impl From<LocalInput> for WFStreamInput {
594+
fn from(input: LocalInput) -> Self {
595+
WFStreamInput::Local(Box::new(input))
596+
}
597+
}
593598

594599
/// A non-poller-received input to the [WFStream]
595600
#[derive(derive_more::Debug)]
@@ -672,10 +677,10 @@ impl From<ExternalPollerInputs> for WFStreamInput {
672677
paginator,
673678
update,
674679
span,
675-
} => WFStreamInput::Local(LocalInput {
680+
} => WFStreamInput::Local(Box::new(LocalInput {
676681
input: LocalInputs::FetchedPageCompletion { paginator, update },
677682
span,
678-
}),
683+
})),
679684
}
680685
}
681686
}

sdk-core-protos/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,18 @@ anyhow = "1.0"
2020
base64 = "0.22"
2121
derive_more = { workspace = true }
2222
prost = { workspace = true }
23-
prost-wkt = "0.6"
24-
prost-wkt-types = "0.6"
23+
prost-wkt = "0.7"
24+
prost-types = { workspace = true }
2525
rand = { version = "0.9", optional = true }
2626
serde = { version = "1.0", features = ["derive"] }
2727
serde_json = "1.0"
2828
thiserror = { workspace = true }
2929
tonic = { workspace = true }
30+
tonic-prost = { workspace = true }
3031
uuid = { version = "1.18", features = ["v4"], optional = true }
3132

3233
[build-dependencies]
33-
tonic-build = { workspace = true }
34-
prost-build = "0.13"
35-
prost-wkt-build = "0.6"
34+
tonic-prost-build = { workspace = true }
3635

3736
[lints]
3837
workspace = true

sdk-core-protos/build.rs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
use std::{env, path::PathBuf};
22

3+
use tonic_prost_build::Config;
4+
35
static ALWAYS_SERDE: &str = "#[cfg_attr(not(feature = \"serde_serialize\"), \
46
derive(::serde::Serialize, ::serde::Deserialize))]";
57

68
fn main() -> Result<(), Box<dyn std::error::Error>> {
79
println!("cargo:rerun-if-changed=./protos");
810
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
911
let descriptor_file = out.join("descriptors.bin");
10-
tonic_build::configure()
12+
tonic_prost_build::configure()
1113
// We don't actually want to build the grpc definitions - we don't need them (for now).
1214
// Just build the message structs.
1315
.build_server(false)
@@ -96,29 +98,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
9698
"coresdk.external_data.LocalActivityMarkerData.backoff",
9799
"#[serde(with = \"opt_duration\")]",
98100
)
99-
.extern_path(
100-
".google.protobuf.Any",
101-
"::prost_wkt_types::Any"
102-
)
103-
.extern_path(
104-
".google.protobuf.Timestamp",
105-
"::prost_wkt_types::Timestamp"
106-
)
107-
.extern_path(
108-
".google.protobuf.Duration",
109-
"::prost_wkt_types::Duration"
110-
)
111-
.extern_path(
112-
".google.protobuf.Value",
113-
"::prost_wkt_types::Value"
114-
)
115-
.extern_path(
116-
".google.protobuf.FieldMask",
117-
"::prost_wkt_types::FieldMask"
118-
)
119101
.file_descriptor_set_path(descriptor_file)
120-
.skip_debug("temporal.api.common.v1.Payload")
121-
.compile_protos(
102+
.skip_debug(["temporal.api.common.v1.Payload"])
103+
.compile_with_config(
104+
{
105+
let mut c = Config::new();
106+
c.enable_type_names();
107+
c
108+
},
122109
&[
123110
"./protos/local/temporal/sdk/core/core_interface.proto",
124111
"./protos/api_upstream/temporal/api/workflowservice/v1/service.proto",

sdk-core-protos/src/history_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{
2323
},
2424
};
2525
use anyhow::bail;
26-
use prost_wkt_types::Timestamp;
26+
use prost_types::Timestamp;
2727
use std::{
2828
collections::HashMap,
2929
time::{Duration, SystemTime},

sdk-core-protos/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ pub mod coresdk {
396396
}
397397

398398
pub mod external_data {
399-
use prost_wkt_types::{Duration, Timestamp};
399+
use prost_types::{Duration, Timestamp};
400400
use serde::{Deserialize, Deserializer, Serialize, Serializer};
401401
tonic::include_proto!("coresdk.external_data");
402402

@@ -494,7 +494,7 @@ pub mod coresdk {
494494
query::v1::WorkflowQuery,
495495
},
496496
};
497-
use prost_wkt_types::Timestamp;
497+
use prost_types::Timestamp;
498498
use std::fmt::{Display, Formatter};
499499

500500
tonic::include_proto!("coresdk.workflow_activation");
@@ -2151,8 +2151,7 @@ pub mod temporal {
21512151
enums::v1::EventType, history::v1::history_event::Attributes,
21522152
};
21532153
use anyhow::bail;
2154-
use prost::alloc::fmt::Formatter;
2155-
use std::fmt::Display;
2154+
use std::fmt::{Display, Formatter};
21562155

21572156
tonic::include_proto!("temporal.api.history.v1");
21582157

@@ -2693,8 +2692,8 @@ pub mod temporal {
26932692
}
26942693

26952694
fn elapsed_between_prost_times(
2696-
from: prost_wkt_types::Timestamp,
2697-
to: prost_wkt_types::Timestamp,
2695+
from: prost_types::Timestamp,
2696+
to: prost_types::Timestamp,
26982697
) -> Option<Option<Duration>> {
26992698
let from: Result<SystemTime, _> = from.try_into();
27002699
let to: Result<SystemTime, _> = to.try_into();

0 commit comments

Comments
 (0)