diff --git a/BUILD b/BUILD index 7601a4ac5ae..024a5182ce5 100644 --- a/BUILD +++ b/BUILD @@ -301,6 +301,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", @@ -469,6 +470,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", @@ -647,6 +649,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", @@ -784,6 +787,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", @@ -1509,6 +1513,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", @@ -1690,6 +1695,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 710f626f9e2..ec504a575c2 100644 --- a/Makefile +++ b/Makefile @@ -2636,6 +2636,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 \ @@ -2959,6 +2960,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 f2271cbcbd6..1e8b5e294f8 100644 --- a/binding.gyp +++ b/binding.gyp @@ -731,6 +731,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 b76bd122bc7..f211575e925 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 @@ -32,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/config.m4 b/config.m4 index 67c9bef293c..e8506bb269c 100644 --- a/config.m4 +++ b/config.m4 @@ -250,6 +250,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 \ @@ -565,6 +566,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 436cec4ba21..9c049f03b19 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -308,6 +308,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', @@ -509,6 +510,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', @@ -675,6 +677,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 55ec9a98c32..047845cd843 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -317,6 +317,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 ) @@ -488,6 +489,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 c7fbaf5eb2d..6f6b8dd4bdb 100644 --- a/package.xml +++ b/package.xml @@ -324,6 +324,7 @@ + @@ -495,6 +496,7 @@ + diff --git a/src/core/ext/census/gen/README.md b/src/core/ext/census/gen/README.md new file mode 100644 index 00000000000..72bef6542d0 --- /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/proto/census/census.proto + $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 new file mode 100644 index 00000000000..d614636c908 --- /dev/null +++ b/src/core/ext/census/gen/census.pb.c @@ -0,0 +1,179 @@ +/* + * + * 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 "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_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), + 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[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, 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 +}; + +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_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 +}; + +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_census_Timestamp_fields), + PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, google_census_ViewAggregations, end, start, &google_census_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_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) +/* 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_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 + + +/* 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 00000000000..d040fe29e74 --- /dev/null +++ b/src/core/ext/census/gen/census.pb.h @@ -0,0 +1,294 @@ +/* + * + * 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 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. +#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_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; + 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_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_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; + 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_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; + 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_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, 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_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_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, 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_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_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 +#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_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_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_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 +#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_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 +#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_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[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]; +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_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 +#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 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 d5dc39ab94f..46fe588f72d 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/src/proto/census/census.options b/src/proto/census/census.options new file mode 100644 index 00000000000..a1f80395c70 --- /dev/null +++ b/src/proto/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_key max_count:15 diff --git a/src/proto/census/census.proto b/src/proto/census/census.proto new file mode 100644 index 00000000000..c869d851ff1 --- /dev/null +++ b/src/proto/census/census.proto @@ -0,0 +1,313 @@ +// 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; +} diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 9c067add0a1..d0f23f42ccc 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -244,6 +244,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/codegen/core/gen_nano_proto.sh b/tools/codegen/core/gen_nano_proto.sh index b216a20379e..c880fc23a23 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 diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 386ef7d4271..7446fec8244 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -934,6 +934,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 \ @@ -1105,6 +1106,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 fe67426aa42..e0471234954 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -5290,13 +5290,15 @@ { "deps": [ "gpr", - "grpc_base" + "grpc_base", + "nanopb" ], "headers": [ "include/grpc/census.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" @@ -5309,6 +5311,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 7a39070b007..61a59e7c3f0 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -443,6 +443,7 @@ + @@ -784,6 +785,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index ae70e0ada04..4bd436aa167 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -505,6 +505,9 @@ src\core\ext\census + + src\core\ext\census\gen + src\core\ext\census @@ -1058,6 +1061,9 @@ src\core\ext\census + + src\core\ext\census\gen + src\core\ext\census @@ -1094,6 +1100,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 09748f082c4..e29a275d5ab 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 a85bfeefe6b..e5e4acc9a5d 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}