syntax = "proto3";
package prometheus;
message MetricMetadata {
    enum MetricType {
      UNKNOWN        = 0;
      COUNTER        = 1;
      GAUGE          = 2;
      HISTOGRAM      = 3;
      GAUGEHISTOGRAM = 4;
      SUMMARY        = 5;
      INFO           = 6;
      STATESET       = 7;
    }
  
    // Represents the metric type, these match the set from Prometheus.
    // Refer to pkg/textparse/interface.go for details.
    MetricType type = 1;
    string metric_family_name = 2;
    string help = 4;
    string unit = 5;
  }

  message Sample {
    double value    = 1;
    // timestamp is in ms format, see pkg/timestamp/timestamp.go for
    // conversion from time.Time to Prometheus timestamp.
    int64 timestamp = 2;
  }
  
  message Exemplar {
    // Optional, can be empty.
    repeated Label labels = 1 [(nullable) = false];
    double value = 2;
    // timestamp is in ms format, see pkg/timestamp/timestamp.go for
    // conversion from time.Time to Prometheus timestamp.
    int64 timestamp = 3;
  }
  
  // TimeSeries represents samples and labels for a single time series.
  message TimeSeries {
    // For a timeseries to be valid, and for the samples and exemplars
    // to be ingested by the remote system properly, the labels field is required.
    repeated Label labels   = 1 [(nullable) = false];
    repeated Sample samples = 2 [(nullable) = false];
    repeated Exemplar exemplars = 3 [(nullable) = false];
  }

  message Label {
    string name  = 1;
    string value = 2;
  }

message WriteRequest {
  repeated prometheus.TimeSeries timeseries = 1 [(nullable) = false];
  // Cortex uses this field to determine the source of the write request.
  // We reserve it to avoid any compatibility issues.
  reserved  2;
  repeated prometheus.MetricMetadata metadata = 3 [(nullable) = false];
}

