Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Allow google.protobuf.Timestamp in shipper Event fields and metadata #62

@cmacknz

Description

@cmacknz

The shipper Event payload are currently defined as google.protobuf.Struct which require encoding timestamps as strings:

// Metadata JSON object (map[string]google.protobuf.Value)
google.protobuf.Struct metadata = 5;
// Field JSON object (map[string]google.protobuf.Value)
google.protobuf.Struct fields = 6;
// Note: The google.protobuf.Value type should be extended (or re-implemented) with a
// google.protobuf.Timestamp to avoid the cost of encoding timestamps as strings and then
// parsing them back into a date representation.

Following from the note in the event definition, we should extend the google.protobuf.Struct type to allow using google.protobuf.Timestamp as one of the Value cases. The agent always writes to datastreams which require a timestamp, forcing timestamps to be encoded causes us to inefficiently parse them from string for every message received.

It should be enough to clone the existing google.protobuf.Struct definition and add the new message case in the Value oneof type, for example:

message Value {
  // The kind of value.
  oneof kind {
    // Represents a null value.
    NullValue null_value = 1;
    // Represents a double value.
    double number_value = 2;
    // Represents a string value.
    string string_value = 3;
    // Represents a boolean value.
    bool bool_value = 4;
    // Represents a structured value.
    Struct struct_value = 5;
    // Represents a repeated `Value`.
    ListValue list_value = 6;
    // Represents a timestamp.
    google.protobuf.Timestamp timestamp = 7;
  }
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions