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

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

Closed
Tracked by #34 ...
cmacknz opened this issue Jun 21, 2022 · 0 comments · Fixed by #69
Closed
Tracked by #34 ...

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

cmacknz opened this issue Jun 21, 2022 · 0 comments · Fixed by #69
Assignees
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team v8.4.0

Comments

@cmacknz
Copy link
Member

cmacknz commented Jun 21, 2022

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;
  }
}
@cmacknz cmacknz added Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team v8.4.0 labels Jun 21, 2022
@cmacknz cmacknz changed the title Allow google.protobuf.Timestamp in shipper Event fields and metadat Allow google.protobuf.Timestamp in shipper Event fields and metadata Jun 21, 2022
@rdner rdner closed this as completed in #69 Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team v8.4.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants