opencensus.proto.stats.v1.stats.proto Maven / Gradle / Ivy
// Copyright 2016-18, OpenCensus 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 opencensus.proto.stats.v1;
import "google/protobuf/timestamp.proto";
option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/stats/v1";
option java_multiple_files = true;
option java_package = "io.opencensus.proto.stats.v1";
option java_outer_classname = "StatsProto";
// TODO(bdrutu): Consider if this should be moved to a "tags" directory to match the API structure.
message Tag {
string key = 1;
string value = 2;
}
// Measure .
message Measure {
// A string by which the measure will be referred to, e.g. "rpc_server_latency". Names MUST be
// unique within the library.
string name = 1;
// Describes the measure, e.g. "RPC latency in seconds".
string description = 2;
// Describes the unit used for the Measure. Follows the format described by
// http://unitsofmeasure.org/ucum.html.
string unit = 3;
enum Type {
// Unknown type.
TYPE_UNSPECIFIED = 0;
// Indicates an int64 Measure.
INT64 = 1;
// Indicates a double Measure.
DOUBLE = 2;
}
// The type used for this Measure.
Type type = 4;
}
message View {
// A string by which the View will be referred to, e.g. "rpc_latency". Names MUST be unique
// within the library.
string name = 1;
// Describes the view, e.g. "RPC latency distribution"
string description = 2;
// The Measure to which this view is applied.
Measure measure = 3;
// An array of tag keys. These values associated with tags of this name form the basis by which
// individual stats will be aggregated (one aggregation per unique tag value). If none are
// provided, then all data is recorded in a single aggregation.
repeated string columns = 4;
// The description of the aggregation used for this view which describes how data collected are
// aggregated.
oneof aggregation {
// Counts the number of measurements recorded.
CountAggregation count_aggregation = 5;
// Indicates that data collected and aggregated with this Aggregation will be summed up.
SumAggregation sum_aggregation = 6;
// Indicates that data collected and aggregated with this Aggregation will represent the last
// recorded value. This is useful to support Gauges.
LastValueAggregation last_value_aggregation = 7;
// Indicates that the desired Aggregation is a histogram distribution. A distribution
// Aggregation may contain a histogram of the values in the population. User should define the
// bucket boundaries for that histogram (see DistributionAggregation).
DistributionAggregation distribution_aggregation = 8;
}
}
message CountAggregation {}
message SumAggregation {}
message LastValueAggregation {}
message DistributionAggregation {
// A Distribution may optionally contain a histogram of the values in the
// population. The bucket boundaries for that histogram are described by
// `bucket_bounds`. This defines `size(bucket_bounds) + 1` (= N)
// buckets. The boundaries for bucket index i are:
//
// (-infinity, bucket_bounds[i]) for i == 0
// [bucket_bounds[i-1], bucket_bounds[i]) for 0 < i < N-2
// [bucket_bounds[i-1], +infinity) for i == N-1
//
// i.e. an underflow bucket (number 0), zero or more finite buckets (1
// through N - 2, and an overflow bucket (N - 1), with inclusive lower
// bounds and exclusive upper bounds.
//
// If `bucket_bounds` has no elements (zero size), then there is no
// histogram associated with the Distribution. If `bucket_bounds` has only
// one element, there are no finite buckets, and that single element is the
// common boundary of the overflow and underflow buckets. The values must
// be monotonically increasing.
repeated double bucket_bounds = 1;
}
// Describes a data point to be collected for a Measure.
message Measurement {
repeated Tag tags = 1;
// The name of the measure to which the value is applied.
string measure_name = 2;
// The recorded value, MUST have the appropriate type to match the Measure.
oneof value {
double double_value = 3;
int64 int_value = 4;
}
// The time when this measurement was recorded. If the implementation uses a async buffer to
// record measurements this may be the time when the measurement was read from the buffer.
google.protobuf.Timestamp time = 5;
}