github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/pkg/metric/metric.proto (about) 1 // Copyright 2018 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package gvisor; 18 19 // MetricMetadata contains all of the metadata describing a single metric. 20 message MetricMetadata { 21 // name is the unique name of the metric, usually in a "directory" format 22 // (e.g., /foo/count). 23 string name = 1; 24 25 // description is a human-readable description of the metric. 26 string description = 2; 27 28 // cumulative indicates that this metric is never decremented. 29 bool cumulative = 3; 30 31 // sync indicates that values from the final metric event should be 32 // synchronized to the backing monitoring system at exit. 33 // 34 // If sync is false, values are only sent to the monitoring system 35 // periodically. There is no guarantee that values will ever be received by 36 // the monitoring system. 37 bool sync = 4; 38 39 enum Type { TYPE_UINT64 = 0; } 40 41 // type is the type of the metric value. 42 Type type = 5; 43 44 enum Units { 45 UNITS_NONE = 0; 46 UNITS_NANOSECONDS = 1; 47 } 48 49 // units is the units of the metric value. 50 Units units = 6; 51 52 message Field { 53 string field_name = 1; 54 repeated string allowed_values = 2; 55 } 56 57 // fields contains the metric fields. Currently a metric can have at most 58 // one field. 59 repeated Field fields = 7; 60 } 61 62 // MetricRegistration contains the metadata for all metrics that will be in 63 // future MetricUpdates. 64 message MetricRegistration { 65 repeated MetricMetadata metrics = 1; 66 } 67 68 // MetricValue the value of a metric at a single point in time. 69 message MetricValue { 70 // name is the unique name of the metric, as in MetricMetadata. 71 string name = 1; 72 73 // value is the value of the metric at a single point in time. The field set 74 // depends on the type of the metric. 75 oneof value { 76 uint64 uint64_value = 2; 77 } 78 79 repeated string field_values = 4; 80 } 81 82 // MetricUpdate contains new values for multiple distinct metrics. 83 // 84 // Metrics whose values have not changed are not included. 85 message MetricUpdate { 86 repeated MetricValue metrics = 1; 87 }