Skip to content

Commit

Permalink
chore(deps): Bump chrono from 0.4.30 to 0.4.31 (vectordotdev#18583)
Browse files Browse the repository at this point in the history
* chore(deps): Bump chrono from 0.4.30 to 0.4.31

Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.30 to 0.4.31.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](chronotope/chrono@v0.4.30...v0.4.31)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Expand deprecated function `DateTime::timestamp_nanos`

This function internally just calls `.timestamp_nanos_opt().expect()`

* Change message on expect

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bruce Guenter <[email protected]>
  • Loading branch information
dependabot[bot] and bruceg authored Sep 29, 2023
1 parent e445721 commit 052ed98
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 31 deletions.
4 changes: 2 additions & 2 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ bloomy = { version = "1.2.0", default-features = false, optional = true }
bollard = { version = "0.15.0", default-features = false, features = ["ssl", "chrono"], optional = true }
bytes = { version = "1.5.0", default-features = false, features = ["serde"] }
bytesize = { version = "1.3.0", default-features = false }
chrono = { version = "0.4.30", default-features = false, features = ["serde"] }
chrono = { version = "0.4.31", default-features = false, features = ["serde"] }
cidr-utils = { version = "0.5.11", default-features = false }
clap = { version = "4.4.3", default-features = false, features = ["derive", "error-context", "env", "help", "std", "string", "usage", "wrap_help"] }
colored = { version = "2.0.4", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion lib/enrichment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ publish = false

[dependencies]
arc-swap = { version = "1.6.0", default-features = false }
chrono = { version = "0.4.19", default-features = false }
chrono = { version = "0.4.31", default-features = false }
dyn-clone = { version = "1.0.14", default-features = false }
vrl.workspace = true
2 changes: 1 addition & 1 deletion lib/fakedata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ publish = false
license = "MPL-2.0"

[dependencies]
chrono = "0.4.19"
chrono = "0.4.31"
fakedata_generator = "0.2.4"
rand = "0.8.5"
10 changes: 8 additions & 2 deletions lib/loki-logproto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,18 @@ mod tests {
.timestamp_opt(1640244790, 0)
.single()
.expect("invalid timestamp");
let entry1 = Entry(ts1.timestamp_nanos(), "hello".into());
let entry1 = Entry(
ts1.timestamp_nanos_opt().expect("Timestamp out of range"),
"hello".into(),
);
let ts2 = Utc
.timestamp_opt(1640244791, 0)
.single()
.expect("invalid timestamp");
let entry2 = Entry(ts2.timestamp_nanos(), "world".into());
let entry2 = Entry(
ts2.timestamp_nanos_opt().expect("Timestamp out of range"),
"world".into(),
);
let labels = vec![("source".into(), "protobuf-test".into())]
.into_iter()
.collect();
Expand Down
2 changes: 1 addition & 1 deletion lib/opentelemetry-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tonic-build = { version = "0.10", default-features = false, features = ["prost",

[dependencies]
bytes = { version = "1.5.0", default-features = false, features = ["serde"] }
chrono = { version = "0.4.19", default-features = false, features = ["serde"] }
chrono = { version = "0.4.31", default-features = false, features = ["serde"] }
hex = { version = "0.4.3", default-features = false, features = ["std"] }
lookup = { package = "vector-lookup", path = "../vector-lookup", default-features = false }
ordered-float = { version = "4.1.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-api-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ reqwest = { version = "0.11.20", default-features = false, features = ["json"] }
tokio-tungstenite = { version = "0.20.1", default-features = false, features = ["connect", "rustls"] }

# External libs
chrono = { version = "0.4.6", default-features = false, features = ["serde"] }
chrono = { version = "0.4.31", default-features = false, features = ["serde"] }
clap = { version = "4.4.3", default-features = false, features = ["derive"] }
url = { version = "2.4.1", default-features = false }
uuid = { version = "1", default-features = false, features = ["serde", "v4"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name = "integration"
path = "tests/integration/lib.rs"

[dependencies]
chrono = { version = "0.4.19", default-features = false }
chrono = { version = "0.4.31", default-features = false }
chrono-tz = { version = "0.8.3", default-features = false }
encoding_rs = { version = "0.8", default-features = false, features = ["alloc", "serde"] }
indexmap = { version = "2.0", default-features = false, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async-stream = { version = "0.3.5", default-features = false }
async-trait = { version = "0.1", default-features = false }
bitmask-enum = { version = "2.2.2", default-features = false }
bytes = { version = "1.5.0", default-features = false, features = ["serde"] }
chrono = { version = "0.4.19", default-features = false, features = ["serde"] }
chrono = { version = "0.4.31", default-features = false, features = ["serde"] }
crossbeam-utils = { version = "0.8.16", default-features = false }
db-key = { version = "0.0.5", default-features = false, optional = true }
dyn-clone = { version = "1.0.14", default-features = false }
Expand Down
18 changes: 14 additions & 4 deletions src/sinks/datadog/traces/apm_stats/aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ impl Aggregator {
pub fn new(default_api_key: Arc<str>) -> Self {
Self {
buckets: BTreeMap::new(),
oldest_timestamp: align_timestamp(Utc::now().timestamp_nanos() as u64),
oldest_timestamp: align_timestamp(
Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range") as u64,
),
default_api_key,
// We can't know the below fields until have received a trace event
agent_env: None,
Expand Down Expand Up @@ -228,8 +232,12 @@ impl Aggregator {
let aggkey = AggregationKey::new_aggregation_from_span(span, payload_aggkey, synthetics);

let start = match span.get("start") {
Some(Value::Timestamp(val)) => val.timestamp_nanos() as u64,
_ => Utc::now().timestamp_nanos() as u64,
Some(Value::Timestamp(val)) => {
val.timestamp_nanos_opt().expect("Timestamp out of range") as u64
}
_ => Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range") as u64,
};

let duration = match span.get("duration") {
Expand Down Expand Up @@ -277,7 +285,9 @@ impl Aggregator {
// Based on https://github.com/DataDog/datadog-agent/blob/cfa750c7412faa98e87a015f8ee670e5828bbe7f/pkg/trace/stats/concentrator.go#L38-L41
// , and https://github.com/DataDog/datadog-agent/blob/cfa750c7412faa98e87a015f8ee670e5828bbe7f/pkg/trace/stats/concentrator.go#L195-L207

let now = Utc::now().timestamp_nanos() as u64;
let now = Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range") as u64;

let flush_cutoff_time = if force {
// flush all the remaining buckets (the Vector process is exiting)
Expand Down
4 changes: 3 additions & 1 deletion src/sinks/datadog/traces/apm_stats/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ async fn apm_stats_e2e_test_dd_agent_to_vector_correctness() {
// the URLs of the Agent trace endpoints that traces will be sent to
let urls = vec![trace_agent_only_url(), trace_agent_to_vector_url()];

let start = Utc::now().timestamp_nanos();
let start = Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range");
let duration = 1;
let span_id = 3;

Expand Down
4 changes: 3 additions & 1 deletion src/sinks/datadog/traces/request_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ impl DatadogTracesEncoder {
_ => 0,
};
let start = match span.get("start") {
Some(Value::Timestamp(val)) => val.timestamp_nanos(),
Some(Value::Timestamp(val)) => {
val.timestamp_nanos_opt().expect("Timestamp out of range")
}
_ => 0,
};

Expand Down
5 changes: 4 additions & 1 deletion src/sinks/influxdb/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,10 @@ mod integration_tests {
onboarding_v2(&endpoint).await;

let now = Utc::now();
let measure = format!("vector-{}", now.timestamp_nanos());
let measure = format!(
"vector-{}",
now.timestamp_nanos_opt().expect("Timestamp out of range")
);

let cx = SinkContext::default();

Expand Down
7 changes: 6 additions & 1 deletion src/sinks/influxdb/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,12 @@ mod integration_tests {
acknowledgements: Default::default(),
};

let metric = format!("counter-{}", Utc::now().timestamp_nanos());
let metric = format!(
"counter-{}",
Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range")
);
let mut events = Vec::new();
for i in 0..10 {
let event = Event::Metric(
Expand Down
8 changes: 5 additions & 3 deletions src/sinks/influxdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ fn encode_string(key: &str, output: &mut BytesMut) {

pub(in crate::sinks) fn encode_timestamp(timestamp: Option<DateTime<Utc>>) -> i64 {
if let Some(ts) = timestamp {
ts.timestamp_nanos()
ts.timestamp_nanos_opt().unwrap()
} else {
encode_timestamp(Some(Utc::now()))
}
Expand Down Expand Up @@ -390,7 +390,7 @@ pub mod test_util {
pub(crate) const TOKEN: &str = "my-token";

pub(crate) fn next_database() -> String {
format!("testdb{}", Utc::now().timestamp_nanos())
format!("testdb{}", Utc::now().timestamp_nanos_opt().unwrap())
}

pub(crate) fn ts() -> DateTime<Utc> {
Expand Down Expand Up @@ -834,7 +834,9 @@ mod tests {

#[test]
fn test_encode_timestamp() {
let start = Utc::now().timestamp_nanos();
let start = Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range");
assert_eq!(encode_timestamp(Some(ts())), 1542182950000000011);
assert!(encode_timestamp(None) >= start)
}
Expand Down
14 changes: 12 additions & 2 deletions src/sinks/loki/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ async fn namespaced_timestamp() {

// The timestamp of the event needs to be the timestamp set in the `norknork`
// field since that was given the meaning of `timestamp`.
assert_eq!(timestamp.timestamp_nanos(), timestamps[i]);
assert_eq!(
timestamp
.timestamp_nanos_opt()
.expect("Timestamp out of range"),
timestamps[i]
);
}
}

Expand Down Expand Up @@ -675,7 +680,12 @@ async fn test_out_of_order_events(
)
}
for (i, ts) in timestamps.iter().enumerate() {
assert_eq!(get_timestamp(&expected[i]).timestamp_nanos(), *ts);
assert_eq!(
get_timestamp(&expected[i])
.timestamp_nanos_opt()
.expect("Timestamp out of range"),
*ts
);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/sinks/loki/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ impl EventEncoder {
self.remove_label_fields(&mut event);

let timestamp = match event.as_log().get_timestamp() {
Some(Value::Timestamp(ts)) => ts.timestamp_nanos(),
_ => chrono::Utc::now().timestamp_nanos(),
Some(Value::Timestamp(ts)) => ts.timestamp_nanos_opt().expect("Timestamp out of range"),
_ => chrono::Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range"),
};

if self.remove_timestamp {
Expand Down
4 changes: 3 additions & 1 deletion src/sources/datadog_agent/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ fn get_simple_trace() -> String {
]
]
"#},
Utc::now().timestamp_nanos()
Utc::now()
.timestamp_nanos_opt()
.expect("Timestamp out of range")
)
}
9 changes: 6 additions & 3 deletions src/sources/splunk_hec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2123,16 +2123,19 @@ mod tests {
for case in cases {
let sec = case.timestamp();
let millis = case.timestamp_millis();
let nano = case.timestamp_nanos();
let nano = case.timestamp_nanos_opt().expect("Timestamp out of range");

assert_eq!(parse_timestamp(sec).unwrap().timestamp(), case.timestamp());
assert_eq!(
parse_timestamp(millis).unwrap().timestamp_millis(),
case.timestamp_millis()
);
assert_eq!(
parse_timestamp(nano).unwrap().timestamp_nanos(),
case.timestamp_nanos()
parse_timestamp(nano)
.unwrap()
.timestamp_nanos_opt()
.unwrap(),
case.timestamp_nanos_opt().expect("Timestamp out of range")
);
}

Expand Down
2 changes: 1 addition & 1 deletion vdev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ publish = false
anyhow = "1.0.75"
atty = "0.2.14"
cached = "0.45.1"
chrono = { version = "0.4.22", default-features = false, features = ["serde", "clock"] }
chrono = { version = "0.4.31", default-features = false, features = ["serde", "clock"] }
clap = { version = "4.4.3", features = ["derive"] }
clap-verbosity-flag = "2.0.1"
clap_complete = "4.4.2"
Expand Down

0 comments on commit 052ed98

Please sign in to comment.