Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.6 KB
Raw Blame
syntax = "proto3";

package prometheus.v1;

// Minimal subset of the Prometheus remote-write v1 protocol
// (github.com/prometheus/prometheus/prompb) sufficient to decode a write
// request. Field numbers MUST match upstream for wire compatibility.
//
// TimeSeries fields 3 (exemplars) and 4 (native histograms) are intentionally
// omitted: proto3 skips unknown fields during decoding, so a v1 sender that
// includes them is decoded without error and those payloads are dropped. Native
// histogram and exemplar support is deferred (and would require RW v2 for
// per-series type metadata anyway).

message WriteRequest {
  repeated TimeSeries timeseries = 1;
  // Field 2 is reserved upstream.
  repeated MetricMetadata metadata = 3;
}

message TimeSeries {
  repeated Label labels = 1;
  repeated Sample samples = 2;
}

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

message Sample {
  double value = 1;
  // Milliseconds since the Unix epoch.
  int64 timestamp = 2;
}

message MetricMetadata {
  // Values carry buf's required METRIC_TYPE_ prefix, which upstream omits; the
  // numbers are what the wire format pins, and prost strips the prefix so the
  // generated Rust variants are unchanged. Zero is upstream's UNKNOWN.
  enum MetricType {
    METRIC_TYPE_UNSPECIFIED = 0;
    METRIC_TYPE_COUNTER = 1;
    METRIC_TYPE_GAUGE = 2;
    METRIC_TYPE_HISTOGRAM = 3;
    METRIC_TYPE_GAUGEHISTOGRAM = 4;
    METRIC_TYPE_SUMMARY = 5;
    METRIC_TYPE_INFO = 6;
    METRIC_TYPE_STATESET = 7;
  }

  MetricType type = 1;
  string metric_family_name = 2;
  string help = 4;
  string unit = 5;
}