From 013ea77216d2432b7a7b4fba73b5560e3d38e508 Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Mon, 23 May 2016 09:14:25 -0700 Subject: checkpoint --- src/core/ext/census/census.options | 3 + src/core/ext/census/census.proto | 287 ++++++++++++++++++++++++++++++++++++ src/core/ext/census/gen/README.md | 6 + src/core/ext/census/gen/census.pb.c | 168 +++++++++++++++++++++ src/core/ext/census/gen/census.pb.h | 275 ++++++++++++++++++++++++++++++++++ 5 files changed, 739 insertions(+) create mode 100644 src/core/ext/census/census.options create mode 100644 src/core/ext/census/census.proto create mode 100644 src/core/ext/census/gen/README.md create mode 100644 src/core/ext/census/gen/census.pb.c create mode 100644 src/core/ext/census/gen/census.pb.h (limited to 'src/core') diff --git a/src/core/ext/census/census.options b/src/core/ext/census/census.options new file mode 100644 index 0000000000..747740cc3e --- /dev/null +++ b/src/core/ext/census/census.options @@ -0,0 +1,3 @@ +google.census.Tag.key max_size:255 +google.census.Tag.value max_size:255 +google.census.View.tag_keys max_count 15 \ No newline at end of file diff --git a/src/core/ext/census/census.proto b/src/core/ext/census/census.proto new file mode 100644 index 0000000000..6d95402b7b --- /dev/null +++ b/src/core/ext/census/census.proto @@ -0,0 +1,287 @@ +// Copyright 2016, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.census; + +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +// All the census protos. +// +// Nomenclature note: capitalized names below (like Metric) are protos. +// +// Census lets you define a Metric - something which can be measured, like the +// latency of an RPC, the number of CPU cycles spent on an operation, or +// anything else you care to measure. You can record individual instances of +// measurements (a double value) for every metric of interest. These +// individual measurements are aggregated together into an Aggregation. There +// are two Aggregation types available: Distribution (describes the +// distribution of all measurements, possibly with a histogram) and +// IntervalStats (the count and mean of measurements across specified time +// periods). An Aggregation is described by an AggregationDescriptor. +// +// You can define how your stats are broken down by Tag values and which +// Aggregations to use through a View. The corresponding combination of +// Metric/View/Aggregation which is available to census clients is called a +// ViewAggregation. + +// Describes a metric +message Metric { + // name of metric, e.g. rpc_latency, cpu. + string name = 1; + + // More detailed description of the metric, used in documentation. + string description = 2; + + // Fundamental units of measurement supported by Census + // TODO(aveitch): expand this to include other S.I. units? + message BasicUnit { + enum Measure { + UNKNOWN = 0; + BITS = 1; + BYTES = 2; + SECS = 3; + CORES = 4; + MAX_UNITS = 5; + } + Measure type = 1; + } + + // MeasurementUnit lets you build compound units of the form + // 10^n * (A * B * ...) / (X * Y * ...), + // where the elements in the numerator and denominator are all BasicUnits. A + // MeasurementUnit must have at least one BasicUnit in its numerator. + // + // To specify multiplication in the numerator or denominator, simply specify + // multiple numerator or denominator fields. For example: + // + // - byte-seconds (i.e. bytes * seconds): + // numerator: BYTES + // numerator: SECS + // + // - events/sec^2 (i.e. rate of change of events/sec): + // numerator: COUNT + // denominator: SECS + // denominator: SECS + // + // To specify multiples (in power of 10) units, specify a non-zero prefix + // value, for example: + // + // - MB/s (i.e. megabytes / s): + // prefix: 6 + // numerator: BYTES + // denominator: SECS + // + // - nanoseconds + // prefix: -9 + // numerator: SECS + message MeasurementUnit { + int32 prefix = 1; + repeated BasicUnit numerator = 2; + repeated BasicUnit denominator = 3; + } + + // The units in which the Metric value is reported. + MeasurementUnit unit = 3; + + // Metrics will be assigned an ID when registered. Invalid if <= 0. + int32 id = 4; +} + +// An Aggregation summarizes a series of individual Metric measurements, an +// AggregationDescriptor describes an Aggregation +message AggregationDescriptor { + // At most one set of options. + oneof options { + // Defines the histogram bucket boundaries for Distributions + BucketBoundaries bucket_boundaries = 1; + // Defines the time windows to record for IntervalStats + IntervalBoundaries interval_boundaries = 2; + } + + // A Distribution may optionally contain a histogram of the values in the + // population. The bucket boundaries for that histogram is described by + // `bucket_boundaries`. + // + // Describes histogram bucket boundaries. Defines `size(bounds) + 1` (= N) + // buckets, with these boundaries for bucket index i: + // + // [-infinity, bounds[i]) for i == 0 + // [bounds[i-1], bounds[i]) for 0 < i < N-2 + // [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. + // + // There must be at least one element in `bounds`. If `bounds` has only one + // element, there are no finite buckets, and that single element is the + // common boundary of the overflow and underflow buckets. + message BucketBoundaries { + // The values must be monotonically increasing. + repeated double bounds = 1; + } + + // For Interval stats, describe the size of each window. + message IntervalBoundaries { + // For each time window, specify a duration in seconds. + repeated double window_size = 1; + } +} + +// Distribution contains summary statistics for a population of values and, +// optionally, a histogram representing the distribution of those values across +// a specified set of histogram buckets, as defined in +// Aggregation.bucket_options. +// +// The summary statistics are the count, mean, sum of the squared deviation from +// the mean, the minimum, and the maximum of the set of population of values. +// +// Although it is not forbidden, it is generally a bad idea to include +// non-finite values (infinities or NaNs) in the population of values, as this +// will render the `mean` and `sum_of_squared_deviation` fields meaningless. +message Distribution { + // The number of values in the population. Must be non-negative. + int64 count = 1; + + // The arithmetic mean of the values in the population. If `count` is zero + // then this field must be zero. + double mean = 2; + + // The sum of squared deviations from the mean of the values in the + // population. For values x_i this is: + // + // Sum[i=1..n]((x_i - mean)^2) + // + // If `count` is zero then this field must be zero. + double sum_of_squared_deviation = 3; + + // Describes a range of population values. + message Range { + // The minimum of the population values. + double min = 1; + // The maximum of the population values. + double max = 2; + } + + // The range of the population values. If `count` is zero, this field will not + // be defined. + Range range = 4; + + // A Distribution may optionally contain a histogram of the values in the + // population. The histogram is given in `bucket_count` as counts of values + // that fall into one of a sequence of non-overlapping buckets, as described + // by `AggregationDescriptor.options.bucket_boundaries`. + // The sum of the values in `bucket_counts` must equal the value in `count`. + // + // Bucket counts are given in order under the numbering scheme described + // above (the underflow bucket has number 0; the finite buckets, if any, + // have numbers 1 through N-2; the overflow bucket has number N-1). + // + // The size of `bucket_count` must be no greater than N as defined in + // `bucket_boundaries`. + // + // Any suffix of trailing zero bucket_count fields may be omitted. + repeated int64 bucket_count = 5; +} + +// Record summary stats over various time windows. +message IntervalStats { + // Summary statistic over a single time window. + message Window { + // The window duration. + google.protobuf.Duration window_size = 1; + // The number of measurements in this window. + int64 count = 2; + // The arithmetic mean of all measurements in the window. + double mean = 3; + } + + // Full set of windows for this metric. + repeated Window window = 1; +} + +// A Tag: key-value pair +message Tag { + string key = 1; + string value = 2; +} + +// A View specifies an Aggregation and a set of tag keys. The Aggregation will +// be broken down by the unique set of matching tag values for each measurement. +message View { + // Name of view. + string name = 1; + + // More detailed description, for documentation purposes. + string description = 2; + + // ID of Metric to associate with this View. + int32 metric_id = 3; + + // Aggregation type to associate with this View. + AggregationDescriptor aggregation = 4; + + // Tag keys to match with a given Metric. If no keys are specified, then all + // stats for the Metric are recorded. Keys must be unique. + repeated string tag_key = 5; +} + +// An Aggregation summarizes a series of individual Metric measures. +message Aggregation { + // Name of this aggregation. + string name = 1; + + // More detailed description, for documentation purposes. + string description = 2; + + // The data for this Aggregation. + oneof data { + Distribution distribution = 3; + IntervalStats interval_stats = 4; + } + + // Tags associated with this Aggregation. + repeated Tag tag = 5; +} + +// A ViewAggregations represents all the Aggregations for a particular view. +message ViewAggregations { + // Aggregations - each will have a unique set of tag values for the tag_keys + // associated with the corresponding View. + repeated Aggregation aggregation = 1; + + // Start and end timestamps over which the value was accumulated. These + // values are not relevant/defined for IntervalStats aggregations, which are + // always accumulated over a fixed time period. + google.protobuf.Timestamp start = 2; + google.protobuf.Timestamp end = 3; +} diff --git a/src/core/ext/census/gen/README.md b/src/core/ext/census/gen/README.md new file mode 100644 index 0000000000..8f3aeb3b0f --- /dev/null +++ b/src/core/ext/census/gen/README.md @@ -0,0 +1,6 @@ +Files generated for use by Census stats and trace recording subsystem. + +#Files +* census.pb.{h,c} - Generated from src/core/ext/census/census.proto, using the + script `tools/codegen/core/gen_nano_proto.sh src/core/ext/census/census.proto + $PWD/src/core/ext/census/gen` diff --git a/src/core/ext/census/gen/census.pb.c b/src/core/ext/census/gen/census.pb.c new file mode 100644 index 0000000000..a855aaf696 --- /dev/null +++ b/src/core/ext/census/gen/census.pb.c @@ -0,0 +1,168 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* Automatically generated nanopb constant definitions */ +/* Generated by nanopb-0.3.5-dev */ + +#include "/usr/local/google/home/aveitch/projects/grpc_stats/grpc/src/core/ext/census/gen/census.pb.h" + +#if PB_PROTO_HEADER_VERSION != 30 +#error Regenerate this file with the current version of nanopb generator. +#endif + + + +const pb_field_t google_census_Metric_fields[5] = { + PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, google_census_Metric, name, name, 0), + PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, google_census_Metric, description, name, 0), + PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_Metric, unit, description, &google_census_Metric_MeasurementUnit_fields), + PB_FIELD( 4, INT32 , OPTIONAL, STATIC , OTHER, google_census_Metric, id, unit, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Metric_BasicUnit_fields[2] = { + PB_FIELD( 1, UENUM , OPTIONAL, STATIC , FIRST, google_census_Metric_BasicUnit, type, type, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Metric_MeasurementUnit_fields[4] = { + PB_FIELD( 1, INT32 , OPTIONAL, STATIC , FIRST, google_census_Metric_MeasurementUnit, prefix, prefix, 0), + PB_FIELD( 2, MESSAGE , REPEATED, CALLBACK, OTHER, google_census_Metric_MeasurementUnit, numerator, prefix, &google_census_Metric_BasicUnit_fields), + PB_FIELD( 3, MESSAGE , REPEATED, CALLBACK, OTHER, google_census_Metric_MeasurementUnit, denominator, numerator, &google_census_Metric_BasicUnit_fields), + PB_LAST_FIELD +}; + +const pb_field_t google_census_AggregationDescriptor_fields[3] = { + PB_ONEOF_FIELD(options, 1, MESSAGE , ONEOF, STATIC , FIRST, google_census_AggregationDescriptor, bucket_boundaries, bucket_boundaries, &google_census_AggregationDescriptor_BucketBoundaries_fields), + PB_ONEOF_FIELD(options, 2, MESSAGE , ONEOF, STATIC , FIRST, google_census_AggregationDescriptor, interval_boundaries, interval_boundaries, &google_census_AggregationDescriptor_IntervalBoundaries_fields), + PB_LAST_FIELD +}; + +const pb_field_t google_census_AggregationDescriptor_BucketBoundaries_fields[2] = { + PB_FIELD( 1, DOUBLE , REPEATED, CALLBACK, FIRST, google_census_AggregationDescriptor_BucketBoundaries, bounds, bounds, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_AggregationDescriptor_IntervalBoundaries_fields[2] = { + PB_FIELD( 1, DOUBLE , REPEATED, CALLBACK, FIRST, google_census_AggregationDescriptor_IntervalBoundaries, window_size, window_size, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Distribution_fields[6] = { + PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_census_Distribution, count, count, 0), + PB_FIELD( 2, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_Distribution, mean, count, 0), + PB_FIELD( 3, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_Distribution, sum_of_squared_deviation, mean, 0), + PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_Distribution, range, sum_of_squared_deviation, &google_census_Distribution_Range_fields), + PB_FIELD( 5, INT64 , REPEATED, CALLBACK, OTHER, google_census_Distribution, bucket_count, range, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Distribution_Range_fields[3] = { + PB_FIELD( 1, DOUBLE , OPTIONAL, STATIC , FIRST, google_census_Distribution_Range, min, min, 0), + PB_FIELD( 2, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_Distribution_Range, max, min, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_IntervalStats_fields[2] = { + PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, google_census_IntervalStats, window, window, &google_census_IntervalStats_Window_fields), + PB_LAST_FIELD +}; + +const pb_field_t google_census_IntervalStats_Window_fields[4] = { + PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, google_census_IntervalStats_Window, window_size, window_size, &google_protobuf_Duration_fields), + PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, google_census_IntervalStats_Window, count, window_size, 0), + PB_FIELD( 3, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_IntervalStats_Window, mean, count, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Tag_fields[3] = { + PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, google_census_Tag, key, key, 0), + PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, google_census_Tag, value, key, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_View_fields[6] = { + PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, google_census_View, name, name, 0), + PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, google_census_View, description, name, 0), + PB_FIELD( 3, INT32 , OPTIONAL, STATIC , OTHER, google_census_View, metric_id, description, 0), + PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_View, aggregation, metric_id, &google_census_AggregationDescriptor_fields), + PB_FIELD( 5, STRING , REPEATED, CALLBACK, OTHER, google_census_View, tag_key, aggregation, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Aggregation_fields[6] = { + PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, google_census_Aggregation, name, name, 0), + PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, google_census_Aggregation, description, name, 0), + PB_ONEOF_FIELD(data, 3, MESSAGE , ONEOF, STATIC , OTHER, google_census_Aggregation, distribution, description, &google_census_Distribution_fields), + PB_ONEOF_FIELD(data, 4, MESSAGE , ONEOF, STATIC , OTHER, google_census_Aggregation, interval_stats, description, &google_census_IntervalStats_fields), + PB_FIELD( 5, MESSAGE , REPEATED, CALLBACK, OTHER, google_census_Aggregation, tag, data.interval_stats, &google_census_Tag_fields), + PB_LAST_FIELD +}; + +const pb_field_t google_census_ViewAggregations_fields[4] = { + PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, google_census_ViewAggregations, aggregation, aggregation, &google_census_Aggregation_fields), + PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, start, aggregation, &google_protobuf_Timestamp_fields), + PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, end, start, &google_protobuf_Timestamp_fields), + PB_LAST_FIELD +}; + + +/* Check that field information fits in pb_field_t */ +#if !defined(PB_FIELD_32BIT) +/* If you get an error here, it means that you need to define PB_FIELD_32BIT + * compile-time option. You can do that in pb.h or on compiler command line. + * + * The reason you need to do this is that some of your messages contain tag + * numbers or field sizes that are larger than what can fit in 8 or 16 bit + * field descriptors. + */ +PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Distribution, range) < 65536 && pb_membersize(google_census_IntervalStats, window) < 65536 && pb_membersize(google_census_IntervalStats_Window, window_size) < 65536 && pb_membersize(google_census_View, aggregation) < 65536 && pb_membersize(google_census_Aggregation, data.distribution) < 65536 && pb_membersize(google_census_Aggregation, data.interval_stats) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Distribution, range) < 65536 && pb_membersize(google_census_IntervalStats, window) < 65536 && pb_membersize(google_census_IntervalStats_Window, window_size) < 65536 && pb_membersize(google_census_View, aggregation) < 65536 && pb_membersize(google_census_Aggregation, data.distribution) < 65536 && pb_membersize(google_census_Aggregation, data.interval_stats) < 65536 && pb_membersize(google_census_Aggregation, tag) < 65536 && pb_membersize(google_census_ViewAggregations, aggregation) < 65536 && pb_membersize(google_census_ViewAggregations, start) < 65536 && pb_membersize(google_census_ViewAggregations, end) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_census_Metric_google_census_Metric_BasicUnit_google_census_Metric_MeasurementUnit_google_census_AggregationDescriptor_google_census_AggregationDescriptor_BucketBoundaries_google_census_AggregationDescriptor_IntervalBoundaries_google_census_Distribution_google_census_Distribution_Range_google_census_IntervalStats_google_census_IntervalStats_Window_google_census_Tag_google_census_View_google_census_Aggregation_google_census_ViewAggregations) +#endif + +#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) +/* If you get an error here, it means that you need to define PB_FIELD_16BIT + * compile-time option. You can do that in pb.h or on compiler command line. + * + * The reason you need to do this is that some of your messages contain tag + * numbers or field sizes that are larger than what can fit in the default + * 8 bit descriptors. + */ +PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Distribution, range) < 256 && pb_membersize(google_census_IntervalStats, window) < 256 && pb_membersize(google_census_IntervalStats_Window, window_size) < 256 && pb_membersize(google_census_View, aggregation) < 256 && pb_membersize(google_census_Aggregation, data.distribution) < 256 && pb_membersize(google_census_Aggregation, data.interval_stats) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Distribution, range) < 256 && pb_membersize(google_census_IntervalStats, window) < 256 && pb_membersize(google_census_IntervalStats_Window, window_size) < 256 && pb_membersize(google_census_View, aggregation) < 256 && pb_membersize(google_census_Aggregation, data.distribution) < 256 && pb_membersize(google_census_Aggregation, data.interval_stats) < 256 && pb_membersize(google_census_Aggregation, tag) < 256 && pb_membersize(google_census_ViewAggregations, aggregation) < 256 && pb_membersize(google_census_ViewAggregations, start) < 256 && pb_membersize(google_census_ViewAggregations, end) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_census_Metric_google_census_Metric_BasicUnit_google_census_Metric_MeasurementUnit_google_census_AggregationDescriptor_google_census_AggregationDescriptor_BucketBoundaries_google_census_AggregationDescriptor_IntervalBoundaries_google_census_Distribution_google_census_Distribution_Range_google_census_IntervalStats_google_census_IntervalStats_Window_google_census_Tag_google_census_View_google_census_Aggregation_google_census_ViewAggregations) +#endif + + +/* On some platforms (such as AVR), double is really float. + * These are not directly supported by nanopb, but see example_avr_double. + * To get rid of this error, remove any double fields from your .proto. + */ +PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES) + diff --git a/src/core/ext/census/gen/census.pb.h b/src/core/ext/census/gen/census.pb.h new file mode 100644 index 0000000000..315c93fd42 --- /dev/null +++ b/src/core/ext/census/gen/census.pb.h @@ -0,0 +1,275 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* Automatically generated nanopb header */ +/* Generated by nanopb-0.3.5-dev */ + +#ifndef PB_CENSUS_PB_H_INCLUDED +#define PB_CENSUS_PB_H_INCLUDED +#include "third_party/nanopb/pb.h" +#include "google/protobuf/duration.pb.h" + +#include "google/protobuf/timestamp.pb.h" + +#if PB_PROTO_HEADER_VERSION != 30 +#error Regenerate this file with the current version of nanopb generator. +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Enum definitions */ +typedef enum _google_census_Metric_BasicUnit_Measure { + google_census_Metric_BasicUnit_Measure_UNKNOWN = 0, + google_census_Metric_BasicUnit_Measure_BITS = 1, + google_census_Metric_BasicUnit_Measure_BYTES = 2, + google_census_Metric_BasicUnit_Measure_SECS = 3, + google_census_Metric_BasicUnit_Measure_CORES = 4, + google_census_Metric_BasicUnit_Measure_MAX_UNITS = 5 +} google_census_Metric_BasicUnit_Measure; + +/* Struct definitions */ +typedef struct _google_census_AggregationDescriptor_BucketBoundaries { + pb_callback_t bounds; +} google_census_AggregationDescriptor_BucketBoundaries; + +typedef struct _google_census_AggregationDescriptor_IntervalBoundaries { + pb_callback_t window_size; +} google_census_AggregationDescriptor_IntervalBoundaries; + +typedef struct _google_census_IntervalStats { + pb_callback_t window; +} google_census_IntervalStats; + +typedef struct _google_census_AggregationDescriptor { + pb_size_t which_options; + union { + google_census_AggregationDescriptor_BucketBoundaries bucket_boundaries; + google_census_AggregationDescriptor_IntervalBoundaries interval_boundaries; + } options; +} google_census_AggregationDescriptor; + +typedef struct _google_census_Distribution_Range { + bool has_min; + double min; + bool has_max; + double max; +} google_census_Distribution_Range; + +typedef struct _google_census_IntervalStats_Window { + bool has_window_size; + google_protobuf_Duration window_size; + bool has_count; + int64_t count; + bool has_mean; + double mean; +} google_census_IntervalStats_Window; + +typedef struct _google_census_Metric_BasicUnit { + bool has_type; + google_census_Metric_BasicUnit_Measure type; +} google_census_Metric_BasicUnit; + +typedef struct _google_census_Metric_MeasurementUnit { + bool has_prefix; + int32_t prefix; + pb_callback_t numerator; + pb_callback_t denominator; +} google_census_Metric_MeasurementUnit; + +typedef struct _google_census_Tag { + bool has_key; + char key[255]; + bool has_value; + char value[255]; +} google_census_Tag; + +typedef struct _google_census_ViewAggregations { + pb_callback_t aggregation; + bool has_start; + google_protobuf_Timestamp start; + bool has_end; + google_protobuf_Timestamp end; +} google_census_ViewAggregations; + +typedef struct _google_census_Distribution { + bool has_count; + int64_t count; + bool has_mean; + double mean; + bool has_sum_of_squared_deviation; + double sum_of_squared_deviation; + bool has_range; + google_census_Distribution_Range range; + pb_callback_t bucket_count; +} google_census_Distribution; + +typedef struct _google_census_Metric { + pb_callback_t name; + pb_callback_t description; + bool has_unit; + google_census_Metric_MeasurementUnit unit; + bool has_id; + int32_t id; +} google_census_Metric; + +typedef struct _google_census_View { + pb_callback_t name; + pb_callback_t description; + bool has_metric_id; + int32_t metric_id; + bool has_aggregation; + google_census_AggregationDescriptor aggregation; + pb_callback_t tag_key; +} google_census_View; + +typedef struct _google_census_Aggregation { + pb_callback_t name; + pb_callback_t description; + pb_size_t which_data; + union { + google_census_Distribution distribution; + google_census_IntervalStats interval_stats; + } data; + pb_callback_t tag; +} google_census_Aggregation; + +/* Default values for struct fields */ + +/* Initializer values for message structs */ +#define google_census_Metric_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, google_census_Metric_MeasurementUnit_init_default, false, 0} +#define google_census_Metric_BasicUnit_init_default {false, (google_census_Metric_BasicUnit_Measure)0} +#define google_census_Metric_MeasurementUnit_init_default {false, 0, {{NULL}, NULL}, {{NULL}, NULL}} +#define google_census_AggregationDescriptor_init_default {0, {google_census_AggregationDescriptor_BucketBoundaries_init_default}} +#define google_census_AggregationDescriptor_BucketBoundaries_init_default {{{NULL}, NULL}} +#define google_census_AggregationDescriptor_IntervalBoundaries_init_default {{{NULL}, NULL}} +#define google_census_Distribution_init_default {false, 0, false, 0, false, 0, false, google_census_Distribution_Range_init_default, {{NULL}, NULL}} +#define google_census_Distribution_Range_init_default {false, 0, false, 0} +#define google_census_IntervalStats_init_default {{{NULL}, NULL}} +#define google_census_IntervalStats_Window_init_default {false, google_protobuf_Duration_init_default, false, 0, false, 0} +#define google_census_Tag_init_default {false, "", false, ""} +#define google_census_View_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, 0, false, google_census_AggregationDescriptor_init_default, {{NULL}, NULL}} +#define google_census_Aggregation_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, {google_census_Distribution_init_default}, {{NULL}, NULL}} +#define google_census_ViewAggregations_init_default {{{NULL}, NULL}, false, google_protobuf_Timestamp_init_default, false, google_protobuf_Timestamp_init_default} +#define google_census_Metric_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, google_census_Metric_MeasurementUnit_init_zero, false, 0} +#define google_census_Metric_BasicUnit_init_zero {false, (google_census_Metric_BasicUnit_Measure)0} +#define google_census_Metric_MeasurementUnit_init_zero {false, 0, {{NULL}, NULL}, {{NULL}, NULL}} +#define google_census_AggregationDescriptor_init_zero {0, {google_census_AggregationDescriptor_BucketBoundaries_init_zero}} +#define google_census_AggregationDescriptor_BucketBoundaries_init_zero {{{NULL}, NULL}} +#define google_census_AggregationDescriptor_IntervalBoundaries_init_zero {{{NULL}, NULL}} +#define google_census_Distribution_init_zero {false, 0, false, 0, false, 0, false, google_census_Distribution_Range_init_zero, {{NULL}, NULL}} +#define google_census_Distribution_Range_init_zero {false, 0, false, 0} +#define google_census_IntervalStats_init_zero {{{NULL}, NULL}} +#define google_census_IntervalStats_Window_init_zero {false, google_protobuf_Duration_init_zero, false, 0, false, 0} +#define google_census_Tag_init_zero {false, "", false, ""} +#define google_census_View_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, 0, false, google_census_AggregationDescriptor_init_zero, {{NULL}, NULL}} +#define google_census_Aggregation_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, {google_census_Distribution_init_zero}, {{NULL}, NULL}} +#define google_census_ViewAggregations_init_zero {{{NULL}, NULL}, false, google_protobuf_Timestamp_init_zero, false, google_protobuf_Timestamp_init_zero} + +/* Field tags (for use in manual encoding/decoding) */ +#define google_census_AggregationDescriptor_BucketBoundaries_bounds_tag 1 +#define google_census_AggregationDescriptor_IntervalBoundaries_window_size_tag 1 +#define google_census_IntervalStats_window_tag 1 +#define google_census_AggregationDescriptor_bucket_boundaries_tag 1 + +#define google_census_AggregationDescriptor_interval_boundaries_tag 2 +#define google_census_Distribution_Range_min_tag 1 +#define google_census_Distribution_Range_max_tag 2 +#define google_census_IntervalStats_Window_window_size_tag 1 +#define google_census_IntervalStats_Window_count_tag 2 +#define google_census_IntervalStats_Window_mean_tag 3 +#define google_census_Metric_BasicUnit_type_tag 1 +#define google_census_Metric_MeasurementUnit_prefix_tag 1 +#define google_census_Metric_MeasurementUnit_numerator_tag 2 +#define google_census_Metric_MeasurementUnit_denominator_tag 3 +#define google_census_Tag_key_tag 1 +#define google_census_Tag_value_tag 2 +#define google_census_ViewAggregations_aggregation_tag 1 +#define google_census_ViewAggregations_start_tag 2 +#define google_census_ViewAggregations_end_tag 3 +#define google_census_Distribution_count_tag 1 +#define google_census_Distribution_mean_tag 2 +#define google_census_Distribution_sum_of_squared_deviation_tag 3 +#define google_census_Distribution_range_tag 4 +#define google_census_Distribution_bucket_count_tag 5 +#define google_census_Metric_name_tag 1 +#define google_census_Metric_description_tag 2 +#define google_census_Metric_unit_tag 3 +#define google_census_Metric_id_tag 4 +#define google_census_View_name_tag 1 +#define google_census_View_description_tag 2 +#define google_census_View_metric_id_tag 3 +#define google_census_View_aggregation_tag 4 +#define google_census_View_tag_key_tag 5 +#define google_census_Aggregation_distribution_tag 3 + +#define google_census_Aggregation_interval_stats_tag 4 +#define google_census_Aggregation_name_tag 1 +#define google_census_Aggregation_description_tag 2 +#define google_census_Aggregation_tag_tag 5 + +/* Struct field encoding specification for nanopb */ +extern const pb_field_t google_census_Metric_fields[5]; +extern const pb_field_t google_census_Metric_BasicUnit_fields[2]; +extern const pb_field_t google_census_Metric_MeasurementUnit_fields[4]; +extern const pb_field_t google_census_AggregationDescriptor_fields[3]; +extern const pb_field_t google_census_AggregationDescriptor_BucketBoundaries_fields[2]; +extern const pb_field_t google_census_AggregationDescriptor_IntervalBoundaries_fields[2]; +extern const pb_field_t google_census_Distribution_fields[6]; +extern const pb_field_t google_census_Distribution_Range_fields[3]; +extern const pb_field_t google_census_IntervalStats_fields[2]; +extern const pb_field_t google_census_IntervalStats_Window_fields[4]; +extern const pb_field_t google_census_Tag_fields[3]; +extern const pb_field_t google_census_View_fields[6]; +extern const pb_field_t google_census_Aggregation_fields[6]; +extern const pb_field_t google_census_ViewAggregations_fields[4]; + +/* Maximum encoded size of messages (where known) */ +#define google_census_Metric_BasicUnit_size 2 +#define google_census_Distribution_Range_size 18 +#define google_census_IntervalStats_Window_size 44 +#define google_census_Tag_size 516 + +/* Message IDs (where set with "msgid" option) */ +#ifdef PB_MSGID + +#define CENSUS_MESSAGES \ + + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif -- cgit v1.2.3 From 30fe63243a99b643f0213ce34b5093aa0750ab31 Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Mon, 23 May 2016 10:11:28 -0700 Subject: end-to-end compilation --- BUILD | 6 ++ Makefile | 2 + binding.gyp | 1 + build.yaml | 2 + config.m4 | 2 + gRPC.podspec | 3 + grpc.gemspec | 2 + package.xml | 2 + src/core/ext/census/census.proto | 58 ++++++++++---- src/core/ext/census/gen/census.pb.c | 29 ++++--- src/core/ext/census/gen/census.pb.h | 93 +++++++++++++--------- src/python/grpcio/grpc_core_dependencies.py | 1 + tools/doxygen/Doxyfile.core.internal | 2 + tools/run_tests/sources_and_headers.json | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 9 +++ .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 9 +++ 18 files changed, 167 insertions(+), 63 deletions(-) (limited to 'src/core') diff --git a/BUILD b/BUILD index 793c1c714d..b5da6df8fc 100644 --- a/BUILD +++ b/BUILD @@ -292,6 +292,7 @@ cc_library( "src/core/ext/census/aggregation.h", "src/core/ext/census/census_interface.h", "src/core/ext/census/census_rpc_stats.h", + "src/core/ext/census/gen/census.pb.h", "src/core/ext/census/grpc_filter.h", "src/core/ext/census/mlog.h", "src/core/ext/census/rpc_metric_id.h", @@ -452,6 +453,7 @@ cc_library( "src/core/ext/resolver/dns/native/dns_resolver.c", "src/core/ext/resolver/sockaddr/sockaddr_resolver.c", "src/core/ext/census/context.c", + "src/core/ext/census/gen/census.pb.c", "src/core/ext/census/grpc_context.c", "src/core/ext/census/grpc_filter.c", "src/core/ext/census/grpc_plugin.c", @@ -630,6 +632,7 @@ cc_library( "src/core/ext/census/aggregation.h", "src/core/ext/census/census_interface.h", "src/core/ext/census/census_rpc_stats.h", + "src/core/ext/census/gen/census.pb.h", "src/core/ext/census/grpc_filter.h", "src/core/ext/census/mlog.h", "src/core/ext/census/rpc_metric_id.h", @@ -767,6 +770,7 @@ cc_library( "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/census/context.c", + "src/core/ext/census/gen/census.pb.c", "src/core/ext/census/grpc_context.c", "src/core/ext/census/grpc_filter.c", "src/core/ext/census/grpc_plugin.c", @@ -1484,6 +1488,7 @@ objc_library( "src/core/ext/resolver/dns/native/dns_resolver.c", "src/core/ext/resolver/sockaddr/sockaddr_resolver.c", "src/core/ext/census/context.c", + "src/core/ext/census/gen/census.pb.c", "src/core/ext/census/grpc_context.c", "src/core/ext/census/grpc_filter.c", "src/core/ext/census/grpc_plugin.c", @@ -1656,6 +1661,7 @@ objc_library( "src/core/ext/census/aggregation.h", "src/core/ext/census/census_interface.h", "src/core/ext/census/census_rpc_stats.h", + "src/core/ext/census/gen/census.pb.h", "src/core/ext/census/grpc_filter.h", "src/core/ext/census/mlog.h", "src/core/ext/census/rpc_metric_id.h", diff --git a/Makefile b/Makefile index 42cedf51c3..bd5f3dfad7 100644 --- a/Makefile +++ b/Makefile @@ -2652,6 +2652,7 @@ LIBGRPC_SRC = \ src/core/ext/resolver/dns/native/dns_resolver.c \ src/core/ext/resolver/sockaddr/sockaddr_resolver.c \ src/core/ext/census/context.c \ + src/core/ext/census/gen/census.pb.c \ src/core/ext/census/grpc_context.c \ src/core/ext/census/grpc_filter.c \ src/core/ext/census/grpc_plugin.c \ @@ -2975,6 +2976,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/census/context.c \ + src/core/ext/census/gen/census.pb.c \ src/core/ext/census/grpc_context.c \ src/core/ext/census/grpc_filter.c \ src/core/ext/census/grpc_plugin.c \ diff --git a/binding.gyp b/binding.gyp index 760bb24d72..d2b63e35d2 100644 --- a/binding.gyp +++ b/binding.gyp @@ -723,6 +723,7 @@ 'src/core/ext/resolver/dns/native/dns_resolver.c', 'src/core/ext/resolver/sockaddr/sockaddr_resolver.c', 'src/core/ext/census/context.c', + 'src/core/ext/census/gen/census.pb.c', 'src/core/ext/census/grpc_context.c', 'src/core/ext/census/grpc_filter.c', 'src/core/ext/census/grpc_plugin.c', diff --git a/build.yaml b/build.yaml index ac61612da4..88a23f78a5 100644 --- a/build.yaml +++ b/build.yaml @@ -16,11 +16,13 @@ filegroups: - src/core/ext/census/aggregation.h - src/core/ext/census/census_interface.h - src/core/ext/census/census_rpc_stats.h + - src/core/ext/census/gen/census.pb.h - src/core/ext/census/grpc_filter.h - src/core/ext/census/mlog.h - src/core/ext/census/rpc_metric_id.h src: - src/core/ext/census/context.c + - src/core/ext/census/gen/census.pb.c - src/core/ext/census/grpc_context.c - src/core/ext/census/grpc_filter.c - src/core/ext/census/grpc_plugin.c diff --git a/config.m4 b/config.m4 index 6ed1887fef..80f86386a2 100644 --- a/config.m4 +++ b/config.m4 @@ -242,6 +242,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/resolver/dns/native/dns_resolver.c \ src/core/ext/resolver/sockaddr/sockaddr_resolver.c \ src/core/ext/census/context.c \ + src/core/ext/census/gen/census.pb.c \ src/core/ext/census/grpc_context.c \ src/core/ext/census/grpc_filter.c \ src/core/ext/census/grpc_plugin.c \ @@ -557,6 +558,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/boringssl) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/census) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/census/gen) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/client_config) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1) diff --git a/gRPC.podspec b/gRPC.podspec index 67e7a8174f..4cd3de0023 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -299,6 +299,7 @@ Pod::Spec.new do |s| 'src/core/ext/census/aggregation.h', 'src/core/ext/census/census_interface.h', 'src/core/ext/census/census_rpc_stats.h', + 'src/core/ext/census/gen/census.pb.h', 'src/core/ext/census/grpc_filter.h', 'src/core/ext/census/mlog.h', 'src/core/ext/census/rpc_metric_id.h', @@ -492,6 +493,7 @@ Pod::Spec.new do |s| 'src/core/ext/resolver/dns/native/dns_resolver.c', 'src/core/ext/resolver/sockaddr/sockaddr_resolver.c', 'src/core/ext/census/context.c', + 'src/core/ext/census/gen/census.pb.c', 'src/core/ext/census/grpc_context.c', 'src/core/ext/census/grpc_filter.c', 'src/core/ext/census/grpc_plugin.c', @@ -649,6 +651,7 @@ Pod::Spec.new do |s| 'src/core/ext/census/aggregation.h', 'src/core/ext/census/census_interface.h', 'src/core/ext/census/census_rpc_stats.h', + 'src/core/ext/census/gen/census.pb.h', 'src/core/ext/census/grpc_filter.h', 'src/core/ext/census/mlog.h', 'src/core/ext/census/rpc_metric_id.h' diff --git a/grpc.gemspec b/grpc.gemspec index 13aed6b61c..d082f1aea5 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -308,6 +308,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/census/aggregation.h ) s.files += %w( src/core/ext/census/census_interface.h ) s.files += %w( src/core/ext/census/census_rpc_stats.h ) + s.files += %w( src/core/ext/census/gen/census.pb.h ) s.files += %w( src/core/ext/census/grpc_filter.h ) s.files += %w( src/core/ext/census/mlog.h ) s.files += %w( src/core/ext/census/rpc_metric_id.h ) @@ -471,6 +472,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/resolver/dns/native/dns_resolver.c ) s.files += %w( src/core/ext/resolver/sockaddr/sockaddr_resolver.c ) s.files += %w( src/core/ext/census/context.c ) + s.files += %w( src/core/ext/census/gen/census.pb.c ) s.files += %w( src/core/ext/census/grpc_context.c ) s.files += %w( src/core/ext/census/grpc_filter.c ) s.files += %w( src/core/ext/census/grpc_plugin.c ) diff --git a/package.xml b/package.xml index 33a769a7e9..461b774158 100644 --- a/package.xml +++ b/package.xml @@ -315,6 +315,7 @@ + @@ -478,6 +479,7 @@ + diff --git a/src/core/ext/census/census.proto b/src/core/ext/census/census.proto index 6d95402b7b..8aa9610178 100644 --- a/src/core/ext/census/census.proto +++ b/src/core/ext/census/census.proto @@ -31,9 +31,6 @@ syntax = "proto3"; package google.census; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - // All the census protos. // // Nomenclature note: capitalized names below (like Metric) are protos. @@ -53,6 +50,41 @@ import "google/protobuf/timestamp.proto"; // Metric/View/Aggregation which is available to census clients is called a // ViewAggregation. + +// The following two types are copied from +// google/protobuf/{duration,timestamp}.proto. Ideally, we would be able to +// import them, but this causes compilation issues on C-based systems +// (e.g. https://koti.kapsi.fi/jpa/nanopb/), which cannot process the C++ +// headers generated from the standard protobuf distribution. See the relevant +// proto files for full documentation of these types. + +message Duration { + // Signed seconds of the span of time. Must be from -315,576,000,000 + // to +315,576,000,000 inclusive. + int64 seconds = 1; + + // Signed fractions of a second at nanosecond resolution of the span + // of time. Durations less than one second are represented with a 0 + // `seconds` field and a positive or negative `nanos` field. For durations + // of one second or more, a non-zero value for the `nanos` field must be + // of the same sign as the `seconds` field. Must be from -999,999,999 + // to +999,999,999 inclusive. + int32 nanos = 2; +} + +message Timestamp { + // Represents seconds of UTC time since Unix epoch + // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + // 9999-12-31T23:59:59Z inclusive. + int64 seconds = 1; + + // Non-negative fractions of a second at nanosecond resolution. Negative + // second values with fractions must still have non-negative nanos values + // that count forward in time. Must be from 0 to 999,999,999 + // inclusive. + int32 nanos = 2; +} + // Describes a metric message Metric { // name of metric, e.g. rpc_latency, cpu. @@ -167,7 +199,7 @@ message AggregationDescriptor { // // Although it is not forbidden, it is generally a bad idea to include // non-finite values (infinities or NaNs) in the population of values, as this -// will render the `mean` and `sum_of_squared_deviation` fields meaningless. +// will render the `mean` field meaningless. message Distribution { // The number of values in the population. Must be non-negative. int64 count = 1; @@ -176,14 +208,6 @@ message Distribution { // then this field must be zero. double mean = 2; - // The sum of squared deviations from the mean of the values in the - // population. For values x_i this is: - // - // Sum[i=1..n]((x_i - mean)^2) - // - // If `count` is zero then this field must be zero. - double sum_of_squared_deviation = 3; - // Describes a range of population values. message Range { // The minimum of the population values. @@ -194,7 +218,7 @@ message Distribution { // The range of the population values. If `count` is zero, this field will not // be defined. - Range range = 4; + Range range = 3; // A Distribution may optionally contain a histogram of the values in the // population. The histogram is given in `bucket_count` as counts of values @@ -210,7 +234,7 @@ message Distribution { // `bucket_boundaries`. // // Any suffix of trailing zero bucket_count fields may be omitted. - repeated int64 bucket_count = 5; + repeated int64 bucket_count = 4; } // Record summary stats over various time windows. @@ -218,7 +242,7 @@ message IntervalStats { // Summary statistic over a single time window. message Window { // The window duration. - google.protobuf.Duration window_size = 1; + Duration window_size = 1; // The number of measurements in this window. int64 count = 2; // The arithmetic mean of all measurements in the window. @@ -282,6 +306,6 @@ message ViewAggregations { // Start and end timestamps over which the value was accumulated. These // values are not relevant/defined for IntervalStats aggregations, which are // always accumulated over a fixed time period. - google.protobuf.Timestamp start = 2; - google.protobuf.Timestamp end = 3; + Timestamp start = 2; + Timestamp end = 3; } diff --git a/src/core/ext/census/gen/census.pb.c b/src/core/ext/census/gen/census.pb.c index a855aaf696..2c41002b5e 100644 --- a/src/core/ext/census/gen/census.pb.c +++ b/src/core/ext/census/gen/census.pb.c @@ -41,6 +41,18 @@ +const pb_field_t google_census_Duration_fields[3] = { + PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_census_Duration, seconds, seconds, 0), + PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_census_Duration, nanos, seconds, 0), + PB_LAST_FIELD +}; + +const pb_field_t google_census_Timestamp_fields[3] = { + PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_census_Timestamp, seconds, seconds, 0), + PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_census_Timestamp, nanos, seconds, 0), + PB_LAST_FIELD +}; + const pb_field_t google_census_Metric_fields[5] = { PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, google_census_Metric, name, name, 0), PB_FIELD( 2, STRING , OPTIONAL, CALLBACK, OTHER, google_census_Metric, description, name, 0), @@ -77,12 +89,11 @@ const pb_field_t google_census_AggregationDescriptor_IntervalBoundaries_fields[2 PB_LAST_FIELD }; -const pb_field_t google_census_Distribution_fields[6] = { +const pb_field_t google_census_Distribution_fields[5] = { PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_census_Distribution, count, count, 0), PB_FIELD( 2, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_Distribution, mean, count, 0), - PB_FIELD( 3, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_Distribution, sum_of_squared_deviation, mean, 0), - PB_FIELD( 4, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_Distribution, range, sum_of_squared_deviation, &google_census_Distribution_Range_fields), - PB_FIELD( 5, INT64 , REPEATED, CALLBACK, OTHER, google_census_Distribution, bucket_count, range, 0), + PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_Distribution, range, mean, &google_census_Distribution_Range_fields), + PB_FIELD( 4, INT64 , REPEATED, CALLBACK, OTHER, google_census_Distribution, bucket_count, range, 0), PB_LAST_FIELD }; @@ -98,7 +109,7 @@ const pb_field_t google_census_IntervalStats_fields[2] = { }; const pb_field_t google_census_IntervalStats_Window_fields[4] = { - PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, google_census_IntervalStats_Window, window_size, window_size, &google_protobuf_Duration_fields), + PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, google_census_IntervalStats_Window, window_size, window_size, &google_census_Duration_fields), PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, google_census_IntervalStats_Window, count, window_size, 0), PB_FIELD( 3, DOUBLE , OPTIONAL, STATIC , OTHER, google_census_IntervalStats_Window, mean, count, 0), PB_LAST_FIELD @@ -130,8 +141,8 @@ const pb_field_t google_census_Aggregation_fields[6] = { const pb_field_t google_census_ViewAggregations_fields[4] = { PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, google_census_ViewAggregations, aggregation, aggregation, &google_census_Aggregation_fields), - PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, start, aggregation, &google_protobuf_Timestamp_fields), - PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, end, start, &google_protobuf_Timestamp_fields), + PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, start, aggregation, &google_census_Timestamp_fields), + PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, end, start, &google_census_Timestamp_fields), PB_LAST_FIELD }; @@ -145,7 +156,7 @@ const pb_field_t google_census_ViewAggregations_fields[4] = { * numbers or field sizes that are larger than what can fit in 8 or 16 bit * field descriptors. */ -PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Distribution, range) < 65536 && pb_membersize(google_census_IntervalStats, window) < 65536 && pb_membersize(google_census_IntervalStats_Window, window_size) < 65536 && pb_membersize(google_census_View, aggregation) < 65536 && pb_membersize(google_census_Aggregation, data.distribution) < 65536 && pb_membersize(google_census_Aggregation, data.interval_stats) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Distribution, range) < 65536 && pb_membersize(google_census_IntervalStats, window) < 65536 && pb_membersize(google_census_IntervalStats_Window, window_size) < 65536 && pb_membersize(google_census_View, aggregation) < 65536 && pb_membersize(google_census_Aggregation, data.distribution) < 65536 && pb_membersize(google_census_Aggregation, data.interval_stats) < 65536 && pb_membersize(google_census_Aggregation, tag) < 65536 && pb_membersize(google_census_ViewAggregations, aggregation) < 65536 && pb_membersize(google_census_ViewAggregations, start) < 65536 && pb_membersize(google_census_ViewAggregations, end) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_census_Metric_google_census_Metric_BasicUnit_google_census_Metric_MeasurementUnit_google_census_AggregationDescriptor_google_census_AggregationDescriptor_BucketBoundaries_google_census_AggregationDescriptor_IntervalBoundaries_google_census_Distribution_google_census_Distribution_Range_google_census_IntervalStats_google_census_IntervalStats_Window_google_census_Tag_google_census_View_google_census_Aggregation_google_census_ViewAggregations) +PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Distribution, range) < 65536 && pb_membersize(google_census_IntervalStats, window) < 65536 && pb_membersize(google_census_IntervalStats_Window, window_size) < 65536 && pb_membersize(google_census_View, aggregation) < 65536 && pb_membersize(google_census_Aggregation, data.distribution) < 65536 && pb_membersize(google_census_Aggregation, data.interval_stats) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Metric, unit) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 65536 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 65536 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 65536 && pb_membersize(google_census_Distribution, range) < 65536 && pb_membersize(google_census_IntervalStats, window) < 65536 && pb_membersize(google_census_IntervalStats_Window, window_size) < 65536 && pb_membersize(google_census_View, aggregation) < 65536 && pb_membersize(google_census_Aggregation, data.distribution) < 65536 && pb_membersize(google_census_Aggregation, data.interval_stats) < 65536 && pb_membersize(google_census_Aggregation, tag) < 65536 && pb_membersize(google_census_ViewAggregations, aggregation) < 65536 && pb_membersize(google_census_ViewAggregations, start) < 65536 && pb_membersize(google_census_ViewAggregations, end) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_google_census_Duration_google_census_Timestamp_google_census_Metric_google_census_Metric_BasicUnit_google_census_Metric_MeasurementUnit_google_census_AggregationDescriptor_google_census_AggregationDescriptor_BucketBoundaries_google_census_AggregationDescriptor_IntervalBoundaries_google_census_Distribution_google_census_Distribution_Range_google_census_IntervalStats_google_census_IntervalStats_Window_google_census_Tag_google_census_View_google_census_Aggregation_google_census_ViewAggregations) #endif #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) @@ -156,7 +167,7 @@ PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 65536 && pb_member * numbers or field sizes that are larger than what can fit in the default * 8 bit descriptors. */ -PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Distribution, range) < 256 && pb_membersize(google_census_IntervalStats, window) < 256 && pb_membersize(google_census_IntervalStats_Window, window_size) < 256 && pb_membersize(google_census_View, aggregation) < 256 && pb_membersize(google_census_Aggregation, data.distribution) < 256 && pb_membersize(google_census_Aggregation, data.interval_stats) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Distribution, range) < 256 && pb_membersize(google_census_IntervalStats, window) < 256 && pb_membersize(google_census_IntervalStats_Window, window_size) < 256 && pb_membersize(google_census_View, aggregation) < 256 && pb_membersize(google_census_Aggregation, data.distribution) < 256 && pb_membersize(google_census_Aggregation, data.interval_stats) < 256 && pb_membersize(google_census_Aggregation, tag) < 256 && pb_membersize(google_census_ViewAggregations, aggregation) < 256 && pb_membersize(google_census_ViewAggregations, start) < 256 && pb_membersize(google_census_ViewAggregations, end) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_census_Metric_google_census_Metric_BasicUnit_google_census_Metric_MeasurementUnit_google_census_AggregationDescriptor_google_census_AggregationDescriptor_BucketBoundaries_google_census_AggregationDescriptor_IntervalBoundaries_google_census_Distribution_google_census_Distribution_Range_google_census_IntervalStats_google_census_IntervalStats_Window_google_census_Tag_google_census_View_google_census_Aggregation_google_census_ViewAggregations) +PB_STATIC_ASSERT((pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Distribution, range) < 256 && pb_membersize(google_census_IntervalStats, window) < 256 && pb_membersize(google_census_IntervalStats_Window, window_size) < 256 && pb_membersize(google_census_View, aggregation) < 256 && pb_membersize(google_census_Aggregation, data.distribution) < 256 && pb_membersize(google_census_Aggregation, data.interval_stats) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Metric, unit) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, numerator) < 256 && pb_membersize(google_census_Metric_MeasurementUnit, denominator) < 256 && pb_membersize(google_census_AggregationDescriptor, options.bucket_boundaries) < 256 && pb_membersize(google_census_AggregationDescriptor, options.interval_boundaries) < 256 && pb_membersize(google_census_Distribution, range) < 256 && pb_membersize(google_census_IntervalStats, window) < 256 && pb_membersize(google_census_IntervalStats_Window, window_size) < 256 && pb_membersize(google_census_View, aggregation) < 256 && pb_membersize(google_census_Aggregation, data.distribution) < 256 && pb_membersize(google_census_Aggregation, data.interval_stats) < 256 && pb_membersize(google_census_Aggregation, tag) < 256 && pb_membersize(google_census_ViewAggregations, aggregation) < 256 && pb_membersize(google_census_ViewAggregations, start) < 256 && pb_membersize(google_census_ViewAggregations, end) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_google_census_Duration_google_census_Timestamp_google_census_Metric_google_census_Metric_BasicUnit_google_census_Metric_MeasurementUnit_google_census_AggregationDescriptor_google_census_AggregationDescriptor_BucketBoundaries_google_census_AggregationDescriptor_IntervalBoundaries_google_census_Distribution_google_census_Distribution_Range_google_census_IntervalStats_google_census_IntervalStats_Window_google_census_Tag_google_census_View_google_census_Aggregation_google_census_ViewAggregations) #endif diff --git a/src/core/ext/census/gen/census.pb.h b/src/core/ext/census/gen/census.pb.h index 315c93fd42..fe263988c3 100644 --- a/src/core/ext/census/gen/census.pb.h +++ b/src/core/ext/census/gen/census.pb.h @@ -36,10 +36,6 @@ #ifndef PB_CENSUS_PB_H_INCLUDED #define PB_CENSUS_PB_H_INCLUDED #include "third_party/nanopb/pb.h" -#include "google/protobuf/duration.pb.h" - -#include "google/protobuf/timestamp.pb.h" - #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. #endif @@ -86,14 +82,12 @@ typedef struct _google_census_Distribution_Range { double max; } google_census_Distribution_Range; -typedef struct _google_census_IntervalStats_Window { - bool has_window_size; - google_protobuf_Duration window_size; - bool has_count; - int64_t count; - bool has_mean; - double mean; -} google_census_IntervalStats_Window; +typedef struct _google_census_Duration { + bool has_seconds; + int64_t seconds; + bool has_nanos; + int32_t nanos; +} google_census_Duration; typedef struct _google_census_Metric_BasicUnit { bool has_type; @@ -114,26 +108,32 @@ typedef struct _google_census_Tag { char value[255]; } google_census_Tag; -typedef struct _google_census_ViewAggregations { - pb_callback_t aggregation; - bool has_start; - google_protobuf_Timestamp start; - bool has_end; - google_protobuf_Timestamp end; -} google_census_ViewAggregations; +typedef struct _google_census_Timestamp { + bool has_seconds; + int64_t seconds; + bool has_nanos; + int32_t nanos; +} google_census_Timestamp; typedef struct _google_census_Distribution { bool has_count; int64_t count; bool has_mean; double mean; - bool has_sum_of_squared_deviation; - double sum_of_squared_deviation; bool has_range; google_census_Distribution_Range range; pb_callback_t bucket_count; } google_census_Distribution; +typedef struct _google_census_IntervalStats_Window { + bool has_window_size; + google_census_Duration window_size; + bool has_count; + int64_t count; + bool has_mean; + double mean; +} google_census_IntervalStats_Window; + typedef struct _google_census_Metric { pb_callback_t name; pb_callback_t description; @@ -153,6 +153,14 @@ typedef struct _google_census_View { pb_callback_t tag_key; } google_census_View; +typedef struct _google_census_ViewAggregations { + pb_callback_t aggregation; + bool has_start; + google_census_Timestamp start; + bool has_end; + google_census_Timestamp end; +} google_census_ViewAggregations; + typedef struct _google_census_Aggregation { pb_callback_t name; pb_callback_t description; @@ -167,34 +175,38 @@ typedef struct _google_census_Aggregation { /* Default values for struct fields */ /* Initializer values for message structs */ +#define google_census_Duration_init_default {false, 0, false, 0} +#define google_census_Timestamp_init_default {false, 0, false, 0} #define google_census_Metric_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, google_census_Metric_MeasurementUnit_init_default, false, 0} #define google_census_Metric_BasicUnit_init_default {false, (google_census_Metric_BasicUnit_Measure)0} #define google_census_Metric_MeasurementUnit_init_default {false, 0, {{NULL}, NULL}, {{NULL}, NULL}} #define google_census_AggregationDescriptor_init_default {0, {google_census_AggregationDescriptor_BucketBoundaries_init_default}} #define google_census_AggregationDescriptor_BucketBoundaries_init_default {{{NULL}, NULL}} #define google_census_AggregationDescriptor_IntervalBoundaries_init_default {{{NULL}, NULL}} -#define google_census_Distribution_init_default {false, 0, false, 0, false, 0, false, google_census_Distribution_Range_init_default, {{NULL}, NULL}} +#define google_census_Distribution_init_default {false, 0, false, 0, false, google_census_Distribution_Range_init_default, {{NULL}, NULL}} #define google_census_Distribution_Range_init_default {false, 0, false, 0} #define google_census_IntervalStats_init_default {{{NULL}, NULL}} -#define google_census_IntervalStats_Window_init_default {false, google_protobuf_Duration_init_default, false, 0, false, 0} +#define google_census_IntervalStats_Window_init_default {false, google_census_Duration_init_default, false, 0, false, 0} #define google_census_Tag_init_default {false, "", false, ""} #define google_census_View_init_default {{{NULL}, NULL}, {{NULL}, NULL}, false, 0, false, google_census_AggregationDescriptor_init_default, {{NULL}, NULL}} #define google_census_Aggregation_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, {google_census_Distribution_init_default}, {{NULL}, NULL}} -#define google_census_ViewAggregations_init_default {{{NULL}, NULL}, false, google_protobuf_Timestamp_init_default, false, google_protobuf_Timestamp_init_default} +#define google_census_ViewAggregations_init_default {{{NULL}, NULL}, false, google_census_Timestamp_init_default, false, google_census_Timestamp_init_default} +#define google_census_Duration_init_zero {false, 0, false, 0} +#define google_census_Timestamp_init_zero {false, 0, false, 0} #define google_census_Metric_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, google_census_Metric_MeasurementUnit_init_zero, false, 0} #define google_census_Metric_BasicUnit_init_zero {false, (google_census_Metric_BasicUnit_Measure)0} #define google_census_Metric_MeasurementUnit_init_zero {false, 0, {{NULL}, NULL}, {{NULL}, NULL}} #define google_census_AggregationDescriptor_init_zero {0, {google_census_AggregationDescriptor_BucketBoundaries_init_zero}} #define google_census_AggregationDescriptor_BucketBoundaries_init_zero {{{NULL}, NULL}} #define google_census_AggregationDescriptor_IntervalBoundaries_init_zero {{{NULL}, NULL}} -#define google_census_Distribution_init_zero {false, 0, false, 0, false, 0, false, google_census_Distribution_Range_init_zero, {{NULL}, NULL}} +#define google_census_Distribution_init_zero {false, 0, false, 0, false, google_census_Distribution_Range_init_zero, {{NULL}, NULL}} #define google_census_Distribution_Range_init_zero {false, 0, false, 0} #define google_census_IntervalStats_init_zero {{{NULL}, NULL}} -#define google_census_IntervalStats_Window_init_zero {false, google_protobuf_Duration_init_zero, false, 0, false, 0} +#define google_census_IntervalStats_Window_init_zero {false, google_census_Duration_init_zero, false, 0, false, 0} #define google_census_Tag_init_zero {false, "", false, ""} #define google_census_View_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, false, 0, false, google_census_AggregationDescriptor_init_zero, {{NULL}, NULL}} #define google_census_Aggregation_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, {google_census_Distribution_init_zero}, {{NULL}, NULL}} -#define google_census_ViewAggregations_init_zero {{{NULL}, NULL}, false, google_protobuf_Timestamp_init_zero, false, google_protobuf_Timestamp_init_zero} +#define google_census_ViewAggregations_init_zero {{{NULL}, NULL}, false, google_census_Timestamp_init_zero, false, google_census_Timestamp_init_zero} /* Field tags (for use in manual encoding/decoding) */ #define google_census_AggregationDescriptor_BucketBoundaries_bounds_tag 1 @@ -205,23 +217,23 @@ typedef struct _google_census_Aggregation { #define google_census_AggregationDescriptor_interval_boundaries_tag 2 #define google_census_Distribution_Range_min_tag 1 #define google_census_Distribution_Range_max_tag 2 -#define google_census_IntervalStats_Window_window_size_tag 1 -#define google_census_IntervalStats_Window_count_tag 2 -#define google_census_IntervalStats_Window_mean_tag 3 +#define google_census_Duration_seconds_tag 1 +#define google_census_Duration_nanos_tag 2 #define google_census_Metric_BasicUnit_type_tag 1 #define google_census_Metric_MeasurementUnit_prefix_tag 1 #define google_census_Metric_MeasurementUnit_numerator_tag 2 #define google_census_Metric_MeasurementUnit_denominator_tag 3 #define google_census_Tag_key_tag 1 #define google_census_Tag_value_tag 2 -#define google_census_ViewAggregations_aggregation_tag 1 -#define google_census_ViewAggregations_start_tag 2 -#define google_census_ViewAggregations_end_tag 3 +#define google_census_Timestamp_seconds_tag 1 +#define google_census_Timestamp_nanos_tag 2 #define google_census_Distribution_count_tag 1 #define google_census_Distribution_mean_tag 2 -#define google_census_Distribution_sum_of_squared_deviation_tag 3 -#define google_census_Distribution_range_tag 4 -#define google_census_Distribution_bucket_count_tag 5 +#define google_census_Distribution_range_tag 3 +#define google_census_Distribution_bucket_count_tag 4 +#define google_census_IntervalStats_Window_window_size_tag 1 +#define google_census_IntervalStats_Window_count_tag 2 +#define google_census_IntervalStats_Window_mean_tag 3 #define google_census_Metric_name_tag 1 #define google_census_Metric_description_tag 2 #define google_census_Metric_unit_tag 3 @@ -231,6 +243,9 @@ typedef struct _google_census_Aggregation { #define google_census_View_metric_id_tag 3 #define google_census_View_aggregation_tag 4 #define google_census_View_tag_key_tag 5 +#define google_census_ViewAggregations_aggregation_tag 1 +#define google_census_ViewAggregations_start_tag 2 +#define google_census_ViewAggregations_end_tag 3 #define google_census_Aggregation_distribution_tag 3 #define google_census_Aggregation_interval_stats_tag 4 @@ -239,13 +254,15 @@ typedef struct _google_census_Aggregation { #define google_census_Aggregation_tag_tag 5 /* Struct field encoding specification for nanopb */ +extern const pb_field_t google_census_Duration_fields[3]; +extern const pb_field_t google_census_Timestamp_fields[3]; extern const pb_field_t google_census_Metric_fields[5]; extern const pb_field_t google_census_Metric_BasicUnit_fields[2]; extern const pb_field_t google_census_Metric_MeasurementUnit_fields[4]; extern const pb_field_t google_census_AggregationDescriptor_fields[3]; extern const pb_field_t google_census_AggregationDescriptor_BucketBoundaries_fields[2]; extern const pb_field_t google_census_AggregationDescriptor_IntervalBoundaries_fields[2]; -extern const pb_field_t google_census_Distribution_fields[6]; +extern const pb_field_t google_census_Distribution_fields[5]; extern const pb_field_t google_census_Distribution_Range_fields[3]; extern const pb_field_t google_census_IntervalStats_fields[2]; extern const pb_field_t google_census_IntervalStats_Window_fields[4]; @@ -255,6 +272,8 @@ extern const pb_field_t google_census_Aggregation_fields[6]; extern const pb_field_t google_census_ViewAggregations_fields[4]; /* Maximum encoded size of messages (where known) */ +#define google_census_Duration_size 22 +#define google_census_Timestamp_size 22 #define google_census_Metric_BasicUnit_size 2 #define google_census_Distribution_Range_size 18 #define google_census_IntervalStats_Window_size 44 diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 162191b06d..bf2f73b95e 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -236,6 +236,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/resolver/dns/native/dns_resolver.c', 'src/core/ext/resolver/sockaddr/sockaddr_resolver.c', 'src/core/ext/census/context.c', + 'src/core/ext/census/gen/census.pb.c', 'src/core/ext/census/grpc_context.c', 'src/core/ext/census/grpc_filter.c', 'src/core/ext/census/grpc_plugin.c', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 212dfc3160..591dc172f6 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -925,6 +925,7 @@ third_party/nanopb/pb_encode.h \ src/core/ext/census/aggregation.h \ src/core/ext/census/census_interface.h \ src/core/ext/census/census_rpc_stats.h \ +src/core/ext/census/gen/census.pb.h \ src/core/ext/census/grpc_filter.h \ src/core/ext/census/mlog.h \ src/core/ext/census/rpc_metric_id.h \ @@ -1088,6 +1089,7 @@ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/resolver/dns/native/dns_resolver.c \ src/core/ext/resolver/sockaddr/sockaddr_resolver.c \ src/core/ext/census/context.c \ +src/core/ext/census/gen/census.pb.c \ src/core/ext/census/grpc_context.c \ src/core/ext/census/grpc_filter.c \ src/core/ext/census/grpc_plugin.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 3866ebb0e5..edb4e50e5e 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -5412,6 +5412,7 @@ "src/core/ext/census/aggregation.h", "src/core/ext/census/census_interface.h", "src/core/ext/census/census_rpc_stats.h", + "src/core/ext/census/gen/census.pb.h", "src/core/ext/census/grpc_filter.h", "src/core/ext/census/mlog.h", "src/core/ext/census/rpc_metric_id.h" @@ -5424,6 +5425,8 @@ "src/core/ext/census/census_interface.h", "src/core/ext/census/census_rpc_stats.h", "src/core/ext/census/context.c", + "src/core/ext/census/gen/census.pb.c", + "src/core/ext/census/gen/census.pb.h", "src/core/ext/census/grpc_context.c", "src/core/ext/census/grpc_filter.c", "src/core/ext/census/grpc_filter.h", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index a20d386fa3..35a1f51157 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -434,6 +434,7 @@ + @@ -759,6 +760,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index d5465176a2..62ed8bad7a 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -481,6 +481,9 @@ src\core\ext\census + + src\core\ext\census\gen + src\core\ext\census @@ -1007,6 +1010,9 @@ src\core\ext\census + + src\core\ext\census\gen + src\core\ext\census @@ -1043,6 +1049,9 @@ {9bf70bd2-f553-11b2-c237-abd148971eea} + + {4a14dd37-5868-c656-7333-fa80574cbb07} + {003725f8-37fc-80b5-deba-baae32caf915} diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 09748f082c..e29a275d5a 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -407,6 +407,7 @@ + @@ -686,6 +687,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index a85bfeefe6..e5e4acc9a5 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -412,6 +412,9 @@ src\core\ext\census + + src\core\ext\census\gen + src\core\ext\census @@ -884,6 +887,9 @@ src\core\ext\census + + src\core\ext\census\gen + src\core\ext\census @@ -920,6 +926,9 @@ {3f21cd12-b8b9-18f8-8780-e21bbe2285d0} + + {dfe53168-57b0-3ac4-d8ba-07fd958cc8f5} + {25fa8af3-0a05-987c-741f-fa8ff9d65d51} -- cgit v1.2.3 From 092f3f02f046b5d18afa8056342882f3f7e6947f Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Tue, 24 May 2016 08:59:37 -0700 Subject: update docs --- src/core/ext/census/census.proto | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/ext/census/census.proto b/src/core/ext/census/census.proto index 8aa9610178..c869d851ff 100644 --- a/src/core/ext/census/census.proto +++ b/src/core/ext/census/census.proto @@ -149,13 +149,14 @@ message Metric { } // An Aggregation summarizes a series of individual Metric measurements, an -// AggregationDescriptor describes an Aggregation +// AggregationDescriptor describes an Aggregation. message AggregationDescriptor { - // At most one set of options. + // At most one set of options. If neither option is set, a default type + // of Distribution (without a histogram component) will be used. oneof options { - // Defines the histogram bucket boundaries for Distributions + // Defines the histogram bucket boundaries for Distributions. BucketBoundaries bucket_boundaries = 1; - // Defines the time windows to record for IntervalStats + // Defines the time windows to record for IntervalStats. IntervalBoundaries interval_boundaries = 2; } @@ -164,7 +165,8 @@ message AggregationDescriptor { // `bucket_boundaries`. // // Describes histogram bucket boundaries. Defines `size(bounds) + 1` (= N) - // buckets, with these boundaries for bucket index i: + // buckets (for size(bounds) >= 1; if size(bounds) == 0, then no histogram + // will be defined. The boundaries for bucket index i are: // // [-infinity, bounds[i]) for i == 0 // [bounds[i-1], bounds[i]) for 0 < i < N-2 @@ -253,7 +255,7 @@ message IntervalStats { repeated Window window = 1; } -// A Tag: key-value pair +// A Tag: key-value pair. message Tag { string key = 1; string value = 2; -- cgit v1.2.3 From 0e6ebde2c9c4aaee30c285e7ccc8b7e16dea95b3 Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Tue, 24 May 2016 09:43:52 -0700 Subject: Fix incorrect script invocation for code generation. --- src/core/ext/census/gen/README.md | 2 +- src/core/ext/census/gen/census.pb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/ext/census/gen/README.md b/src/core/ext/census/gen/README.md index 8f3aeb3b0f..2da35656f5 100644 --- a/src/core/ext/census/gen/README.md +++ b/src/core/ext/census/gen/README.md @@ -3,4 +3,4 @@ Files generated for use by Census stats and trace recording subsystem. #Files * census.pb.{h,c} - Generated from src/core/ext/census/census.proto, using the script `tools/codegen/core/gen_nano_proto.sh src/core/ext/census/census.proto - $PWD/src/core/ext/census/gen` + $PWD/src/core/ext/census/gen src/core/ext/census/gen` diff --git a/src/core/ext/census/gen/census.pb.c b/src/core/ext/census/gen/census.pb.c index 2c41002b5e..d614636c90 100644 --- a/src/core/ext/census/gen/census.pb.c +++ b/src/core/ext/census/gen/census.pb.c @@ -33,7 +33,7 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.3.5-dev */ -#include "/usr/local/google/home/aveitch/projects/grpc_stats/grpc/src/core/ext/census/gen/census.pb.h" +#include "src/core/ext/census/gen/census.pb.h" #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. -- cgit v1.2.3 From 8fc19a1fa556527a5a0264ae7ccd358f87ae81bc Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Tue, 24 May 2016 10:02:15 -0700 Subject: move proto file --- src/core/ext/census/gen/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/ext/census/gen/README.md b/src/core/ext/census/gen/README.md index 2da35656f5..72bef6542d 100644 --- a/src/core/ext/census/gen/README.md +++ b/src/core/ext/census/gen/README.md @@ -2,5 +2,5 @@ Files generated for use by Census stats and trace recording subsystem. #Files * census.pb.{h,c} - Generated from src/core/ext/census/census.proto, using the - script `tools/codegen/core/gen_nano_proto.sh src/core/ext/census/census.proto + script `tools/codegen/core/gen_nano_proto.sh src/proto/census/census.proto $PWD/src/core/ext/census/gen src/core/ext/census/gen` -- cgit v1.2.3 From d961a8f3ee0dfb0cdfdd6d05f28c787722f9801f Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Tue, 24 May 2016 10:10:46 -0700 Subject: really move --- src/core/ext/census/census.options | 3 - src/core/ext/census/census.proto | 313 ------------------------------------- 2 files changed, 316 deletions(-) delete mode 100644 src/core/ext/census/census.options delete mode 100644 src/core/ext/census/census.proto (limited to 'src/core') diff --git a/src/core/ext/census/census.options b/src/core/ext/census/census.options deleted file mode 100644 index 747740cc3e..0000000000 --- a/src/core/ext/census/census.options +++ /dev/null @@ -1,3 +0,0 @@ -google.census.Tag.key max_size:255 -google.census.Tag.value max_size:255 -google.census.View.tag_keys max_count 15 \ No newline at end of file diff --git a/src/core/ext/census/census.proto b/src/core/ext/census/census.proto deleted file mode 100644 index c869d851ff..0000000000 --- a/src/core/ext/census/census.proto +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2016, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.census; - -// All the census protos. -// -// Nomenclature note: capitalized names below (like Metric) are protos. -// -// Census lets you define a Metric - something which can be measured, like the -// latency of an RPC, the number of CPU cycles spent on an operation, or -// anything else you care to measure. You can record individual instances of -// measurements (a double value) for every metric of interest. These -// individual measurements are aggregated together into an Aggregation. There -// are two Aggregation types available: Distribution (describes the -// distribution of all measurements, possibly with a histogram) and -// IntervalStats (the count and mean of measurements across specified time -// periods). An Aggregation is described by an AggregationDescriptor. -// -// You can define how your stats are broken down by Tag values and which -// Aggregations to use through a View. The corresponding combination of -// Metric/View/Aggregation which is available to census clients is called a -// ViewAggregation. - - -// The following two types are copied from -// google/protobuf/{duration,timestamp}.proto. Ideally, we would be able to -// import them, but this causes compilation issues on C-based systems -// (e.g. https://koti.kapsi.fi/jpa/nanopb/), which cannot process the C++ -// headers generated from the standard protobuf distribution. See the relevant -// proto files for full documentation of these types. - -message Duration { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} - -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} - -// Describes a metric -message Metric { - // name of metric, e.g. rpc_latency, cpu. - string name = 1; - - // More detailed description of the metric, used in documentation. - string description = 2; - - // Fundamental units of measurement supported by Census - // TODO(aveitch): expand this to include other S.I. units? - message BasicUnit { - enum Measure { - UNKNOWN = 0; - BITS = 1; - BYTES = 2; - SECS = 3; - CORES = 4; - MAX_UNITS = 5; - } - Measure type = 1; - } - - // MeasurementUnit lets you build compound units of the form - // 10^n * (A * B * ...) / (X * Y * ...), - // where the elements in the numerator and denominator are all BasicUnits. A - // MeasurementUnit must have at least one BasicUnit in its numerator. - // - // To specify multiplication in the numerator or denominator, simply specify - // multiple numerator or denominator fields. For example: - // - // - byte-seconds (i.e. bytes * seconds): - // numerator: BYTES - // numerator: SECS - // - // - events/sec^2 (i.e. rate of change of events/sec): - // numerator: COUNT - // denominator: SECS - // denominator: SECS - // - // To specify multiples (in power of 10) units, specify a non-zero prefix - // value, for example: - // - // - MB/s (i.e. megabytes / s): - // prefix: 6 - // numerator: BYTES - // denominator: SECS - // - // - nanoseconds - // prefix: -9 - // numerator: SECS - message MeasurementUnit { - int32 prefix = 1; - repeated BasicUnit numerator = 2; - repeated BasicUnit denominator = 3; - } - - // The units in which the Metric value is reported. - MeasurementUnit unit = 3; - - // Metrics will be assigned an ID when registered. Invalid if <= 0. - int32 id = 4; -} - -// An Aggregation summarizes a series of individual Metric measurements, an -// AggregationDescriptor describes an Aggregation. -message AggregationDescriptor { - // At most one set of options. If neither option is set, a default type - // of Distribution (without a histogram component) will be used. - oneof options { - // Defines the histogram bucket boundaries for Distributions. - BucketBoundaries bucket_boundaries = 1; - // Defines the time windows to record for IntervalStats. - IntervalBoundaries interval_boundaries = 2; - } - - // A Distribution may optionally contain a histogram of the values in the - // population. The bucket boundaries for that histogram is described by - // `bucket_boundaries`. - // - // Describes histogram bucket boundaries. Defines `size(bounds) + 1` (= N) - // buckets (for size(bounds) >= 1; if size(bounds) == 0, then no histogram - // will be defined. The boundaries for bucket index i are: - // - // [-infinity, bounds[i]) for i == 0 - // [bounds[i-1], bounds[i]) for 0 < i < N-2 - // [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. - // - // There must be at least one element in `bounds`. If `bounds` has only one - // element, there are no finite buckets, and that single element is the - // common boundary of the overflow and underflow buckets. - message BucketBoundaries { - // The values must be monotonically increasing. - repeated double bounds = 1; - } - - // For Interval stats, describe the size of each window. - message IntervalBoundaries { - // For each time window, specify a duration in seconds. - repeated double window_size = 1; - } -} - -// Distribution contains summary statistics for a population of values and, -// optionally, a histogram representing the distribution of those values across -// a specified set of histogram buckets, as defined in -// Aggregation.bucket_options. -// -// The summary statistics are the count, mean, sum of the squared deviation from -// the mean, the minimum, and the maximum of the set of population of values. -// -// Although it is not forbidden, it is generally a bad idea to include -// non-finite values (infinities or NaNs) in the population of values, as this -// will render the `mean` field meaningless. -message Distribution { - // The number of values in the population. Must be non-negative. - int64 count = 1; - - // The arithmetic mean of the values in the population. If `count` is zero - // then this field must be zero. - double mean = 2; - - // Describes a range of population values. - message Range { - // The minimum of the population values. - double min = 1; - // The maximum of the population values. - double max = 2; - } - - // The range of the population values. If `count` is zero, this field will not - // be defined. - Range range = 3; - - // A Distribution may optionally contain a histogram of the values in the - // population. The histogram is given in `bucket_count` as counts of values - // that fall into one of a sequence of non-overlapping buckets, as described - // by `AggregationDescriptor.options.bucket_boundaries`. - // The sum of the values in `bucket_counts` must equal the value in `count`. - // - // Bucket counts are given in order under the numbering scheme described - // above (the underflow bucket has number 0; the finite buckets, if any, - // have numbers 1 through N-2; the overflow bucket has number N-1). - // - // The size of `bucket_count` must be no greater than N as defined in - // `bucket_boundaries`. - // - // Any suffix of trailing zero bucket_count fields may be omitted. - repeated int64 bucket_count = 4; -} - -// Record summary stats over various time windows. -message IntervalStats { - // Summary statistic over a single time window. - message Window { - // The window duration. - Duration window_size = 1; - // The number of measurements in this window. - int64 count = 2; - // The arithmetic mean of all measurements in the window. - double mean = 3; - } - - // Full set of windows for this metric. - repeated Window window = 1; -} - -// A Tag: key-value pair. -message Tag { - string key = 1; - string value = 2; -} - -// A View specifies an Aggregation and a set of tag keys. The Aggregation will -// be broken down by the unique set of matching tag values for each measurement. -message View { - // Name of view. - string name = 1; - - // More detailed description, for documentation purposes. - string description = 2; - - // ID of Metric to associate with this View. - int32 metric_id = 3; - - // Aggregation type to associate with this View. - AggregationDescriptor aggregation = 4; - - // Tag keys to match with a given Metric. If no keys are specified, then all - // stats for the Metric are recorded. Keys must be unique. - repeated string tag_key = 5; -} - -// An Aggregation summarizes a series of individual Metric measures. -message Aggregation { - // Name of this aggregation. - string name = 1; - - // More detailed description, for documentation purposes. - string description = 2; - - // The data for this Aggregation. - oneof data { - Distribution distribution = 3; - IntervalStats interval_stats = 4; - } - - // Tags associated with this Aggregation. - repeated Tag tag = 5; -} - -// A ViewAggregations represents all the Aggregations for a particular view. -message ViewAggregations { - // Aggregations - each will have a unique set of tag values for the tag_keys - // associated with the corresponding View. - repeated Aggregation aggregation = 1; - - // Start and end timestamps over which the value was accumulated. These - // values are not relevant/defined for IntervalStats aggregations, which are - // always accumulated over a fixed time period. - Timestamp start = 2; - Timestamp end = 3; -} -- cgit v1.2.3 From 246d85309a359f9b8f238dd614cabc3a21f9b97e Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 26 May 2016 10:18:16 -0700 Subject: Remove some unused enums --- src/core/lib/surface/call.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src/core') diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index c8728fa278..43b2e02170 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -97,25 +97,6 @@ typedef struct { grpc_mdstr *details; } received_status; -/* How far through the GRPC stream have we read? */ -typedef enum { - /* We are still waiting for initial metadata to complete */ - READ_STATE_INITIAL = 0, - /* We have gotten initial metadata, and are reading either - messages or trailing metadata */ - READ_STATE_GOT_INITIAL_METADATA, - /* The stream is closed for reading */ - READ_STATE_READ_CLOSED, - /* The stream is closed for reading & writing */ - READ_STATE_STREAM_CLOSED -} read_state; - -typedef enum { - WRITE_STATE_INITIAL = 0, - WRITE_STATE_STARTED, - WRITE_STATE_WRITE_CLOSED -} write_state; - typedef struct batch_control { grpc_call *call; grpc_cq_completion cq_completion; -- cgit v1.2.3 From 3b4b50bf9f3e9f70b2bc48964971fa3a1a33c242 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 26 May 2016 10:25:15 -0700 Subject: Remove unused struct --- src/core/lib/surface/call.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/core') diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 43b2e02170..34ddfa75ad 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -65,12 +65,6 @@ - status/close recv (depending on client/server) */ #define MAX_CONCURRENT_BATCHES 6 -typedef struct { - grpc_ioreq_completion_func on_complete; - void *user_data; - int success; -} completed_request; - #define MAX_SEND_EXTRA_METADATA_COUNT 3 /* Status data for a request can come from several sources; this -- cgit v1.2.3 From 44181c02c4e80c404a2544f88c9542a15d8f3306 Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Thu, 26 May 2016 10:29:38 -0700 Subject: fix options file; fix generated include guards --- build.yaml | 1 + src/core/ext/census/gen/census.pb.h | 4 ++-- src/proto/census/census.options | 2 +- third_party/protobuf | 2 +- tools/codegen/core/gen_nano_proto.sh | 7 +++++++ 5 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/build.yaml b/build.yaml index 19e4b1adcd..bbd60cbe21 100644 --- a/build.yaml +++ b/build.yaml @@ -34,6 +34,7 @@ filegroups: plugin: census_grpc_plugin uses: - grpc_base + - nanopb - name: gpr_base public_headers: - include/grpc/support/alloc.h diff --git a/src/core/ext/census/gen/census.pb.h b/src/core/ext/census/gen/census.pb.h index fe263988c3..d040fe29e7 100644 --- a/src/core/ext/census/gen/census.pb.h +++ b/src/core/ext/census/gen/census.pb.h @@ -33,8 +33,8 @@ /* Automatically generated nanopb header */ /* Generated by nanopb-0.3.5-dev */ -#ifndef PB_CENSUS_PB_H_INCLUDED -#define PB_CENSUS_PB_H_INCLUDED +#ifndef GRPC_CORE_EXT_CENSUS_GEN_CENSUS_PB_H +#define GRPC_CORE_EXT_CENSUS_GEN_CENSUS_PB_H #include "third_party/nanopb/pb.h" #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. diff --git a/src/proto/census/census.options b/src/proto/census/census.options index 08ebbc071b..a1f80395c7 100644 --- a/src/proto/census/census.options +++ b/src/proto/census/census.options @@ -1,3 +1,3 @@ google.census.Tag.key max_size:255 google.census.Tag.value max_size:255 -google.census.View.tag_keys max_count 15 +google.census.View.tag_key max_count:15 diff --git a/third_party/protobuf b/third_party/protobuf index 3470b6895a..a1938b2aa9 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 3470b6895aa659b7559ed678e029a5338e535f14 +Subproject commit a1938b2aa9ca86ce7ce50c27ff9737c1008d2a03 diff --git a/tools/codegen/core/gen_nano_proto.sh b/tools/codegen/core/gen_nano_proto.sh index b216a20379..c880fc23a2 100755 --- a/tools/codegen/core/gen_nano_proto.sh +++ b/tools/codegen/core/gen_nano_proto.sh @@ -136,6 +136,13 @@ readonly PROTO_BASENAME=$(basename $INPUT_PROTO .proto) sed -i "s:$PROTO_BASENAME.pb.h:${GRPC_OUTPUT_DIR}/$PROTO_BASENAME.pb.h:g" \ "$OUTPUT_DIR/$PROTO_BASENAME.pb.c" +# Fix up the include guards such that they pass the check_include_guards.py +# test. Assumes that the generated files are being placed in gRPC src dir. +readonly INCLUDE_GUARD_BASE=`echo $GRPC_OUTPUT_DIR | tr [a-z/] [A-Z_] | sed s:^.*SRC_::` +readonly UC_PROTO_BASENAME=`echo $PROTO_BASENAME | tr [a-z] [A-Z]` +sed -i "s:PB_${UC_PROTO_BASENAME}_PB_H_INCLUDED:GRPC_${INCLUDE_GUARD_BASE}_${UC_PROTO_BASENAME}_PB_H:g" \ + "$OUTPUT_DIR/$PROTO_BASENAME.pb.h" + # prepend copyright TMPFILE=$(mktemp) cat $COPYRIGHT_FILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.c" > $TMPFILE -- cgit v1.2.3 From f1bc22a35d4c1a4c677d67acd3b992ad503f8025 Mon Sep 17 00:00:00 2001 From: Alistair Veitch Date: Fri, 27 May 2016 16:38:15 -0700 Subject: regenerate projects --- src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h | 4 ++-- tools/run_tests/sources_and_headers.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h b/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h index d5dc39ab94..46fe588f72 100644 --- a/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +++ b/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h @@ -33,8 +33,8 @@ /* Automatically generated nanopb header */ /* Generated by nanopb-0.3.5-dev */ -#ifndef PB_LOAD_BALANCER_PB_H_INCLUDED -#define PB_LOAD_BALANCER_PB_H_INCLUDED +#ifndef GRPC_CORE_EXT_LB_POLICY_GRPCLB_PROTO_GRPC_LB_V1_LOAD_BALANCER_PB_H +#define GRPC_CORE_EXT_LB_POLICY_GRPCLB_PROTO_GRPC_LB_V1_LOAD_BALANCER_PB_H #include "third_party/nanopb/pb.h" #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index b0d7c41de8..658fde1f19 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -5290,7 +5290,8 @@ { "deps": [ "gpr", - "grpc_base" + "grpc_base", + "nanopb" ], "headers": [ "include/grpc/census.h", -- cgit v1.2.3