From 0997fcfff26941fc74e3ca425b609b5cd055b4d9 Mon Sep 17 00:00:00 2001 From: Preston Bennes Date: Fri, 13 May 2022 22:17:14 +0000 Subject: [PATCH] Use the public maven central relase of io.opencensus:opencensus-proto This fixes an issue of duplicate and possibly incompatible classes for io.opencensus classes. If a project includes both opencensus-proto and api dependencies, there will be duplicate classes for opencensus-proto classes on the class path. This is because: - these classes are vendored in this repo but not declared in the pom - the version of opencensus-proto used is not a public release in maven central Fixes #171 Signed-off-by: Preston Bennes --- api/pom.xml | 6 + .../proto/agent/common/v1/common.proto | 101 ----- .../agent/metrics/v1/metrics_service.proto | 58 --- .../proto/agent/trace/v1/trace_service.proto | 87 ---- .../opencensus/proto/metrics/v1/metrics.proto | 303 ------------- .../proto/resource/v1/resource.proto | 35 -- .../opencensus/proto/stats/v1/stats.proto | 138 ------ .../opencensus/proto/trace/v1/trace.proto | 422 ------------------ .../proto/trace/v1/trace_config.proto | 81 ---- pom.xml | 1 + tools/API_SHAS | 1 - tools/update-api.sh | 4 - tools/update-sha.sh | 4 - 13 files changed, 7 insertions(+), 1234 deletions(-) delete mode 100644 api/src/main/proto/opencensus/proto/agent/common/v1/common.proto delete mode 100644 api/src/main/proto/opencensus/proto/agent/metrics/v1/metrics_service.proto delete mode 100644 api/src/main/proto/opencensus/proto/agent/trace/v1/trace_service.proto delete mode 100644 api/src/main/proto/opencensus/proto/metrics/v1/metrics.proto delete mode 100644 api/src/main/proto/opencensus/proto/resource/v1/resource.proto delete mode 100644 api/src/main/proto/opencensus/proto/stats/v1/stats.proto delete mode 100644 api/src/main/proto/opencensus/proto/trace/v1/trace.proto delete mode 100644 api/src/main/proto/opencensus/proto/trace/v1/trace_config.proto diff --git a/api/pom.xml b/api/pom.xml index 8bd9bdcfa..78be623fa 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -27,6 +27,12 @@ ${grpc.version} + + io.opencensus + opencensus-proto + ${opencensus.version} + + com.google.protobuf protobuf-java diff --git a/api/src/main/proto/opencensus/proto/agent/common/v1/common.proto b/api/src/main/proto/opencensus/proto/agent/common/v1/common.proto deleted file mode 100644 index 7684f61cd..000000000 --- a/api/src/main/proto/opencensus/proto/agent/common/v1/common.proto +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -// NOTE: This proto is experimental and is subject to change at this point. -// Please do not use it at the moment. - -package opencensus.proto.agent.common.v1; - -import "google/protobuf/timestamp.proto"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.agent.common.v1"; -option java_outer_classname = "CommonProto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1"; - -option ruby_package = "OpenCensus.Proto.Agent.Common.V1"; - -// Identifier metadata of the Node that produces the span or tracing data. -// Note, this is not the metadata about the Node or service that is described by associated spans. -// In the future we plan to extend the identifier proto definition to support -// additional information (e.g cloud id, etc.) -message Node { - // Identifier that uniquely identifies a process within a VM/container. - ProcessIdentifier identifier = 1; - - // Information on the OpenCensus Library that initiates the stream. - LibraryInfo library_info = 2; - - // Additional information on service. - ServiceInfo service_info = 3; - - // Additional attributes. - map attributes = 4; - - // TODO(songya): Add more identifiers in the future as needed, like cloud - // identifiers. -} - -// Identifier that uniquely identifies a process within a VM/container. -message ProcessIdentifier { - - // The host name. Usually refers to the machine/container name. - // For example: os.Hostname() in Go, socket.gethostname() in Python. - string host_name = 1; - - // Process id. - uint32 pid = 2; - - // Start time of this ProcessIdentifier. Represented in epoch time. - google.protobuf.Timestamp start_timestamp = 3; -} - -// Information on OpenCensus Library. -message LibraryInfo { - - enum Language { - LANGUAGE_UNSPECIFIED = 0; - CPP = 1; - C_SHARP = 2; - ERLANG = 3; - GO_LANG = 4; - JAVA = 5; - NODE_JS = 6; - PHP = 7; - PYTHON = 8; - RUBY = 9; - WEB_JS = 10; - } - - // Language of OpenCensus Library. - Language language = 1; - - // Version of Agent exporter of Library. - string exporter_version = 2; - - // Version of OpenCensus Library. - string core_library_version = 3; -} - -// Additional service information. -message ServiceInfo { - - // Name of the service. - string name = 1; - - // TODO(songya): add more fields as needed. -} diff --git a/api/src/main/proto/opencensus/proto/agent/metrics/v1/metrics_service.proto b/api/src/main/proto/opencensus/proto/agent/metrics/v1/metrics_service.proto deleted file mode 100644 index 83477f266..000000000 --- a/api/src/main/proto/opencensus/proto/agent/metrics/v1/metrics_service.proto +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package opencensus.proto.agent.metrics.v1; - -import "opencensus/proto/agent/common/v1/common.proto"; -import "opencensus/proto/metrics/v1/metrics.proto"; -import "opencensus/proto/resource/v1/resource.proto"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.agent.metrics.v1"; -option java_outer_classname = "MetricsServiceProto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1"; - -option ruby_package = "OpenCensus.Proto.Agent.Metrics.V1"; - -// Service that can be used to push metrics between one Application -// instrumented with OpenCensus and an agent, or between an agent and a -// central collector. -service MetricsService { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - rpc Export(stream ExportMetricsServiceRequest) returns (stream ExportMetricsServiceResponse) {} -} - -message ExportMetricsServiceRequest { - // This is required only in the first message on the stream or if the - // previous sent ExportMetricsServiceRequest message has a different Node (e.g. - // when the same RPC is used to send Metrics from multiple Applications). - opencensus.proto.agent.common.v1.Node node = 1; - - // A list of metrics that belong to the last received Node. - repeated opencensus.proto.metrics.v1.Metric metrics = 2; - - // The resource for the metrics in this message that do not have an explicit - // resource set. - // If unset, the most recently set resource in the RPC stream applies. It is - // valid to never be set within a stream, e.g. when no resource info is known - // at all or when all sent metrics have an explicit resource set. - opencensus.proto.resource.v1.Resource resource = 3; -} - -message ExportMetricsServiceResponse { -} diff --git a/api/src/main/proto/opencensus/proto/agent/trace/v1/trace_service.proto b/api/src/main/proto/opencensus/proto/agent/trace/v1/trace_service.proto deleted file mode 100644 index 6d2dfd94f..000000000 --- a/api/src/main/proto/opencensus/proto/agent/trace/v1/trace_service.proto +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -// NOTE: This proto is experimental and is subject to change at this point. -// Please do not use it at the moment. - -package opencensus.proto.agent.trace.v1; - -import "opencensus/proto/agent/common/v1/common.proto"; -import "opencensus/proto/resource/v1/resource.proto"; -import "opencensus/proto/trace/v1/trace.proto"; -import "opencensus/proto/trace/v1/trace_config.proto"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.agent.trace.v1"; -option java_outer_classname = "TraceServiceProto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1"; - -option ruby_package = "OpenCensus.Proto.Agent.Trace.V1"; - -// Service that can be used to push spans and configs between one Application -// instrumented with OpenCensus and an agent, or between an agent and a -// central collector or config service (in this case spans and configs are -// sent/received to/from multiple Applications). -service TraceService { - // After initialization, this RPC must be kept alive for the entire life of - // the application. The agent pushes configs down to applications via a - // stream. - rpc Config(stream CurrentLibraryConfig) returns (stream UpdatedLibraryConfig) {} - - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. - rpc Export(stream ExportTraceServiceRequest) returns (stream ExportTraceServiceResponse) {} -} - -message CurrentLibraryConfig { - // This is required only in the first message on the stream or if the - // previous sent CurrentLibraryConfig message has a different Node (e.g. - // when the same RPC is used to configure multiple Applications). - opencensus.proto.agent.common.v1.Node node = 1; - - // Current configuration. - opencensus.proto.trace.v1.TraceConfig config = 2; -} - -message UpdatedLibraryConfig { - // This field is ignored when the RPC is used to configure only one Application. - // This is required only in the first message on the stream or if the - // previous sent UpdatedLibraryConfig message has a different Node. - opencensus.proto.agent.common.v1.Node node = 1; - - // Requested updated configuration. - opencensus.proto.trace.v1.TraceConfig config = 2; -} - -message ExportTraceServiceRequest { - // This is required only in the first message on the stream or if the - // previous sent ExportTraceServiceRequest message has a different Node (e.g. - // when the same RPC is used to send Spans from multiple Applications). - opencensus.proto.agent.common.v1.Node node = 1; - - // A list of Spans that belong to the last received Node. - repeated opencensus.proto.trace.v1.Span spans = 2; - - // The resource for the spans in this message that do not have an explicit - // resource set. - // If unset, the most recently set resource in the RPC stream applies. It is - // valid to never be set within a stream, e.g. when no resource info is known. - opencensus.proto.resource.v1.Resource resource = 3; -} - -message ExportTraceServiceResponse { -} diff --git a/api/src/main/proto/opencensus/proto/metrics/v1/metrics.proto b/api/src/main/proto/opencensus/proto/metrics/v1/metrics.proto deleted file mode 100644 index d92759f95..000000000 --- a/api/src/main/proto/opencensus/proto/metrics/v1/metrics.proto +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This package describes the Metrics data model. It is currently experimental -// but may eventually become the wire format for metrics. Please see -// https://github.com/census-instrumentation/opencensus-specs/blob/master/stats/Metrics.md -// for more details. - -syntax = "proto3"; - -package opencensus.proto.metrics.v1; - -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "opencensus/proto/resource/v1/resource.proto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.metrics.v1"; -option java_outer_classname = "MetricsProto"; - -option ruby_package = "OpenCensus.Proto.Metrics.V1"; - -// Defines a Metric which has one or more timeseries. -message Metric { - // The descriptor of the Metric. - // TODO(issue #152): consider only sending the name of descriptor for - // optimization. - MetricDescriptor metric_descriptor = 1; - - // One or more timeseries for a single metric, where each timeseries has - // one or more points. - repeated TimeSeries timeseries = 2; - - // The resource for the metric. If unset, it may be set to a default value - // provided for a sequence of messages in an RPC stream. - opencensus.proto.resource.v1.Resource resource = 3; -} - -// Defines a metric type and its schema. -message MetricDescriptor { - // The metric type, including its DNS name prefix. It must be unique. - string name = 1; - - // A detailed description of the metric, which can be used in documentation. - string description = 2; - - // The unit in which the metric value is reported. Follows the format - // described by http://unitsofmeasure.org/ucum.html. - string unit = 3; - - // The kind of metric. It describes how the data is reported. - // - // A gauge is an instantaneous measurement of a value. - // - // A cumulative measurement is a value accumulated over a time interval. In - // a time series, cumulative measurements should have the same start time, - // increasing values and increasing end times, until an event resets the - // cumulative value to zero and sets a new start time for the following - // points. - enum Type { - // Do not use this default value. - UNSPECIFIED = 0; - - // Integer gauge. The value can go both up and down. - GAUGE_INT64 = 1; - - // Floating point gauge. The value can go both up and down. - GAUGE_DOUBLE = 2; - - // Distribution gauge measurement. The count and sum can go both up and - // down. Recorded values are always >= 0. - // Used in scenarios like a snapshot of time the current items in a queue - // have spent there. - GAUGE_DISTRIBUTION = 3; - - // Integer cumulative measurement. The value cannot decrease, if resets - // then the start_time should also be reset. - CUMULATIVE_INT64 = 4; - - // Floating point cumulative measurement. The value cannot decrease, if - // resets then the start_time should also be reset. Recorded values are - // always >= 0. - CUMULATIVE_DOUBLE = 5; - - // Distribution cumulative measurement. The count and sum cannot decrease, - // if resets then the start_time should also be reset. - CUMULATIVE_DISTRIBUTION = 6; - - // Some frameworks implemented Histograms as a summary of observations - // (usually things like request durations and response sizes). While it - // also provides a total count of observations and a sum of all observed - // values, it calculates configurable percentiles over a sliding time - // window. This is not recommended, since it cannot be aggregated. - SUMMARY = 7; - } - Type type = 4; - - // The label keys associated with the metric descriptor. - repeated LabelKey label_keys = 5; -} - -// Defines a label key associated with a metric descriptor. -message LabelKey { - // The key for the label. - string key = 1; - - // A human-readable description of what this label key represents. - string description = 2; -} - -// A collection of data points that describes the time-varying values -// of a metric. -message TimeSeries { - // Must be present for cumulative metrics. The time when the cumulative value - // was reset to zero. Exclusive. The cumulative value is over the time interval - // (start_timestamp, timestamp]. If not specified, the backend can use the - // previous recorded value. - google.protobuf.Timestamp start_timestamp = 1; - - // The set of label values that uniquely identify this timeseries. Applies to - // all points. The order of label values must match that of label keys in the - // metric descriptor. - repeated LabelValue label_values = 2; - - // The data points of this timeseries. Point.value type MUST match the - // MetricDescriptor.type. - repeated Point points = 3; -} - -message LabelValue { - // The value for the label. - string value = 1; - // If false the value field is ignored and considered not set. - // This is used to differentiate a missing label from an empty string. - bool has_value = 2; -} - -// A timestamped measurement. -message Point { - // The moment when this point was recorded. Inclusive. - // If not specified, the timestamp will be decided by the backend. - google.protobuf.Timestamp timestamp = 1; - - // The actual point value. - oneof value { - // A 64-bit integer. - int64 int64_value = 2; - - // A 64-bit double-precision floating-point number. - double double_value = 3; - - // A distribution value. - DistributionValue distribution_value = 4; - - // A summary value. This is not recommended, since it cannot be aggregated. - SummaryValue summary_value = 5; - } -} - -// Distribution contains summary statistics for a population of values. It -// optionally contains a histogram representing the distribution of those -// values across a set of buckets. -message DistributionValue { - // The number of values in the population. Must be non-negative. This value - // must equal the sum of the values in bucket_counts if a histogram is - // provided. - int64 count = 1; - - // The sum of the values in the population. If count is zero then this field - // must be zero. - double sum = 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) - // - // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition - // describes Welford's method for accumulating this sum in one pass. - // - // If count is zero then this field must be zero. - double sum_of_squared_deviation = 3; - - // A Distribution may optionally contain a histogram of the values in the - // population. The bucket boundaries for that histogram are described by - // BucketOptions. - // - // If bucket_options has no type, then there is no histogram associated with - // the Distribution. - message BucketOptions { - oneof type { - // Bucket with explicit bounds. - Explicit explicit = 1; - } - - // Specifies a set of buckets with arbitrary upper-bounds. - // This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket - // index i are: - // - // [0, bucket_bounds[i]) for i == 0 - // [bucket_bounds[i-1], bucket_bounds[i]) for 0 < i < N-1 - // [bucket_bounds[i], +infinity) for i == N-1 - message Explicit { - // The values must be strictly increasing and > 0. - repeated double bounds = 1; - } - - // TODO: If OpenMetrics decides to support (a, b] intervals we should add - // support for these by defining a boolean value here which decides what - // type of intervals to use. - } - - // Don't change bucket boundaries within a TimeSeries if your backend doesn't - // support this. - // TODO(issue #152): consider not required to send bucket options for - // optimization. - BucketOptions bucket_options = 4; - - message Bucket { - // The number of values in each bucket of the histogram, as described in - // bucket_bounds. - int64 count = 1; - - // If the distribution does not have a histogram, then omit this field. - Exemplar exemplar = 2; - } - - // If the distribution does not have a histogram, then omit this field. - // If there is a histogram, then the sum of the values in the Bucket counts - // must equal the value in the count field of the distribution. - repeated Bucket buckets = 5; - - // Exemplars are example points that may be used to annotate aggregated - // Distribution values. They are metadata that gives information about a - // particular value added to a Distribution bucket. - message Exemplar { - // Value of the exemplar point. It determines which bucket the exemplar - // belongs to. - double value = 1; - - // The observation (sampling) time of the above value. - google.protobuf.Timestamp timestamp = 2; - - // Contextual information about the example value. - map attachments = 3; - } -} - -// The start_timestamp only applies to the count and sum in the SummaryValue. -message SummaryValue { - // The total number of recorded values since start_time. Optional since - // some systems don't expose this. - google.protobuf.Int64Value count = 1; - - // The total sum of recorded values since start_time. Optional since some - // systems don't expose this. If count is zero then this field must be zero. - // This field must be unset if the sum is not available. - google.protobuf.DoubleValue sum = 2; - - // The values in this message can be reset at arbitrary unknown times, with - // the requirement that all of them are reset at the same time. - message Snapshot { - // The number of values in the snapshot. Optional since some systems don't - // expose this. - google.protobuf.Int64Value count = 1; - - // The sum of values in the snapshot. Optional since some systems don't - // expose this. If count is zero then this field must be zero or not set - // (if not supported). - google.protobuf.DoubleValue sum = 2; - - // Represents the value at a given percentile of a distribution. - message ValueAtPercentile { - // The percentile of a distribution. Must be in the interval - // (0.0, 100.0]. - double percentile = 1; - - // The value at the given percentile of a distribution. - double value = 2; - } - - // A list of values at different percentiles of the distribution calculated - // from the current snapshot. The percentiles must be strictly increasing. - repeated ValueAtPercentile percentile_values = 3; - } - - // Values calculated over an arbitrary time window. - Snapshot snapshot = 3; -} - diff --git a/api/src/main/proto/opencensus/proto/resource/v1/resource.proto b/api/src/main/proto/opencensus/proto/resource/v1/resource.proto deleted file mode 100644 index 3303db738..000000000 --- a/api/src/main/proto/opencensus/proto/resource/v1/resource.proto +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package opencensus.proto.resource.v1; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.resource.v1"; -option java_outer_classname = "ResourceProto"; - -option ruby_package = "OpenCensus.Proto.Resource.V1"; - -// Resource information. -message Resource { - - // Type identifier for the resource. - string type = 1; - - // Set of labels that describe the resource. - map labels = 2; -} diff --git a/api/src/main/proto/opencensus/proto/stats/v1/stats.proto b/api/src/main/proto/opencensus/proto/stats/v1/stats.proto deleted file mode 100644 index 3da29a4d5..000000000 --- a/api/src/main/proto/opencensus/proto/stats/v1/stats.proto +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2016-18, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package opencensus.proto.stats.v1; - -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/stats/v1"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.stats.v1"; -option java_outer_classname = "StatsProto"; - -option ruby_package = "OpenCensus.Proto.Stats.V1"; - -// TODO(bdrutu): Consider if this should be moved to a "tags" directory to match the API structure. -message Tag { - string key = 1; - string value = 2; -} - -// Measure . -message Measure { - // A string by which the measure will be referred to, e.g. "rpc_server_latency". Names MUST be - // unique within the library. - string name = 1; - - // Describes the measure, e.g. "RPC latency in seconds". - string description = 2; - - // Describes the unit used for the Measure. Follows the format described by - // http://unitsofmeasure.org/ucum.html. - string unit = 3; - - enum Type { - // Unknown type. - TYPE_UNSPECIFIED = 0; - // Indicates an int64 Measure. - INT64 = 1; - // Indicates a double Measure. - DOUBLE = 2; - } - - // The type used for this Measure. - Type type = 4; -} - -message View { - // A string by which the View will be referred to, e.g. "rpc_latency". Names MUST be unique - // within the library. - string name = 1; - - // Describes the view, e.g. "RPC latency distribution" - string description = 2; - - // The Measure to which this view is applied. - Measure measure = 3; - - // An array of tag keys. These values associated with tags of this name form the basis by which - // individual stats will be aggregated (one aggregation per unique tag value). If none are - // provided, then all data is recorded in a single aggregation. - repeated string columns = 4; - - // The description of the aggregation used for this view which describes how data collected are - // aggregated. - oneof aggregation { - // Counts the number of measurements recorded. - CountAggregation count_aggregation = 5; - // Indicates that data collected and aggregated with this Aggregation will be summed up. - SumAggregation sum_aggregation = 6; - // Indicates that data collected and aggregated with this Aggregation will represent the last - // recorded value. This is useful to support Gauges. - LastValueAggregation last_value_aggregation = 7; - // Indicates that the desired Aggregation is a histogram distribution. A distribution - // Aggregation may contain a histogram of the values in the population. User should define the - // bucket boundaries for that histogram (see DistributionAggregation). - DistributionAggregation distribution_aggregation = 8; - } -} - -message CountAggregation {} - -message SumAggregation {} - -message LastValueAggregation {} - -message DistributionAggregation { - // A Distribution may optionally contain a histogram of the values in the - // population. The bucket boundaries for that histogram are described by - // `bucket_bounds`. This defines `size(bucket_bounds) + 1` (= N) - // buckets. The boundaries for bucket index i are: - // - // (-infinity, bucket_bounds[i]) for i == 0 - // [bucket_bounds[i-1], bucket_bounds[i]) for 0 < i < N-2 - // [bucket_bounds[i-1], +infinity) for i == N-1 - // - // i.e. an underflow bucket (number 0), zero or more finite buckets (1 - // through N - 2, and an overflow bucket (N - 1), with inclusive lower - // bounds and exclusive upper bounds. - // - // If `bucket_bounds` has no elements (zero size), then there is no - // histogram associated with the Distribution. If `bucket_bounds` has only - // one element, there are no finite buckets, and that single element is the - // common boundary of the overflow and underflow buckets. The values must - // be monotonically increasing. - repeated double bucket_bounds = 1; -} - -// Describes a data point to be collected for a Measure. -message Measurement { - repeated Tag tags = 1; - - // The name of the measure to which the value is applied. - string measure_name = 2; - - // The recorded value, MUST have the appropriate type to match the Measure. - oneof value { - double double_value = 3; - int64 int_value = 4; - } - - // The time when this measurement was recorded. If the implementation uses a async buffer to - // record measurements this may be the time when the measurement was read from the buffer. - google.protobuf.Timestamp time = 5; -} diff --git a/api/src/main/proto/opencensus/proto/trace/v1/trace.proto b/api/src/main/proto/opencensus/proto/trace/v1/trace.proto deleted file mode 100644 index 078d13a8a..000000000 --- a/api/src/main/proto/opencensus/proto/trace/v1/trace.proto +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright 2017, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package opencensus.proto.trace.v1; - -import "opencensus/proto/resource/v1/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.trace.v1"; -option java_outer_classname = "TraceProto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"; - -option ruby_package = "OpenCensus.Proto.Trace.V1"; - -// A span represents a single operation within a trace. Spans can be -// nested to form a trace tree. Spans may also be linked to other spans -// from the same or different trace. And form graphs. Often, a trace -// contains a root span that describes the end-to-end latency, and one -// or more subspans for its sub-operations. A trace can also contain -// multiple root spans, or none at all. Spans do not need to be -// contiguous - there may be gaps or overlaps between spans in a trace. -// -// The next id is 17. -// TODO(bdrutu): Add an example. -message Span { - // A unique identifier for a trace. All spans from the same trace share - // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes - // is considered invalid. - // - // This field is semantically required. Receiver should generate new - // random trace_id if empty or invalid trace_id was received. - // - // This field is required. - bytes trace_id = 1; - - // A unique identifier for a span within a trace, assigned when the span - // is created. The ID is an 8-byte array. An ID with all zeroes is considered - // invalid. - // - // This field is semantically required. Receiver should generate new - // random span_id if empty or invalid span_id was received. - // - // This field is required. - bytes span_id = 2; - - // This field conveys information about request position in multiple distributed tracing graphs. - // It is a list of Tracestate.Entry with a maximum of 32 members in the list. - // - // See the https://github.com/w3c/distributed-tracing for more details about this field. - message Tracestate { - message Entry { - // The key must begin with a lowercase letter, and can only contain - // lowercase letters 'a'-'z', digits '0'-'9', underscores '_', dashes - // '-', asterisks '*', and forward slashes '/'. - string key = 1; - - // The value is opaque string up to 256 characters printable ASCII - // RFC0020 characters (i.e., the range 0x20 to 0x7E) except ',' and '='. - // Note that this also excludes tabs, newlines, carriage returns, etc. - string value = 2; - } - - // A list of entries that represent the Tracestate. - repeated Entry entries = 1; - } - - // The Tracestate on the span. - Tracestate tracestate = 15; - - // The `span_id` of this span's parent span. If this is a root span, then this - // field must be empty. The ID is an 8-byte array. - bytes parent_span_id = 3; - - // A description of the span's operation. - // - // For example, the name can be a qualified method name or a file name - // and a line number where the operation is called. A best practice is to use - // the same display name at the same call point in an application. - // This makes it easier to correlate spans in different traces. - // - // This field is semantically required to be set to non-empty string. - // When null or empty string received - receiver may use string "name" - // as a replacement. There might be smarted algorithms implemented by - // receiver to fix the empty span name. - // - // This field is required. - TruncatableString name = 4; - - // Type of span. Can be used to specify additional relationships between spans - // in addition to a parent/child relationship. - enum SpanKind { - // Unspecified. - SPAN_KIND_UNSPECIFIED = 0; - - // Indicates that the span covers server-side handling of an RPC or other - // remote network request. - SERVER = 1; - - // Indicates that the span covers the client-side wrapper around an RPC or - // other remote request. - CLIENT = 2; - } - - // Distinguishes between spans generated in a particular context. For example, - // two spans with the same name may be distinguished using `CLIENT` (caller) - // and `SERVER` (callee) to identify queueing latency associated with the span. - SpanKind kind = 14; - - // The start time of the span. On the client side, this is the time kept by - // the local machine where the span execution starts. On the server side, this - // is the time when the server's application handler starts running. - // - // This field is semantically required. When not set on receive - - // receiver should set it to the value of end_time field if it was - // set. Or to the current time if neither was set. It is important to - // keep end_time > start_time for consistency. - // - // This field is required. - google.protobuf.Timestamp start_time = 5; - - // The end time of the span. On the client side, this is the time kept by - // the local machine where the span execution ends. On the server side, this - // is the time when the server application handler stops running. - // - // This field is semantically required. When not set on receive - - // receiver should set it to start_time value. It is important to - // keep end_time > start_time for consistency. - // - // This field is required. - google.protobuf.Timestamp end_time = 6; - - // A set of attributes, each with a key and a value. - message Attributes { - // The set of attributes. The value can be a string, an integer, a double - // or the Boolean values `true` or `false`. Note, global attributes like - // server name can be set as tags using resource API. Examples of attributes: - // - // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" - // "/http/server_latency": 300 - // "abc.com/myattribute": true - // "abc.com/score": 10.239 - map attribute_map = 1; - - // The number of attributes that were discarded. Attributes can be discarded - // because their keys are too long or because there are too many attributes. - // If this value is 0, then no attributes were dropped. - int32 dropped_attributes_count = 2; - } - - // A set of attributes on the span. - Attributes attributes = 7; - - // A stack trace captured at the start of the span. - StackTrace stack_trace = 8; - - // A time-stamped annotation or message event in the Span. - message TimeEvent { - // The time the event occurred. - google.protobuf.Timestamp time = 1; - - // A text annotation with a set of attributes. - message Annotation { - // A user-supplied message describing the event. - TruncatableString description = 1; - - // A set of attributes on the annotation. - Attributes attributes = 2; - } - - // An event describing a message sent/received between Spans. - message MessageEvent { - // Indicates whether the message was sent or received. - enum Type { - // Unknown event type. - TYPE_UNSPECIFIED = 0; - // Indicates a sent message. - SENT = 1; - // Indicates a received message. - RECEIVED = 2; - } - - // The type of MessageEvent. Indicates whether the message was sent or - // received. - Type type = 1; - - // An identifier for the MessageEvent's message that can be used to match - // SENT and RECEIVED MessageEvents. For example, this field could - // represent a sequence ID for a streaming RPC. It is recommended to be - // unique within a Span. - uint64 id = 2; - - // The number of uncompressed bytes sent or received. - uint64 uncompressed_size = 3; - - // The number of compressed bytes sent or received. If zero, assumed to - // be the same size as uncompressed. - uint64 compressed_size = 4; - } - - // A `TimeEvent` can contain either an `Annotation` object or a - // `MessageEvent` object, but not both. - oneof value { - // A text annotation with a set of attributes. - Annotation annotation = 2; - - // An event describing a message sent/received between Spans. - MessageEvent message_event = 3; - } - } - - // A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation - // on the span, consisting of either user-supplied key-value pairs, or - // details of a message sent/received between Spans. - message TimeEvents { - // A collection of `TimeEvent`s. - repeated TimeEvent time_event = 1; - - // The number of dropped annotations in all the included time events. - // If the value is 0, then no annotations were dropped. - int32 dropped_annotations_count = 2; - - // The number of dropped message events in all the included time events. - // If the value is 0, then no message events were dropped. - int32 dropped_message_events_count = 3; - } - - // The included time events. - TimeEvents time_events = 9; - - // A pointer from the current span to another span in the same trace or in a - // different trace. For example, this can be used in batching operations, - // where a single batch handler processes multiple requests from different - // traces or when the handler receives a request from a different project. - message Link { - // A unique identifier of a trace that this linked span is part of. The ID is a - // 16-byte array. - bytes trace_id = 1; - - // A unique identifier for the linked span. The ID is an 8-byte array. - bytes span_id = 2; - - // The relationship of the current span relative to the linked span: child, - // parent, or unspecified. - enum Type { - // The relationship of the two spans is unknown, or known but other - // than parent-child. - TYPE_UNSPECIFIED = 0; - // The linked span is a child of the current span. - CHILD_LINKED_SPAN = 1; - // The linked span is a parent of the current span. - PARENT_LINKED_SPAN = 2; - } - - // The relationship of the current span relative to the linked span. - Type type = 3; - - // A set of attributes on the link. - Attributes attributes = 4; - - // The Tracestate associated with the link. - Tracestate tracestate = 5; - } - - // A collection of links, which are references from this span to a span - // in the same or different trace. - message Links { - // A collection of links. - repeated Link link = 1; - - // The number of dropped links after the maximum size was enforced. If - // this value is 0, then no links were dropped. - int32 dropped_links_count = 2; - } - - // The included links. - Links links = 10; - - // An optional final status for this span. Semantically when Status - // wasn't set it is means span ended without errors and assume - // Status.Ok (code = 0). - Status status = 11; - - // An optional resource that is associated with this span. If not set, this span - // should be part of a batch that does include the resource information, unless resource - // information is unknown. - opencensus.proto.resource.v1.Resource resource = 16; - - // A highly recommended but not required flag that identifies when a - // trace crosses a process boundary. True when the parent_span belongs - // to the same process as the current span. This flag is most commonly - // used to indicate the need to adjust time as clocks in different - // processes may not be synchronized. - google.protobuf.BoolValue same_process_as_parent_span = 12; - - // An optional number of child spans that were generated while this span - // was active. If set, allows an implementation to detect missing child spans. - google.protobuf.UInt32Value child_span_count = 13; -} - -// The `Status` type defines a logical error model that is suitable for different -// programming environments, including REST APIs and RPC APIs. This proto's fields -// are a subset of those of -// [google.rpc.Status](https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto), -// which is used by [gRPC](https://github.com/grpc). -message Status { - // The status code. This is optional field. It is safe to assume 0 (OK) - // when not set. - int32 code = 1; - - // A developer-facing error message, which should be in English. - string message = 2; -} - -// The value of an Attribute. -message AttributeValue { - // The type of the value. - oneof value { - // A string up to 256 bytes long. - TruncatableString string_value = 1; - // A 64-bit signed integer. - int64 int_value = 2; - // A Boolean value represented by `true` or `false`. - bool bool_value = 3; - // A double value. - double double_value = 4; - } -} - -// The call stack which originated this span. -message StackTrace { - // A single stack frame in a stack trace. - message StackFrame { - // The fully-qualified name that uniquely identifies the function or - // method that is active in this frame. - TruncatableString function_name = 1; - // An un-mangled function name, if `function_name` is - // [mangled](http://www.avabodh.com/cxxin/namemangling.html). The name can - // be fully qualified. - TruncatableString original_function_name = 2; - // The name of the source file where the function call appears. - TruncatableString file_name = 3; - // The line number in `file_name` where the function call appears. - int64 line_number = 4; - // The column number where the function call appears, if available. - // This is important in JavaScript because of its anonymous functions. - int64 column_number = 5; - // The binary module from where the code was loaded. - Module load_module = 6; - // The version of the deployed source code. - TruncatableString source_version = 7; - } - - // A collection of stack frames, which can be truncated. - message StackFrames { - // Stack frames in this call stack. - repeated StackFrame frame = 1; - // The number of stack frames that were dropped because there - // were too many stack frames. - // If this value is 0, then no stack frames were dropped. - int32 dropped_frames_count = 2; - } - - // Stack frames in this stack trace. - StackFrames stack_frames = 1; - - // The hash ID is used to conserve network bandwidth for duplicate - // stack traces within a single trace. - // - // Often multiple spans will have identical stack traces. - // The first occurrence of a stack trace should contain both - // `stack_frames` and a value in `stack_trace_hash_id`. - // - // Subsequent spans within the same request can refer - // to that stack trace by setting only `stack_trace_hash_id`. - // - // TODO: describe how to deal with the case where stack_trace_hash_id is - // zero because it was not set. - uint64 stack_trace_hash_id = 2; -} - -// A description of a binary module. -message Module { - // TODO: document the meaning of this field. - // For example: main binary, kernel modules, and dynamic libraries - // such as libc.so, sharedlib.so. - TruncatableString module = 1; - - // A unique identifier for the module, usually a hash of its - // contents. - TruncatableString build_id = 2; -} - -// A string that might be shortened to a specified length. -message TruncatableString { - // The shortened string. For example, if the original string was 500 bytes long and - // the limit of the string was 128 bytes, then this value contains the first 128 - // bytes of the 500-byte string. Note that truncation always happens on a - // character boundary, to ensure that a truncated string is still valid UTF-8. - // Because it may contain multi-byte characters, the size of the truncated string - // may be less than the truncation limit. - string value = 1; - - // The number of bytes removed from the original string. If this - // value is 0, then the string was not shortened. - int32 truncated_byte_count = 2; -} diff --git a/api/src/main/proto/opencensus/proto/trace/v1/trace_config.proto b/api/src/main/proto/opencensus/proto/trace/v1/trace_config.proto deleted file mode 100644 index cb6ccb916..000000000 --- a/api/src/main/proto/opencensus/proto/trace/v1/trace_config.proto +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018, OpenCensus Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package opencensus.proto.trace.v1; - -option java_multiple_files = true; -option java_package = "io.opencensus.proto.trace.v1"; -option java_outer_classname = "TraceConfigProto"; - -option go_package = "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1"; - -option ruby_package = "OpenCensus.Proto.Trace.V1"; - -// Global configuration of the trace service. All fields must be specified, or -// the default (zero) values will be used for each type. -message TraceConfig { - - // The global default sampler used to make decisions on span sampling. - oneof sampler { - ProbabilitySampler probability_sampler = 1; - - ConstantSampler constant_sampler = 2; - - RateLimitingSampler rate_limiting_sampler = 3; - } - - // The global default max number of attributes per span. - int64 max_number_of_attributes = 4; - - // The global default max number of annotation events per span. - int64 max_number_of_annotations = 5; - - // The global default max number of message events per span. - int64 max_number_of_message_events = 6; - - // The global default max number of link entries per span. - int64 max_number_of_links = 7; -} - -// Sampler that tries to uniformly sample traces with a given probability. -// The probability of sampling a trace is equal to that of the specified probability. -message ProbabilitySampler { - - // The desired probability of sampling. Must be within [0.0, 1.0]. - double samplingProbability = 1; -} - -// Sampler that always makes a constant decision on span sampling. -message ConstantSampler { - - // How spans should be sampled: - // - Always off - // - Always on - // - Always follow the parent Span's decision (off if no parent). - enum ConstantDecision { - ALWAYS_OFF = 0; - ALWAYS_ON = 1; - ALWAYS_PARENT = 2; - } - ConstantDecision decision = 1; -} - -// Sampler that tries to sample with a rate per time window. -message RateLimitingSampler { - - // Rate per second. - int64 qps = 1; -} diff --git a/pom.xml b/pom.xml index d42803be5..3d65c8ae0 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ 1.22.1 26.0-android 4.13.1 + 0.2.0 3.9.1 3.1.0 1.7.26 diff --git a/tools/API_SHAS b/tools/API_SHAS index 1921efb59..36c802351 100644 --- a/tools/API_SHAS +++ b/tools/API_SHAS @@ -7,6 +7,5 @@ ENVOY_SHA="dcd329a2e95b54f754b17aceca3f72724294b502" GOOGLEAPIS_SHA="82944da21578a53b74e547774cf62ed31a05b841" # 2019-12-02 PGV_VERSION="0.6.7" # 2022-03-04 PROMETHEUS_SHA="147c58e9608a4f9628b53b6cc863325ca746f63a" # 2021-06-07 -OPENCENSUS_VERSION="0.3.0" # 2020-07-21 OPENTELEMETRY_VERSION="0.11.0" # 2021-10-07 UDPA_SHA="7f1daf1720fc185f3b63f70d25aefaeef83d88d7" # 2022-03-14 diff --git a/tools/update-api.sh b/tools/update-api.sh index b8c9274c3..e83c1d0c2 100755 --- a/tools/update-api.sh +++ b/tools/update-api.sh @@ -46,10 +46,6 @@ curl -sL https://github.com/envoyproxy/protoc-gen-validate/archive/v${PGV_VERSIO mkdir -p "${protodir}/validate" cp -r protoc-gen-validate-*/validate/* "${protodir}/validate" -curl -sL https://github.com/census-instrumentation/opencensus-proto/archive/v${OPENCENSUS_VERSION}.tar.gz | tar xz --wildcards '*.proto' -mkdir -p "${protodir}/opencensus/proto" -cp -r opencensus-proto-*/src/opencensus/proto/* "${protodir}/opencensus/proto" - curl -sL https://github.com/prometheus/client_model/archive/${PROMETHEUS_SHA}.tar.gz | tar xz --wildcards '*.proto' mkdir -p "${protodir}/io/prometheus/client/" cp client_model-*/io/prometheus/client/metrics.proto "${protodir}/io/prometheus/client/" diff --git a/tools/update-sha.sh b/tools/update-sha.sh index 36c689a07..fc3836990 100755 --- a/tools/update-sha.sh +++ b/tools/update-sha.sh @@ -35,9 +35,6 @@ PGV_GIT_DATE=$(find_date "$CURL_OUTPUT" com_envoyproxy_protoc_gen_validate) PROMETHEUS_SHA=$(find_sha "$CURL_OUTPUT" prometheus_metrics_model) PROMETHEUS_DATE=$(find_date "$CURL_OUTPUT" prometheus_metrics_model) -OPENCENSUS_SHA=$(find_sha "$CURL_OUTPUT" opencensus_proto) -OPENCENSUS_DATE=$(find_date "$CURL_OUTPUT" opencensus_proto) - UDPA_SHA=$(find_sha "$CURL_OUTPUT" com_github_cncf_udpa) UDPA_DATE=$(find_date "$CURL_OUTPUT" com_github_cncf_udpa) @@ -53,7 +50,6 @@ ENVOY_SHA=\"$ENVOY_VERSION\" GOOGLEAPIS_SHA=\"$GOOGLEAPIS_SHA\" # $GOOGLEAPIS_DATE PGV_VERSION=\"$PGV_GIT_SHA\" # $PGV_GIT_DATE PROMETHEUS_SHA=\"$PROMETHEUS_SHA\" # $PROMETHEUS_DATE -OPENCENSUS_VERSION=\"$OPENCENSUS_SHA\" # $OPENCENSUS_DATE OPENTELEMETRY_VERSION=\"$OPENTELEMETRY_SHA\" # $OPENTELEMETRY_DATE UDPA_SHA=\"$UDPA_SHA\" # $UDPA_DATE "