Skip to content

Commit

Permalink
[PR Feedback] Renamed 'timestamp' proto field to 'occurred_at'
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Maier <[email protected]>
  • Loading branch information
christophermaier committed May 15, 2019
1 parent 74daaba commit 9002dcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions components/sup/protocols/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ message EventMetadata {
string supervisor_id = 1;
// The IP address on which the Supervisor is listening for gossip.
string ip_address = 2;
// The time at which this event occurred.
google.protobuf.Timestamp timestamp = 3;
google.protobuf.Timestamp occurred_at = 3;
string application = 4;
string environment = 5;
map<string, string> meta = 6;
Expand Down
2 changes: 1 addition & 1 deletion components/sup/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ fn publish(mut event: impl EventMessage) {
// one.
//
// The ugliness is at least contained, though.
event.event_metadata(EventMetadata { timestamp:
event.event_metadata(EventMetadata { occurred_at:
Some(std::time::SystemTime::now().into()),
..EVENT_CORE.get::<EventCore>().to_event_metadata() });

Expand Down
3 changes: 2 additions & 1 deletion components/sup/src/event/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ impl Service {
impl EventCore {
/// Create a protobuf metadata struct for all event messages.
pub(super) fn to_event_metadata(&self) -> EventMetadata {
// occurred_at will be set to Some when the event is published.
EventMetadata { supervisor_id: self.supervisor_id.clone(),
ip_address: self.ip_address.to_string(),
application: self.application.clone(),
environment: self.environment.clone(),
timestamp: None,
occurred_at: None,
meta: self.meta.clone().into(), }
}
}
Expand Down

0 comments on commit 9002dcb

Please sign in to comment.