// Vendored verbatim from https://github.com/vectordotdev/vector
// Copyright Datadog, Inc. Licensed under the Mozilla Public License 2.0
// (MPL-2.0, https://www.mozilla.org/MPL/2.0/). Unmodified -- see /NOTICE.
// Source: lib/vector-core/proto/event.proto
// Pinned: 2026-03-02 (stable since 2021, rarely changes)

syntax = "proto3";

package event;

import "google/protobuf/timestamp.proto";

message EventArray {
  oneof events {
    LogArray logs = 1;
    MetricArray metrics = 2;
    TraceArray traces = 3;
  }
}

message LogArray {
  repeated Log logs = 1;
}

message MetricArray {
  repeated Metric metrics = 1;
}

message TraceArray {
  repeated Trace traces = 1;
}

message EventWrapper {
  oneof event {
    Log log = 1;
    Metric metric = 2;
    Trace trace = 3;
  }
}

message Log {
  // Deprecated, use value instead
  map<string, Value> fields = 1;
  Value value = 2;
  Value metadata = 3 [deprecated = true];
  Metadata metadata_full = 4;
}

message Trace {
  map<string, Value> fields = 1;
  Value metadata = 2 [deprecated = true];
  Metadata metadata_full = 3;
}

message ValueMap {
  map<string, Value> fields = 1;
}

message ValueArray {
  repeated Value items = 1;
}

enum ValueNull {
  NULL_VALUE = 0;
}

message Value {
  reserved 3;
  oneof kind {
    bytes raw_bytes = 1;
    google.protobuf.Timestamp timestamp = 2;
    int64 integer = 4;
    double float = 5;
    bool boolean = 6;
    ValueMap map = 7;
    ValueArray array = 8;
    ValueNull null = 9;
  }
}

message DatadogOriginMetadata {
  optional uint32 origin_product = 1;
  optional uint32 origin_category = 2;
  optional uint32 origin_service = 3;
}

message Secrets {
  map<string, string> entries = 1;
}

message OutputId {
  string component = 1;
  optional string port = 2;
}

message Metadata {
  Value value = 1;
  DatadogOriginMetadata datadog_origin_metadata = 2;
  optional string source_id = 3;
  optional string source_type = 4;
  OutputId upstream_id = 5;
  Secrets secrets = 6;
  bytes source_event_id = 7;
}

message Metric {
  string name = 1;
  google.protobuf.Timestamp timestamp = 2;
  map<string, string> tags_v1 = 3;
  map<string, TagValues> tags_v2 = 20;
  enum Kind {
    Incremental = 0;
    Absolute = 1;
  }
  Kind kind = 4;
  oneof value {
    Counter counter = 5;
    Gauge gauge = 6;
    Set set = 7;
    Distribution1 distribution1 = 8;
    AggregatedHistogram1 aggregated_histogram1 = 9;
    AggregatedSummary1 aggregated_summary1 = 10;
    Distribution2 distribution2 = 12;
    AggregatedHistogram2 aggregated_histogram2 = 13;
    AggregatedSummary2 aggregated_summary2 = 14;
    Sketch sketch = 15;
    AggregatedHistogram3 aggregated_histogram3 = 16;
    AggregatedSummary3 aggregated_summary3 = 17;
  }
  string namespace = 11;
  uint32 interval_ms = 18;
  Value metadata = 19 [deprecated = true];
  Metadata metadata_full = 21;
}

message TagValues {
  repeated TagValue values = 1;
}

message TagValue {
  optional string value = 1;
}

message Counter {
  double value = 1;
}

message Gauge {
  double value = 1;
}

message Set {
  repeated string values = 1;
}

enum StatisticKind {
  Histogram = 0;
  Summary = 1;
}

message Distribution1 {
  repeated double values = 1;
  repeated uint32 sample_rates = 2;
  StatisticKind statistic = 3;
}

message Distribution2 {
  repeated DistributionSample samples = 1;
  StatisticKind statistic = 2;
}

message DistributionSample {
  double value = 1;
  uint32 rate = 2;
}

message AggregatedHistogram1 {
  repeated double buckets = 1;
  repeated uint32 counts = 2;
  uint32 count = 3;
  double sum = 4;
}

message AggregatedHistogram2 {
  repeated HistogramBucket buckets = 1;
  uint32 count = 2;
  double sum = 3;
}

message AggregatedHistogram3 {
  repeated HistogramBucket3 buckets = 1;
  uint64 count = 2;
  double sum = 3;
}

message HistogramBucket {
  double upper_limit = 1;
  uint32 count = 2;
}

message HistogramBucket3 {
  double upper_limit = 1;
  uint64 count = 2;
}

message AggregatedSummary1 {
  repeated double quantiles = 1;
  repeated double values = 2;
  uint32 count = 3;
  double sum = 4;
}

message AggregatedSummary2 {
  repeated SummaryQuantile quantiles = 1;
  uint32 count = 2;
  double sum = 3;
}

message AggregatedSummary3 {
  repeated SummaryQuantile quantiles = 1;
  uint64 count = 2;
  double sum = 3;
}

message SummaryQuantile {
  double quantile = 1;
  double value = 2;
}

message Sketch {
  message AgentDDSketch {
    uint32 count = 1;
    double min = 2;
    double max = 3;
    double sum = 4;
    double avg = 5;
    repeated sint32 k = 6;
    repeated uint32 n = 7;
  }

  oneof sketch {
    AgentDDSketch agent_dd_sketch = 1;
  }
}
