metrics.proto 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2013 Prometheus Team
  2. // Licensed under the Apache License, Version 2.0 (the "License");
  3. // you may not use this file except in compliance with the License.
  4. // You may obtain a copy of the License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. syntax = "proto2";
  14. package io.prometheus.client;
  15. option java_package = "io.prometheus.client";
  16. message LabelPair {
  17. optional string name = 1;
  18. optional string value = 2;
  19. }
  20. enum MetricType {
  21. COUNTER = 0;
  22. GAUGE = 1;
  23. SUMMARY = 2;
  24. UNTYPED = 3;
  25. HISTOGRAM = 4;
  26. }
  27. message Gauge {
  28. optional double value = 1;
  29. }
  30. message Counter {
  31. optional double value = 1;
  32. }
  33. message Quantile {
  34. optional double quantile = 1;
  35. optional double value = 2;
  36. }
  37. message Summary {
  38. optional uint64 sample_count = 1;
  39. optional double sample_sum = 2;
  40. repeated Quantile quantile = 3;
  41. }
  42. message Untyped {
  43. optional double value = 1;
  44. }
  45. message Histogram {
  46. optional uint64 sample_count = 1;
  47. optional double sample_sum = 2;
  48. repeated Bucket bucket = 3; // Ordered in increasing order of upper_bound, +Inf bucket is optional.
  49. }
  50. message Bucket {
  51. optional uint64 cumulative_count = 1; // Cumulative in increasing order.
  52. optional double upper_bound = 2; // Inclusive.
  53. }
  54. message Metric {
  55. repeated LabelPair label = 1;
  56. optional Gauge gauge = 2;
  57. optional Counter counter = 3;
  58. optional Summary summary = 4;
  59. optional Untyped untyped = 5;
  60. optional Histogram histogram = 7;
  61. optional int64 timestamp_ms = 6;
  62. }
  63. message MetricFamily {
  64. optional string name = 1;
  65. optional string help = 2;
  66. optional MetricType type = 3;
  67. repeated Metric metric = 4;
  68. }