From 2d7207a98bb86629979e268355d58e995d6c263a Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Sat, 18 Jan 2025 09:36:15 -0700 Subject: [PATCH] update prom remote write for bulk timers Also do some cleanup of stuff we don't need. Signed-off-by: Matt Klein --- thirdparty/gogoproto/gogo.proto | 144 ----------------- .../prompb/io/prometheus/client/metrics.proto | 147 ------------------ thirdparty/prometheus/prompb/remote.proto | 9 +- thirdparty/prometheus/prompb/types.proto | 35 +++-- 4 files changed, 24 insertions(+), 311 deletions(-) delete mode 100644 thirdparty/gogoproto/gogo.proto delete mode 100644 thirdparty/prometheus/prompb/io/prometheus/client/metrics.proto diff --git a/thirdparty/gogoproto/gogo.proto b/thirdparty/gogoproto/gogo.proto deleted file mode 100644 index 8947d90..0000000 --- a/thirdparty/gogoproto/gogo.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; -option go_package = "github.com/gogo/protobuf/gogoproto"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - -} \ No newline at end of file diff --git a/thirdparty/prometheus/prompb/io/prometheus/client/metrics.proto b/thirdparty/prometheus/prompb/io/prometheus/client/metrics.proto deleted file mode 100644 index 6bbea62..0000000 --- a/thirdparty/prometheus/prompb/io/prometheus/client/metrics.proto +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2013 Prometheus Team -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This is copied and lightly edited from -// github.com/prometheus/client_model/io/prometheus/client/metrics.proto -// and finally converted to proto3 syntax to make it usable for the -// gogo-protobuf approach taken within prometheus/prometheus. - -syntax = "proto3"; - -package io.prometheus.client; -option go_package = "io_prometheus_client"; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; - -message LabelPair { - string name = 1; - string value = 2; -} - -enum MetricType { - // COUNTER must use the Metric field "counter". - COUNTER = 0; - // GAUGE must use the Metric field "gauge". - GAUGE = 1; - // SUMMARY must use the Metric field "summary". - SUMMARY = 2; - // UNTYPED must use the Metric field "untyped". - UNTYPED = 3; - // HISTOGRAM must use the Metric field "histogram". - HISTOGRAM = 4; - // GAUGE_HISTOGRAM must use the Metric field "histogram". - GAUGE_HISTOGRAM = 5; -} - -message Gauge { - double value = 1; -} - -message Counter { - double value = 1; - Exemplar exemplar = 2; -} - -message Quantile { - double quantile = 1; - double value = 2; -} - -message Summary { - uint64 sample_count = 1; - double sample_sum = 2; - repeated Quantile quantile = 3 [(gogoproto.nullable) = false]; -} - -message Untyped { - double value = 1; -} - -message Histogram { - uint64 sample_count = 1; - double sample_count_float = 4; // Overrides sample_count if > 0. - double sample_sum = 2; - // Buckets for the conventional histogram. - repeated Bucket bucket = 3 [(gogoproto.nullable) = false]; // Ordered in increasing order of upper_bound, +Inf bucket is optional. - - // Everything below here is for native histograms (also known as sparse histograms). - // Native histograms are an experimental feature without stability guarantees. - - // schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8. - // They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and - // then each power of two is divided into 2^n logarithmic buckets. - // Or in other words, each bucket boundary is the previous boundary times 2^(2^-n). - // In the future, more bucket schemas may be added using numbers < -4 or > 8. - sint32 schema = 5; - double zero_threshold = 6; // Breadth of the zero bucket. - uint64 zero_count = 7; // Count in zero bucket. - double zero_count_float = 8; // Overrides sb_zero_count if > 0. - - // Negative buckets for the native histogram. - repeated BucketSpan negative_span = 9 [(gogoproto.nullable) = false]; - // Use either "negative_delta" or "negative_count", the former for - // regular histograms with integer counts, the latter for float - // histograms. - repeated sint64 negative_delta = 10; // Count delta of each bucket compared to previous one (or to zero for 1st bucket). - repeated double negative_count = 11; // Absolute count of each bucket. - - // Positive buckets for the native histogram. - repeated BucketSpan positive_span = 12 [(gogoproto.nullable) = false]; - // Use either "positive_delta" or "positive_count", the former for - // regular histograms with integer counts, the latter for float - // histograms. - repeated sint64 positive_delta = 13; // Count delta of each bucket compared to previous one (or to zero for 1st bucket). - repeated double positive_count = 14; // Absolute count of each bucket. -} - -message Bucket { - uint64 cumulative_count = 1; // Cumulative in increasing order. - double cumulative_count_float = 4; // Overrides cumulative_count if > 0. - double upper_bound = 2; // Inclusive. - Exemplar exemplar = 3; -} - -// A BucketSpan defines a number of consecutive buckets in a native -// histogram with their offset. Logically, it would be more -// straightforward to include the bucket counts in the Span. However, -// the protobuf representation is more compact in the way the data is -// structured here (with all the buckets in a single array separate -// from the Spans). -message BucketSpan { - sint32 offset = 1; // Gap to previous span, or starting point for 1st span (which can be negative). - uint32 length = 2; // Length of consecutive buckets. -} - -message Exemplar { - repeated LabelPair label = 1 [(gogoproto.nullable) = false]; - double value = 2; - google.protobuf.Timestamp timestamp = 3; // OpenMetrics-style. -} - -message Metric { - repeated LabelPair label = 1 [(gogoproto.nullable) = false]; - Gauge gauge = 2; - Counter counter = 3; - Summary summary = 4; - Untyped untyped = 5; - Histogram histogram = 7; - int64 timestamp_ms = 6; -} - -message MetricFamily { - string name = 1; - string help = 2; - MetricType type = 3; - repeated Metric metric = 4 [(gogoproto.nullable) = false]; -} diff --git a/thirdparty/prometheus/prompb/remote.proto b/thirdparty/prometheus/prompb/remote.proto index 87117a9..4befaed 100644 --- a/thirdparty/prometheus/prompb/remote.proto +++ b/thirdparty/prometheus/prompb/remote.proto @@ -14,17 +14,14 @@ syntax = "proto3"; package prometheus; -option go_package = "prompb"; - import "prometheus/prompb/types.proto"; -import "gogoproto/gogo.proto"; message WriteRequest { - repeated prometheus.TimeSeries timeseries = 1 [(gogoproto.nullable) = false]; + repeated prometheus.TimeSeries timeseries = 1; // 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 [(gogoproto.nullable) = false]; + repeated prometheus.MetricMetadata metadata = 3; // Added as an extension, this field allows us to forward statsd PDUs that fail to parse. repeated string failthrough_statsd_lines = 17; @@ -86,4 +83,4 @@ message ChunkedReadResponse { // query_index represents an index of the query from ReadRequest.queries these chunks relates to. int64 query_index = 2; -} \ No newline at end of file +} diff --git a/thirdparty/prometheus/prompb/types.proto b/thirdparty/prometheus/prompb/types.proto index 129478e..a83ff95 100644 --- a/thirdparty/prometheus/prompb/types.proto +++ b/thirdparty/prometheus/prompb/types.proto @@ -14,10 +14,6 @@ syntax = "proto3"; package prometheus; -option go_package = "prompb"; - -import "gogoproto/gogo.proto"; - message MetricMetadata { enum MetricType { UNKNOWN = 0; @@ -29,9 +25,12 @@ message MetricMetadata { INFO = 6; STATESET = 7; - // added as extensions + // bitdrift extensions DIRECTGAUGE = 100; DELTAGAUGE = 101; + TIMER = 102; + BULKTIMER = 103; + DIRECTCOUNTER = 104; } // Represents the metric type, these match the set from Prometheus. @@ -48,13 +47,21 @@ message Sample { // conversion from time.Time to Prometheus timestamp. int64 timestamp = 2; - // added as an extension, sample_rate is a ratio in the range (0,1]. + // bitdrift extension: sample_rate is a ratio in the range (0,1]. double sample_rate = 100; + // bitdrift extension: bulk values used for the bulk timer metric type. + repeated double bulk_values = 101; +} + +// bitdrift extension +message BulkTimer { + repeated double values = 1; + double sample_rate = 2; } message Exemplar { // Optional, can be empty. - repeated Label labels = 1 [(gogoproto.nullable) = false]; + repeated Label labels = 1; double value = 2; // timestamp is in ms format, see model/timestamp/timestamp.go for // conversion from time.Time to Prometheus timestamp. @@ -65,9 +72,9 @@ message Exemplar { 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 [(gogoproto.nullable) = false]; - repeated Sample samples = 2 [(gogoproto.nullable) = false]; - repeated Exemplar exemplars = 3 [(gogoproto.nullable) = false]; + repeated Label labels = 1; + repeated Sample samples = 2; + repeated Exemplar exemplars = 3; } message Label { @@ -76,7 +83,7 @@ message Label { } message Labels { - repeated Label labels = 1 [(gogoproto.nullable) = false]; + repeated Label labels = 1; } // Matcher specifies a rule, which can match or set of labels or not. @@ -120,7 +127,7 @@ message Chunk { // ChunkedSeries represents single, encoded time series. message ChunkedSeries { // Labels should be sorted. - repeated Label labels = 1 [(gogoproto.nullable) = false]; + repeated Label labels = 1; // Chunks will be in start time order and may overlap. - repeated Chunk chunks = 2 [(gogoproto.nullable) = false]; -} \ No newline at end of file + repeated Chunk chunks = 2; +}