Skip to content

Commit

Permalink
Fix type conversion and cue formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
srstrickland committed Oct 19, 2023
1 parent 91ca701 commit 9b56977
Show file tree
Hide file tree
Showing 39 changed files with 80 additions and 79 deletions.
7 changes: 4 additions & 3 deletions src/codecs/encoding/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::collections::BTreeMap;

use lookup::lookup_v2::ConfigValuePath;
use lookup::{event_path, PathPrefix};
use ordered_float::NotNan;
use serde::{Deserialize, Deserializer};
use vector_config::configurable_component;
use vector_core::event::{LogEvent, MaybeAsLogMut};
Expand Down Expand Up @@ -214,9 +215,9 @@ impl Transformer {
TimestampFormat::UnixNs => self.format_timestamps(log, |ts| {
ts.timestamp_nanos_opt().expect("Timestamp out of range")
}),
TimestampFormat::UnixFloat => {
self.format_timestamps(log, |ts| ts.timestamp_micros() as f64 / 1e6)
}
TimestampFormat::UnixFloat => self.format_timestamps(log, |ts| {
NotNan::new(ts.timestamp_micros() as f64 / 1e6).unwrap()
}),
// RFC3339 is the default serialization of a timestamp.
TimestampFormat::Rfc3339 => (),
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/amqp.cue
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ base: components: sinks: amqp: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/appsignal.cue
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ base: components: sinks: appsignal: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ base: components: sinks: aws_cloudwatch_logs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ base: components: sinks: aws_kinesis_firehose: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ base: components: sinks: aws_kinesis_streams: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/aws_s3.cue
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,10 @@ base: components: sinks: aws_s3: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/aws_sns.cue
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ base: components: sinks: aws_sns: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/aws_sqs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ base: components: sinks: aws_sqs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/azure_blob.cue
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,10 @@ base: components: sinks: azure_blob: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ base: components: sinks: azure_monitor_logs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/clickhouse.cue
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ base: components: sinks: clickhouse: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/console.cue
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ base: components: sinks: console: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/databend.cue
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ base: components: sinks: databend: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/datadog_logs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ base: components: sinks: datadog_logs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/elasticsearch.cue
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ base: components: sinks: elasticsearch: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/file.cue
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ base: components: sinks: file: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ base: components: sinks: gcp_chronicle_unstructured: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ base: components: sinks: gcp_cloud_storage: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/gcp_pubsub.cue
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ base: components: sinks: gcp_pubsub: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ base: components: sinks: gcp_stackdriver_logs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/honeycomb.cue
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ base: components: sinks: honeycomb: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/http.cue
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ base: components: sinks: http: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/humio_logs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ base: components: sinks: humio_logs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/influxdb_logs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ base: components: sinks: influxdb_logs: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/kafka.cue
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ base: components: sinks: kafka: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions website/cue/reference/components/sinks/base/logdna.cue
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ base: components: sinks: logdna: configuration: {
type: string: enum: {
rfc3339: "Represent the timestamp as a RFC 3339 timestamp."
unix: "Represent the timestamp as a Unix timestamp."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_ms: "Represent the timestamp as a Unix timestamp in milliseconds."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds."
unix_ns: "Represent the timestamp as a Unix timestamp in nanoseconds."
unix_float: "Represent the timestamp as a Unix timestamp in floating point."
unix_us: "Represent the timestamp as a Unix timestamp in microseconds"
}
}
}
Expand Down
Loading

0 comments on commit 9b56977

Please sign in to comment.