Skip to content

Commit

Permalink
Update tracing to 0.1.37. (#637)
Browse files Browse the repository at this point in the history
I also had to fix a compile error due to use of the ! type.
I replaced it with std::convert::Infallible. Per that type's
documentation[1], using ! as a function's return type is permitted in
stable Rust, so this was technically a brekaing change in the tracing
crate.

I also backported a test deflake from 0.2 while I'm at it -- it flaked
again for one of dependabot's 0.1 updates.

[1] https://doc.rust-lang.org/stable/std/convert/enum.Infallible.html
  • Loading branch information
branlwyd authored Oct 10, 2022
1 parent de6185c commit 3846719
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 29 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true }
testcontainers = "0.14.0"
tokio = { version = "1", features = ["full", "tracing"], optional = true }
tracing = "0.1.36"
tracing = "0.1.37"
url = { version = "2.3.1", features = ["serde"] }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion interop_binaries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.86"
testcontainers = { version = "0.14", optional = true }
tokio = { version = "1.21", features = ["full", "tracing"] }
tracing = "0.1.36"
tracing = "0.1.37"
tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3", features = ["std", "env-filter", "fmt"] }
url = { version = "2.3.1", features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion janus_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ prio = { version = "0.8.2", features = ["multithreaded"] }
reqwest = { version = "0.11.12", default-features = false, features = ["rustls-tls"] }
thiserror = "1.0"
tokio = { version = "1.21", features = ["full"] }
tracing = "0.1.36"
tracing = "0.1.37"
url = "2.3.1"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion janus_collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ reqwest = { version = "0.11.12", default-features = false, features = ["rustls-t
retry-after = "0.3.1"
thiserror = "1.0"
tokio = { version = "1.21", features = ["full"] }
tracing = "0.1.36"
tracing = "0.1.37"
url = "2.3.1"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion janus_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ring = "0.16.20"
serde = { version = "1.0.145", features = ["derive"] }
thiserror = "1.0"
tokio = { version = "1.21", features = ["macros", "net", "rt"] }
tracing = "0.1.36"
tracing = "0.1.37"

# Dependencies required only if feature "test-util" is enabled
assert_matches = { version = "1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion janus_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ thiserror = "1.0"
tokio = { version = "1.21", features = ["full", "tracing"] }
tokio-postgres = { version = "0.7.7", features = ["with-chrono-0_4", "with-serde_json-1", "with-uuid-1", "array-impls"] }
tonic = { version = "0.8", optional = true, features = ["tls", "tls-webpki-roots"] } # keep this version in sync with what opentelemetry-otlp uses
tracing = "0.1.36"
tracing = "0.1.37"
tracing-log = "0.1.3"
tracing-opentelemetry = { version = "0.18", optional = true }
tracing-subscriber = { version = "0.3", features = ["std", "env-filter", "fmt", "json"] }
Expand Down
13 changes: 9 additions & 4 deletions janus_server/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2857,15 +2857,20 @@ mod tests {
async fn upload_wrong_hpke_config_id() {
install_test_trace_subscriber();

let (aggregator, _, mut report, _, _db_handle) = setup_upload_test().await;
let (aggregator, task, report, _, _db_handle) = setup_upload_test().await;

report = Report::new(
let unused_hpke_config_id = (0..)
.map(HpkeConfigId::from)
.find(|id| !task.hpke_keys.contains_key(id))
.unwrap();

let report = Report::new(
report.task_id(),
report.nonce(),
report.extensions().to_vec(),
vec![
HpkeCiphertext::new(
HpkeConfigId::from(101),
unused_hpke_config_id,
report.encrypted_input_shares()[0]
.encapsulated_context()
.to_vec(),
Expand All @@ -2877,7 +2882,7 @@ mod tests {

assert_matches!(aggregator.handle_upload(&report.get_encoded()).await, Err(Error::OutdatedHpkeConfig(config_id, task_id)) => {
assert_eq!(task_id, report.task_id());
assert_eq!(config_id, HpkeConfigId::from(101));
assert_eq!(config_id, unused_hpke_config_id);
});
}

Expand Down
23 changes: 12 additions & 11 deletions janus_server/src/aggregator/aggregation_job_creator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ use opentelemetry::{
metrics::{Histogram, Unit},
Context, KeyValue,
};
use prio::vdaf;
use prio::vdaf::prio3::{Prio3Aes128Count, Prio3Aes128Histogram, Prio3Aes128Sum};
use prio::{codec::Encode, vdaf::prio3::Prio3Aes128CountVecMultithreaded};
use prio::{
codec::Encode,
vdaf::prio3::Prio3Aes128CountVecMultithreaded,
vdaf::{
self,
prio3::{Prio3Aes128Count, Prio3Aes128Histogram, Prio3Aes128Sum},
},
};
use rand::{thread_rng, Rng};
use std::collections::HashMap;
#[cfg(test)]
use std::hash::Hash;
use std::sync::Arc;
use std::time::Duration;
use tokio::select;
use std::{collections::HashMap, convert::Infallible, sync::Arc, time::Duration};
use tokio::{
select,
sync::oneshot::{self, Receiver, Sender},
time::{self, Instant, MissedTickBehavior},
};
Expand Down Expand Up @@ -85,7 +86,7 @@ impl<C: Clock + 'static> AggregationJobCreator<C> {
}

#[tracing::instrument(skip(self))]
pub async fn run(self: Arc<Self>) -> ! {
pub async fn run(self: Arc<Self>) -> Infallible {
// TODO(#224): add support for handling only a subset of tasks in a single job (i.e. sharding).

// Create histogram metrics.
Expand Down Expand Up @@ -362,7 +363,7 @@ impl<C: Clock + 'static> AggregationJobCreator<C> {
A::PrepareState: Send + Sync + Encode,
A::OutputShare: Send + Sync,
for<'a> &'a A::OutputShare: Into<Vec<u8>>,
A::AggregationParam: Send + Sync + Eq + Hash,
A::AggregationParam: Send + Sync + Eq + std::hash::Hash,
{
let task_id = task.id;
let min_batch_duration = task.min_batch_duration;
Expand Down
4 changes: 2 additions & 2 deletions janus_server/src/binary_utils/job_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use opentelemetry::{
metrics::{Meter, Unit},
Context, KeyValue,
};
use std::{fmt::Debug, future::Future, sync::Arc};
use std::{convert::Infallible, fmt::Debug, future::Future, sync::Arc};
use tokio::{
sync::Semaphore,
time::{self, Instant},
Expand Down Expand Up @@ -88,7 +88,7 @@ where

/// Run this job driver, periodically seeking incomplete jobs and stepping them.
#[tracing::instrument(skip(self))]
pub async fn run(self: Arc<Self>) -> ! {
pub async fn run(self: Arc<Self>) -> Infallible {
// Create metric recorders.
let job_acquire_time_histogram = self
.meter
Expand Down

0 comments on commit 3846719

Please sign in to comment.