// Prometheus Remote Write Protocol v1
// Reference: https://prometheus.io/docs/concepts/remote_write_spec/
//
// This proto definition is based on the Prometheus remote write specification
// for push-based metric ingestion. It's compatible with Prometheus, VictoriaMetrics,
// and other systems that implement the remote write protocol.

syntax = "proto3";

package prometheus;

// WriteRequest is the top-level message for remote write operations.
// Clients send a WriteRequest containing multiple time series to the server.
message WriteRequest {
  // Time series data to be written
  repeated TimeSeries timeseries = 1;

  // Metadata about the time series (optional, not used in v1)
  // Reserved for future use with metadata support
  // repeated MetricMetadata metadata = 3;
}

// TimeSeries represents a single time series with its labels and samples.
// A time series is uniquely identified by its label set.
message TimeSeries {
  // Set of labels that uniquely identify this time series
  // Must include at least one label, typically __name__ for the metric name
  repeated Label labels = 1;

  // Samples (data points) for this time series
  // Samples must be ordered by timestamp (ascending)
  repeated Sample samples = 2;

  // Exemplars are optional (used for tracing correlation)
  // Not implemented in initial version
  // repeated Exemplar exemplars = 3;
}

// Label is a key-value pair that identifies a time series dimension.
// Examples: {__name__="http_requests_total", method="GET", status="200"}
message Label {
  // Label name (e.g., "__name__", "job", "instance")
  string name = 1;

  // Label value
  string value = 2;
}

// Sample is a single data point in a time series.
message Sample {
  // Metric value (float64)
  double value = 1;

  // Timestamp in milliseconds since Unix epoch
  int64 timestamp = 2;
}

// WriteResponse is returned after a successful write operation.
message WriteResponse {
  // Empty for successful writes
  // Error information is conveyed via gRPC status codes
}
