mirror of https://github.com/prometheus/prometheus
Browse Source
We cannot just use prometheus/client_model directly because we want to stay consistent with the use of gogo-protobuf. So this converts metrics.proto to proto3 and edits it lightly so that it fits into the framework how prometheus/prometheus handles protobuf. Note that metrics.proto couldn't be merged into the prompb package because prompb already has an Exemplar type, which is different from the Exemplar type in metrics.proto. The directory structure seems to play a role in the protobuf world, so I better kept it. Signed-off-by: beorn7 <beorn@grafana.com>pull/9009/head
Björn Rabenstein
3 years ago
committed by
GitHub
3 changed files with 3930 additions and 2 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,116 @@
|
||||
// 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 "google/protobuf/timestamp.proto"; |
||||
|
||||
message LabelPair { |
||||
string name = 1; |
||||
string value = 2; |
||||
} |
||||
|
||||
enum MetricType { |
||||
COUNTER = 0; |
||||
GAUGE = 1; |
||||
SUMMARY = 2; |
||||
UNTYPED = 3; |
||||
HISTOGRAM = 4; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
message Untyped { |
||||
double value = 1; |
||||
} |
||||
|
||||
message Histogram { |
||||
uint64 sample_count = 1; |
||||
double sample_sum = 2; |
||||
repeated Bucket bucket = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional. |
||||
// Sparse bucket (sb) stuff: |
||||
// The sb_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 sb_schema = 4; |
||||
double sb_zero_threshold = 5; // Breadth of the zero bucket. |
||||
uint64 sb_zero_count = 6; // Count in zero bucket. |
||||
SparseBuckets sb_negative = 7; // Negative sparse buckets. |
||||
SparseBuckets sb_positive = 8; // Positive sparse buckets. |
||||
} |
||||
|
||||
message Bucket { |
||||
uint64 cumulative_count = 1; // Cumulative in increasing order. |
||||
double upper_bound = 2; // Inclusive. |
||||
Exemplar exemplar = 3; |
||||
} |
||||
|
||||
message SparseBuckets { |
||||
message Span { |
||||
sint32 offset = 1; // Gap to previous span, or starting point for 1st span (which can be negative). |
||||
uint32 length = 2; // Length of consecutive buckets. |
||||
} |
||||
repeated Span span = 1; |
||||
repeated sint64 delta = 2; // Count delta of each bucket compared to previous one (or to zero for 1st bucket). |
||||
} |
||||
|
||||
message Exemplar { |
||||
repeated LabelPair label = 1; |
||||
double value = 2; |
||||
google.protobuf.Timestamp timestamp = 3; // OpenMetrics-style. |
||||
} |
||||
|
||||
message Metric { |
||||
repeated LabelPair label = 1; |
||||
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; |
||||
} |
Loading…
Reference in new issue