summaryrefslogtreecommitdiffhomepage
path: root/pkg/metric/metric.proto
blob: 53c8b4b50051c9a363dfadbd5e43f21e41510952 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright 2018 The gVisor Authors.
//
// 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.

syntax = "proto3";

package gvisor;

// MetricMetadata contains all of the metadata describing a single metric.
message MetricMetadata {
  // name is the unique name of the metric, usually in a "directory" format
  // (e.g., /foo/count).
  string name = 1;

  // description is a human-readable description of the metric.
  string description = 2;

  // cumulative indicates that this metric is never decremented.
  bool cumulative = 3;

  // sync indicates that values from the final metric event should be
  // synchronized to the backing monitoring system at exit.
  //
  // If sync is false, values are only sent to the monitoring system
  // periodically. There is no guarantee that values will ever be received by
  // the monitoring system.
  bool sync = 4;

  enum Type { TYPE_UINT64 = 0; }

  // type is the type of the metric value.
  Type type = 5;

  enum Units {
    UNITS_NONE = 0;
    UNITS_NANOSECONDS = 1;
  }

  // units is the units of the metric value.
  Units units = 6;

  message Field {
    string field_name = 1;
    repeated string allowed_values = 2;
  }

  // fields contains the metric fields. Currently a metric can have at most
  // one field.
  repeated Field fields = 7;
}

// MetricRegistration contains the metadata for all metrics that will be in
// future MetricUpdates.
message MetricRegistration {
  repeated MetricMetadata metrics = 1;
}

// MetricValue the value of a metric at a single point in time.
message MetricValue {
  // name is the unique name of the metric, as in MetricMetadata.
  string name = 1;

  // value is the value of the metric at a single point in time. The field set
  // depends on the type of the metric.
  oneof value {
    uint64 uint64_value = 2;
  }

  repeated string field_values = 4;
}

// MetricUpdate contains new values for multiple distinct metrics.
//
// Metrics whose values have not changed are not included.
message MetricUpdate {
  repeated MetricValue metrics = 1;
}