diff --git a/gradle.properties b/gradle.properties index 79e888c..94fb02b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=1.34.4-1 +version=1.34.10-1 org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 diff --git a/src/main/proto/cel/expr/checked.proto b/src/main/proto/cel/expr/checked.proto index e327db9..0105b93 100644 --- a/src/main/proto/cel/expr/checked.proto +++ b/src/main/proto/cel/expr/checked.proto @@ -236,6 +236,20 @@ message Decl { Constant value = 2; // Documentation string for the identifier. + // + // Provide a brief description of what the variable represents and whether + // there are any constraints on the formatting or supported value range. + // + // Examples: + // + // 'request.auth.principal' - string which uniquely identifies an + // authenticated principal. For JSON Web Tokens (JWTs), the principal + // is the combination of the issuer ('iss') and subject ('sub') token + // fields concatenated by a forward slash: iss + `/` + sub. + // + // 'min_cpus' - integer value indicates the minimum number of CPUs + // required for a compute cluster. The 'min_cpus' value must be + // greater than zero and less than 'max_cpus' or 64 whichever is less. string doc = 3; } @@ -293,11 +307,45 @@ message Decl { bool is_instance_function = 5; // Documentation string for the overload. + // + // Provide examples of the overload behavior, preferring to use literal + // values as input with a comment on the return value. + // + // Examples: + // + // // Determine whether a value of type exists within a list. + // 2 in [1, 2, 3] // returns true + // + // // Determine whether a key of type exists within a map. + // 'hello' in {'hi': 'you', 'hello': 'there'} // returns true + // 'help' in {'hi': 'you', 'hello': 'there'} // returns false + // + // // Take the substring of a string starting at a specific character + // // offset (inclusive). + // "tacocat".substring(1) // returns "acocat" + // "tacocat".substring(20) // error + // + // // Take the substring of a string starting at a specific character + // // offset (inclusive) and ending at the given offset (exclusive). + // "tacocat".substring(1, 6) // returns "acoca" string doc = 6; } // Required. List of function overloads, must contain at least one overload. repeated Overload overloads = 1; + + // Documentation string for the function that indicates the general purpose + // of the function and its behavior. + // + // Documentation strings for the function should be general purpose with + // specific examples provided in the overload doc string. + // + // Examples: + // + // The 'in' operator tests whether an item exists in a collection. + // + // The 'substring' function returns a substring of a target string. + string doc = 2; } // The fully qualified name of the declaration. diff --git a/src/main/proto/cel/expr/conformance/env_config.proto b/src/main/proto/cel/expr/conformance/env_config.proto new file mode 100644 index 0000000..dce0df6 --- /dev/null +++ b/src/main/proto/cel/expr/conformance/env_config.proto @@ -0,0 +1,183 @@ +// Copyright 2025 Google LLC +// +// 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 cel.expr.conformance; + +import "cel/expr/checked.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option go_package = "cel.dev/expr/conformance"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "cel.dev.expr.conformance"; + +// Representation of a CEL Environment, defining what features and extensions +// are available for conformance testing. +message Environment { + // Name of the environment + string name = 1; + + // Description for the current environment + string description = 2; + + // Sets the namespace (container) for the expression. + // This is used to simplify resolution. + // For example with container + // `google.rpc.context` + // an identifier of `google.rpc.context.AttributeContext` could be referred + // to simply as `AttributeContext` in the CEL expression. + string container = 3; + + // Import represents a type name that will be abbreviated by its simple name + // making it easier to reference simple type names from packages other than + // the expression container. + // For ex: + // Import{name: 'google.rpc.Status'} + // The above import will ensure that `google.rpc.Status` is available by the + // simple name `Status` within CEL expressions. + message Import { + // Qualified type name which will be abbreviated + string name = 1; + } + + // List of abbreviations to be added to the CEL environment + repeated Import imports = 4; + + // Set of options to subset a subsettable library + LibrarySubset stdlib = 5; + + // List of extensions to enable in the CEL environment. + repeated Extension extensions = 6; + + // ContextVariable represents a message type to be made available as a + // context variable to the CEL environment. + message ContextVariable { + // Fully qualified type name of the context proto. + string type_name = 1; + } + + // If set, adds a context declaration from a proto message. + // + // Context messages have all of their top-level fields available as variables + // in the type checker. + ContextVariable context_variable = 7; + + // List of declarations to be configured in the CEL environment. + // + // Note: The CEL environment can be configured with either the + // context_variable or a set of ident_decls provided as part of declarations. + // Providing both will result in an error. + repeated cel.expr.Decl declarations = 8; + + // List of validators for validating the parsed ast. + repeated Validator validators = 9; + + // List of feature flags to be enabled or disabled. + repeated Feature features = 10; + + // Disables including the declarations from the standard CEL environment. + // + // NOTE: Do not disable the standard CEL declarations unless you are aware of + // the implications and have discussed your use case on cel-discuss@ + // or with the members of the cel-governance-team@ + // + // Deprecated: Use LibrarySubset to disable standard cel declarations instead: + // stdlib = LibrarySubset{ disable: true } + bool disable_standard_cel_declarations = 11; + + // If provided, uses the provided FileDescriptorSet to extend types available + // the CEL expression. All "well-known" protobuf messages (google.protobuf.*) + // are known to the CEL compiler, but all others must be provided for type + // checking. + google.protobuf.FileDescriptorSet message_type_extension = 12; + + // When macro call tracking is enabled, the resulting SourceInfo in the + // CheckedExpr will contain a collection of expressions representing the + // function calls which were replaced by macros. + // + // Deprecated: Use Feature to enable macro call tracking + // Feature{ name: "cel.feature.macro_call_tracking", enabled: true } + bool enable_macro_call_tracking = 13; +} + +// Represents a named validator with an optional map-based configuration object. +// Naming convention followed by validators: +// .validator. +// For ex: +// `cel.validator.timestamp` +// +// Note: the map-keys must directly correspond to the internal representation of +// the original validator, and should only use primitive scalar types as values +// at this time. +message Validator { + string name = 1; + + // Additional configurations to be included as part of the validation + map config = 2; +} + +// Represents a named boolean feature flag supported by CEL. +// Naming convention followed by features: +// .feature. +// For ex: +// `cel.feature.cross_type_numeric_comparisons` +message Feature { + // Name of the feature flag. + string name = 1; + + // State of the feature flab. + bool enabled = 2; +} + +// Extension represents a versioned extension library reference to enable in the +// CEL environment. +message Extension { + // Name of the extension library. + string name = 1; + // Version of the extension library. + string version = 2; +} + +// LibrarySubset indicates a subset of the macros and functions supported by a +// subsettable library. +message LibrarySubset { + // Indicates whether the library has been disabled, typically only + // used for default-enabled libraries like stdlib. + bool disabled = 1; + + // Disables macros for the given library. + bool disable_macros = 2; + + // Specifies a set of macro function names to include in the subset. + repeated string include_macros = 3; + + // Specifies a set of macro function names to exclude from the subset. + // Note: if IncludeMacros is non-empty, then ExcludeFunctions is ignored. + repeated string exclude_macros = 4; + + // Specifies a set of functions to include in the subset. + // + // Note: the overloads specified in the subset need only specify their ID. + // Note: if IncludeFunctions is non-empty, then ExcludeFunctions is ignored. + repeated cel.expr.Decl include_functions = 5; + + // Specifies the set of functions to exclude from the subset. + // + // Note: the overloads specified in the subset need only specify their ID. + repeated cel.expr.Decl exclude_functions = 6; +} diff --git a/src/main/proto/cel/expr/conformance/envcheck.proto b/src/main/proto/cel/expr/conformance/envcheck.proto deleted file mode 100644 index 93585c6..0000000 --- a/src/main/proto/cel/expr/conformance/envcheck.proto +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2023 Google LLC -// -// 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. - -// Tests for runtime support of standard functions. - -syntax = "proto3"; - -package cel.expr.conformance; - -import "cel/expr/checked.proto"; - -option cc_enable_arenas = true; -option go_package = "cel.dev/expr/conformance"; -option java_multiple_files = true; -option java_outer_classname = "EnvcheckProto"; -option java_package = "dev.cel.expr.conformance"; - -// The format of a standard environment, i.e. a collection of declarations -// for the checker. -message Env { - // Required. The name of the environment. - string name = 1; - - // The declarations in this environment. - repeated cel.expr.Decl decl = 2; -} diff --git a/src/main/proto/cel/expr/conformance/proto2/test_all_types.proto b/src/main/proto/cel/expr/conformance/proto2/test_all_types.proto index 737ca3a..7a68093 100644 --- a/src/main/proto/cel/expr/conformance/proto2/test_all_types.proto +++ b/src/main/proto/cel/expr/conformance/proto2/test_all_types.proto @@ -1,9 +1,25 @@ +// Copyright 2024 Google LLC +// +// 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 = "proto2"; package cel.expr.conformance.proto2; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; @@ -47,6 +63,9 @@ message TestAllTypes { optional string single_string = 14 [default = "empty"]; optional bytes single_bytes = 15 [default = "none"]; + // Collides with 'in' operator. + optional bool in = 18; + // Wellknown. optional google.protobuf.Any single_any = 100; optional google.protobuf.Duration single_duration = 101; @@ -65,6 +84,8 @@ message TestAllTypes { optional google.protobuf.ListValue list_value = 114; optional google.protobuf.NullValue null_value = 115; optional google.protobuf.NullValue optional_null_value = 116; + optional google.protobuf.FieldMask field_mask = 117; + optional google.protobuf.Empty empty = 118; // Nested messages oneof nested_type { @@ -96,7 +117,7 @@ message TestAllTypes { repeated NestedEnum repeated_nested_enum = 52; repeated string repeated_string_piece = 53 [ctype = STRING_PIECE]; repeated string repeated_cord = 54 [ctype = CORD]; - repeated NestedMessage repeated_lazy_message = 55 [lazy = true]; + repeated NestedMessage repeated_lazy_message = 55; // Repeated wellknown. repeated google.protobuf.Any repeated_any = 120; @@ -286,6 +307,19 @@ message TestAllTypes { map map_string_string_wrapper = 321; map map_string_bool_wrapper = 322; map map_string_bytes_wrapper = 323; + + oneof kind { + NestedTestAllTypes oneof_type = 400; + NestedMessage oneof_msg = 401; + bool oneof_bool = 402; + } + + optional group NestedGroup = 403 { + optional int32 single_id = 404; + optional string single_name = 405; + } + + extensions 1000 to max; } // This proto includes a recursively nested message. diff --git a/src/main/proto/cel/expr/conformance/proto2/test_all_types_extensions.proto b/src/main/proto/cel/expr/conformance/proto2/test_all_types_extensions.proto new file mode 100644 index 0000000..1c37f4f --- /dev/null +++ b/src/main/proto/cel/expr/conformance/proto2/test_all_types_extensions.proto @@ -0,0 +1,44 @@ +// Copyright 2024 Google LLC +// +// 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 = "proto2"; + +package cel.expr.conformance.proto2; + +import "cel/expr/conformance/proto2/test_all_types.proto"; + +option cc_enable_arenas = true; +option go_package = "cel.dev/expr/conformance/proto2"; +option java_outer_classname = "TestAllTypesExtensions"; +option java_package = "dev.cel.expr.conformance.proto2"; +option java_multiple_files = true; + +// Package scoped extensions +extend TestAllTypes { + optional int32 int32_ext = 1000; + optional TestAllTypes nested_ext = 1001; + optional TestAllTypes test_all_types_ext = 1002; + optional TestAllTypes.NestedEnum nested_enum_ext = 1003; + repeated TestAllTypes repeated_test_all_types = 1004; +} + +// Message scoped extensions +message Proto2ExtensionScopedMessage { + extend TestAllTypes { + optional int64 int64_ext = 1005; + optional TestAllTypes message_scoped_nested_ext = 1006; + optional TestAllTypes.NestedEnum nested_enum_ext = 1007; + repeated TestAllTypes message_scoped_repeated_test_all_types = 1008; + } +} diff --git a/src/main/proto/cel/expr/conformance/proto3/test_all_types.proto b/src/main/proto/cel/expr/conformance/proto3/test_all_types.proto index c904868..8ddc472 100644 --- a/src/main/proto/cel/expr/conformance/proto3/test_all_types.proto +++ b/src/main/proto/cel/expr/conformance/proto3/test_all_types.proto @@ -1,9 +1,25 @@ +// Copyright 2024 Google LLC +// +// 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 cel.expr.conformance.proto3; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; @@ -46,6 +62,11 @@ message TestAllTypes { bool single_bool = 13; string single_string = 14; bytes single_bytes = 15; + optional bool optional_bool = 16; + optional bool optional_string = 17; + + // Collides with 'in' operator. + bool in = 18; // Wellknown. google.protobuf.Any single_any = 100; @@ -65,6 +86,8 @@ message TestAllTypes { google.protobuf.ListValue list_value = 114; google.protobuf.NullValue null_value = 115; optional google.protobuf.NullValue optional_null_value = 116; + google.protobuf.FieldMask field_mask = 117; + google.protobuf.Empty empty = 118; // Nested messages oneof nested_type { @@ -96,7 +119,7 @@ message TestAllTypes { repeated NestedEnum repeated_nested_enum = 52; repeated string repeated_string_piece = 53 [ctype = STRING_PIECE]; repeated string repeated_cord = 54 [ctype = CORD]; - repeated NestedMessage repeated_lazy_message = 55 [lazy = true]; + repeated NestedMessage repeated_lazy_message = 55; // Repeated wellknown. repeated google.protobuf.Any repeated_any = 120; @@ -286,6 +309,12 @@ message TestAllTypes { map map_string_string_wrapper = 321; map map_string_bool_wrapper = 322; map map_string_bytes_wrapper = 323; + + oneof kind { + NestedTestAllTypes oneof_type = 400; + NestedMessage oneof_msg = 401; + bool oneof_bool = 402; + } } // This proto includes a recursively nested message. diff --git a/src/main/proto/cel/expr/conformance/simple.proto b/src/main/proto/cel/expr/conformance/test/simple.proto similarity index 83% rename from src/main/proto/cel/expr/conformance/simple.proto rename to src/main/proto/cel/expr/conformance/test/simple.proto index 8b4ab80..227fc09 100644 --- a/src/main/proto/cel/expr/conformance/simple.proto +++ b/src/main/proto/cel/expr/conformance/test/simple.proto @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,21 +16,23 @@ syntax = "proto3"; -package cel.expr.conformance; +package cel.expr.conformance.test; import "cel/expr/checked.proto"; import "cel/expr/eval.proto"; import "cel/expr/value.proto"; option cc_enable_arenas = true; -option go_package = "cel.dev/expr/conformance"; +option go_package = "cel.dev/expr/conformance/test"; option java_multiple_files = true; option java_outer_classname = "SimpleProto"; -option java_package = "dev.cel.expr.conformance"; +option java_package = "dev.cel.expr.conformance.test"; // The format of a simple test file, expected to be stored in text format. // A file is the unit of granularity for selecting conformance tests, // so tests of optional features should be segregated into separate files. +// +// Deprecated: Use cel.expr.conformance.test.Suite message SimpleTestFile { // Required. The name of the file. Should match the filename. string name = 1; @@ -76,6 +78,9 @@ message SimpleTest { // Disables the check phase. bool disable_check = 5; + // Disables the evaluate phase. + bool check_only = 15; + // The type environment to use for the check phase. repeated cel.expr.Decl type_env = 6; @@ -97,6 +102,9 @@ message SimpleTest { // * a floating point NaN should match any NaN. cel.expr.Value value = 8; + // A result and deduced expression type. + TypedResult typed_result = 16; + // Matches error evaluation results. cel.expr.ErrorSet eval_error = 9; @@ -111,7 +119,17 @@ message SimpleTest { // (Using explicit message since oneof can't handle repeated.) UnknownSetMatcher any_unknowns = 12; } - // Next is 15. + // Next is 17. +} + +// Matches a result along with deduced expression type. +message TypedResult { + // A normal value, which must match the evaluation result exactly + // via value equality semantics. This is ignored if the test is `check_only`. + cel.expr.Value result = 1; + + // The deduced type of the expression as reported by the checker. + cel.expr.Type deduced_type = 2; } // Matches error results from Eval. diff --git a/src/main/proto/cel/expr/conformance/test/suite.proto b/src/main/proto/cel/expr/conformance/test/suite.proto new file mode 100644 index 0000000..d6789bd --- /dev/null +++ b/src/main/proto/cel/expr/conformance/test/suite.proto @@ -0,0 +1,161 @@ +// Copyright 2024 Google LLC +// +// 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. + +// Unit tests and end-to-end conformance tests. + +syntax = "proto3"; + +package cel.expr.conformance.test; + +import "cel/expr/checked.proto"; +import "cel/expr/eval.proto"; +import "cel/expr/value.proto"; +import "cel/expr/conformance/env_config.proto"; +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "cel.dev/expr/conformance/test"; +option java_multiple_files = true; +option java_outer_classname = "SuiteProto"; +option java_package = "dev.cel.expr.conformance.test"; + +// A test suite is a collection of tests designed to evaluate the correctness of +// a CEL policy, a CEL expression or the conformance of a CEL implementation to +// the standard specification. +message TestSuite { + // The name of the test suite. + string name = 1; + + // Description of the test suite. + string description = 2; + + // Test sections of the test suite. + // Each section represents a behavior to be tested. + repeated TestSection sections = 3; +} + +// A collection of related test cases. +message TestSection { + // Name of the test section. + string name = 1; + + // Description of the test section. + string description = 2; + + // Test cases of the test section. + // Each test case represents a test scenario. + repeated TestCase tests = 3; +} + +// A test to validate a CEL policy or expression. The test case encompasses +// evaluation of the compiled expression using the provided input bindings and +// asserting the result against the expected result. +// It can also validate a raw CEL expression string through parse, check and +// eval stages, making use of the augmenting CEL environment if provided. +message TestCase { + // Name of the test case. + string name = 1; + + // A description of the test. + string description = 2; + + // The text of the CEL expression. + string expr = 3; + + // Serialized environment to be used for compilation and evaluation of the + // CEL expression for the current test case. + // This option allows validating the same expression against multiple + // environments. + cel.expr.conformance.Environment env = 4; + + // Input for the test case + TestInput input = 5; + + // Expected result of the test case. + TestOutput output = 6; + + // If specified validates that the deduced type at check time matches + // If the result kind is not set and this field is set, the test is considered + // "check-only". + cel.expr.Type deduced_type = 7; + + // Bypass the type-checking and only attempt to evaluate the parsed + // expression. + bool disable_check = 8; +} + +// Input for the test case +message TestInput { + // The type of input for the test case + oneof input_kind { + // A set of variable bindings to be used for evaluating a checked + // expression. + Bindings bindings = 1; + + // A context message represents an input kind in the form of a proto + // message whose type is defined at runtime. + google.protobuf.Any context_message = 2; + + // A context expression representing a context proto variable. The + // fields of the input proto.Messages are used as top-level variables within + // an Activation. The expression is evaluated using the cel environment + // configured for the test suite. + string context_expr = 3; + } +} + +// The bindings of input variables for the test case. +message Bindings { + // A map representing a variable binding where the key is the name of the + // input variable. + map values = 1; +} + +// The input value for a variable binding +message InputValue { + // The type of input value that can be used for a variable binding + oneof kind { + // A simple literal value for a variable binding + cel.expr.Value value = 1; + + // An expression which evaluates to the value of the variable binding. + // The expression is evaluated using the same runtime environment as the + // one used for evaluating the expression under test. + string expr = 2; + } +} + +// Expected result of the test case. +message TestOutput { + // Type of expected result of the test case. + oneof result_kind { + // A normal value, which must match the evaluation result exactly via value + // equality semantics. This coincides with proto equality, except for: + // * maps are order-agnostic + // * a floating point NaN should match any NaN + cel.expr.Value result_value = 8; + + // An expression to be evaluated using the cel environment configured for + // the test suite. The result of this expression must match the result of + // the test case. + string result_expr = 9; + + // An error evaluation result set. Success if we match all of the errors in + // the set. + cel.expr.ErrorSet eval_error = 10; + + // An unknown evaluation result. + cel.expr.UnknownSet unknown = 11; + } +} diff --git a/src/main/proto/cel/expr/syntax.proto b/src/main/proto/cel/expr/syntax.proto index ed124a7..00635e6 100644 --- a/src/main/proto/cel/expr/syntax.proto +++ b/src/main/proto/cel/expr/syntax.proto @@ -185,8 +185,8 @@ message Expr { // macro tests whether the property is set to its default. For map and struct // types, the macro tests whether the property `x` is defined on `m`. // - // Comprehension evaluation can be best visualized as the following - // pseudocode: + // Comprehensions for the standard environment macros evaluation can be best + // visualized as the following pseudocode: // // ``` // let `accu_var` = `accu_init` @@ -198,11 +198,34 @@ message Expr { // } // return `result` // ``` + // + // Comprehensions for the optional V2 macros which support map-to-map + // translation differ slightly from the standard environment macros in that + // they expose both the key or index in addition to the value for each list + // or map entry: + // + // ``` + // let `accu_var` = `accu_init` + // for (let `iter_var`, `iter_var2` in `iter_range`) { + // if (!`loop_condition`) { + // break + // } + // `accu_var` = `loop_step` + // } + // return `result` + // ``` message Comprehension { - // The name of the iteration variable. + // The name of the first iteration variable. + // For the single iteration variable macros, when iter_range is a list, this + // variable is the list element and when the iter_range is a map, this + // variable is the map key. string iter_var = 1; - // The range over which var iterates. + // The name of the second iteration variable, empty if not set. + // This field is only set for comprehension v2 macros. + string iter_var2 = 8; + + // The range over which the comprehension iterates. Expr iter_range = 2; // The name of the variable used for accumulation of the result. @@ -211,13 +234,13 @@ message Expr { // The initial value of the accumulator. Expr accu_init = 4; - // An expression which can contain iter_var and accu_var. + // An expression which can contain iter_var, iter_var2, and accu_var. // // Returns false when the result has been computed and may be used as // a hint to short-circuit the remainder of the comprehension. Expr loop_condition = 5; - // An expression which can contain iter_var and accu_var. + // An expression which can contain iter_var, iter_var2, and accu_var. // // Computes the next value of accu_var. Expr loop_step = 6; diff --git a/src/main/proto/google/api/annotations.proto b/src/main/proto/google/api/annotations.proto index efdab3d..84c4816 100644 --- a/src/main/proto/google/api/annotations.proto +++ b/src/main/proto/google/api/annotations.proto @@ -1,4 +1,4 @@ -// Copyright 2015 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/main/proto/google/api/expr/v1alpha1/checked.proto b/src/main/proto/google/api/expr/v1alpha1/checked.proto index 930dc4f..c684934 100644 --- a/src/main/proto/google/api/expr/v1alpha1/checked.proto +++ b/src/main/proto/google/api/expr/v1alpha1/checked.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/main/proto/google/api/expr/v1alpha1/syntax.proto b/src/main/proto/google/api/expr/v1alpha1/syntax.proto index 8219ba6..7b6668d 100644 --- a/src/main/proto/google/api/expr/v1alpha1/syntax.proto +++ b/src/main/proto/google/api/expr/v1alpha1/syntax.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -44,21 +44,24 @@ message ParsedExpr { // operators with the exception of the '.' operator are modelled as function // calls. This makes it easy to represent new operators into the existing AST. // -// All references within expressions must resolve to a [Decl][google.api.expr.v1alpha1.Decl] provided at -// type-check for an expression to be valid. A reference may either be a bare -// identifier `name` or a qualified identifier `google.api.name`. References -// may either refer to a value or a function declaration. +// All references within expressions must resolve to a +// [Decl][google.api.expr.v1alpha1.Decl] provided at type-check for an +// expression to be valid. A reference may either be a bare identifier `name` or +// a qualified identifier `google.api.name`. References may either refer to a +// value or a function declaration. // // For example, the expression `google.api.name.startsWith('expr')` references -// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and -// the function declaration `startsWith`. +// the declaration `google.api.name` within a +// [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and the +// function declaration `startsWith`. message Expr { // An identifier expression. e.g. `request`. message Ident { // Required. Holds a single, unqualified identifier, possibly preceded by a // '.'. // - // Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. + // Qualified names are represented by the + // [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. string name = 1; } @@ -181,11 +184,49 @@ message Expr { // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the // macro tests whether the property is set to its default. For map and struct // types, the macro tests whether the property `x` is defined on `m`. + // + // Comprehensions for the standard environment macros evaluation can be best + // visualized as the following pseudocode: + // + // ``` + // let `accu_var` = `accu_init` + // for (let `iter_var` in `iter_range`) { + // if (!`loop_condition`) { + // break + // } + // `accu_var` = `loop_step` + // } + // return `result` + // ``` + // + // Comprehensions for the optional V2 macros which support map-to-map + // translation differ slightly from the standard environment macros in that + // they expose both the key or index in addition to the value for each list + // or map entry: + // + // ``` + // let `accu_var` = `accu_init` + // for (let `iter_var`, `iter_var2` in `iter_range`) { + // if (!`loop_condition`) { + // break + // } + // `accu_var` = `loop_step` + // } + // return `result` + // ``` message Comprehension { - // The name of the iteration variable. + // The name of the first iteration variable. + // When the iter_range is a list, this variable is the list element. + // When the iter_range is a map, this variable is the map entry key. string iter_var = 1; - // The range over which var iterates. + // The name of the second iteration variable, empty if not set. + // When the iter_range is a list, this variable is the integer index. + // When the iter_range is a map, this variable is the map entry value. + // This field is only set for comprehension v2 macros. + string iter_var2 = 8; + + // The range over which the comprehension iterates. Expr iter_range = 2; // The name of the variable used for accumulation of the result. @@ -194,13 +235,13 @@ message Expr { // The initial value of the accumulator. Expr accu_init = 4; - // An expression which can contain iter_var and accu_var. + // An expression which can contain iter_var, iter_var2, and accu_var. // // Returns false when the result has been computed and may be used as // a hint to short-circuit the remainder of the comprehension. Expr loop_condition = 5; - // An expression which can contain iter_var and accu_var. + // An expression which can contain iter_var, iter_var2, and accu_var. // // Computes the next value of accu_var. Expr loop_step = 6; @@ -250,7 +291,8 @@ message Expr { // primitives. // // Lists and structs are not included as constants as these aggregate types may -// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require evaluation and are thus not constant. +// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require +// evaluation and are thus not constant. // // Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`, // `true`, `null`. @@ -292,6 +334,50 @@ message Constant { // Source information collected at parse time. message SourceInfo { + // An extension that was requested for the source expression. + message Extension { + // Version + message Version { + // Major version changes indicate different required support level from + // the required components. + int64 major = 1; + + // Minor version changes must not change the observed behavior from + // existing implementations, but may be provided informationally. + int64 minor = 2; + } + + // CEL component specifier. + enum Component { + // Unspecified, default. + COMPONENT_UNSPECIFIED = 0; + + // Parser. Converts a CEL string to an AST. + COMPONENT_PARSER = 1; + + // Type checker. Checks that references in an AST are defined and types + // agree. + COMPONENT_TYPE_CHECKER = 2; + + // Runtime. Evaluates a parsed and optionally checked CEL AST against a + // context. + COMPONENT_RUNTIME = 3; + } + + // Identifier for the extension. Example: constant_folding + string id = 1; + + // If set, the listed components must understand the extension for the + // expression to evaluate correctly. + // + // This field has set semantics, repeated values should be deduplicated. + repeated Component affected_components = 2; + + // Version info. May be skipped if it isn't meaningful for the extension. + // (for example constant_folding might always be v0.0). + Version version = 3; + } + // The syntax version of the source, e.g. `cel1`. string syntax_version = 1; @@ -323,6 +409,15 @@ message SourceInfo { // in the map corresponds to the expression id of the expanded macro, and the // value is the call `Expr` that was replaced. map macro_calls = 5; + + // A list of tags for extensions that were used while parsing or type checking + // the source expression. For example, optimizations that require special + // runtime support may be specified. + // + // These are used to check feature support between components in separate + // implementations. This can be used to either skip redundant work or + // report an error if the extension is unsupported. + repeated Extension extensions = 6; } // A specific position in source. diff --git a/src/main/proto/google/api/http.proto b/src/main/proto/google/api/http.proto index 113fa93..e327037 100644 --- a/src/main/proto/google/api/http.proto +++ b/src/main/proto/google/api/http.proto @@ -1,4 +1,4 @@ -// Copyright 2015 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ message Http { bool fully_decode_reserved_expansion = 2; } -// # gRPC Transcoding +// gRPC Transcoding // // gRPC Transcoding is a feature for mapping between a gRPC method and one or // more HTTP REST endpoints. It allows developers to build a single API service @@ -82,9 +82,8 @@ message Http { // // This enables an HTTP REST to gRPC mapping as below: // -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` +// - HTTP: `GET /v1/messages/123456` +// - gRPC: `GetMessage(name: "messages/123456")` // // Any fields in the request message which are not bound by the path template // automatically become HTTP query parameters if there is no HTTP request body. @@ -108,11 +107,9 @@ message Http { // // This enables a HTTP JSON to RPC mapping as below: // -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | -// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: -// "foo"))` +// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` +// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: +// SubMessage(subfield: "foo"))` // // Note that fields which are mapped to URL query parameters must have a // primitive type or a repeated primitive type or a non-repeated message type. @@ -142,10 +139,8 @@ message Http { // representation of the JSON in the request body is determined by // protos JSON encoding: // -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" message { text: "Hi!" })` +// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` // // The special name `*` can be used in the body mapping to define that // every field not bound by the path template should be mapped to the @@ -168,10 +163,8 @@ message Http { // // The following HTTP JSON to RPC mapping is enabled: // -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" text: "Hi!")` +// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` +// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` // // Note that when using `*` in the body mapping, it is not possible to // have HTTP parameters, as all fields not bound by the path end in @@ -199,29 +192,32 @@ message Http { // // This enables the following two alternative HTTP JSON to RPC mappings: // -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: -// "123456")` +// - HTTP: `GET /v1/messages/123456` +// - gRPC: `GetMessage(message_id: "123456")` // -// ## Rules for HTTP mapping +// - HTTP: `GET /v1/users/me/messages/123456` +// - gRPC: `GetMessage(user_id: "me" message_id: "123456")` +// +// Rules for HTTP mapping // // 1. Leaf request fields (recursive expansion nested messages in the request // message) are classified into three categories: // - Fields referred by the path template. They are passed via the URL path. -// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP +// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They +// are passed via the HTTP // request body. // - All other fields are passed via the URL query parameters, and the // parameter name is the field path in the request message. A repeated // field can be represented as multiple query parameters under the same // name. -// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields +// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL +// query parameter, all fields // are passed via URL path and HTTP request body. -// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all +// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP +// request body, all // fields are passed via URL path and URL query parameters. // -// ### Path template syntax +// Path template syntax // // Template = "/" Segments [ Verb ] ; // Segments = Segment { "/" Segment } ; @@ -260,7 +256,7 @@ message Http { // Document](https://developers.google.com/discovery/v1/reference/apis) as // `{+var}`. // -// ## Using gRPC API Service Configuration +// Using gRPC API Service Configuration // // gRPC API Service Configuration (service config) is a configuration language // for configuring a gRPC service to become a user-facing product. The @@ -275,15 +271,14 @@ message Http { // specified in the service config will override any matching transcoding // configuration in the proto. // -// Example: +// The following example selects a gRPC method and applies an `HttpRule` to it: // // http: // rules: -// # Selects a gRPC method and applies HttpRule to it. // - selector: example.v1.Messaging.GetMessage // get: /v1/messages/{message_id}/{sub.subfield} // -// ## Special notes +// Special notes // // When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the // proto to JSON conversion must follow the [proto3 @@ -313,7 +308,8 @@ message Http { message HttpRule { // Selects a method to which this rule applies. // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + // Refer to [selector][google.api.DocumentationRule.selector] for syntax + // details. string selector = 1; // Determines the URL pattern is matched by this rules. This pattern can be diff --git a/src/main/proto/google/rpc/status.proto b/src/main/proto/google/rpc/status.proto index 923e169..90b70dd 100644 --- a/src/main/proto/google/rpc/status.proto +++ b/src/main/proto/google/rpc/status.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/src/main/proto/opencensus/proto/agent/common/v1/common.proto b/src/main/proto/opencensus/proto/agent/common/v1/common.proto deleted file mode 100644 index 2bfc274..0000000 --- a/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/src/main/proto/opencensus/proto/agent/metrics/v1/metrics_service.proto b/src/main/proto/opencensus/proto/agent/metrics/v1/metrics_service.proto deleted file mode 100644 index 13d9171..0000000 --- a/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/src/main/proto/opencensus/proto/agent/trace/v1/trace_service.proto b/src/main/proto/opencensus/proto/agent/trace/v1/trace_service.proto deleted file mode 100644 index 8792940..0000000 --- a/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/src/main/proto/opencensus/proto/metrics/v1/metrics.proto b/src/main/proto/opencensus/proto/metrics/v1/metrics.proto deleted file mode 100644 index 88f2261..0000000 --- a/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/src/main/proto/opencensus/proto/resource/v1/resource.proto b/src/main/proto/opencensus/proto/resource/v1/resource.proto deleted file mode 100644 index 9ce4f39..0000000 --- a/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/src/main/proto/opencensus/proto/stats/v1/stats.proto b/src/main/proto/opencensus/proto/stats/v1/stats.proto deleted file mode 100644 index ae92457..0000000 --- a/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/src/main/proto/opencensus/proto/trace/v1/trace.proto b/src/main/proto/opencensus/proto/trace/v1/trace.proto deleted file mode 100644 index 96d706a..0000000 --- a/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/src/main/proto/opencensus/proto/trace/v1/trace_config.proto b/src/main/proto/opencensus/proto/trace/v1/trace_config.proto deleted file mode 100644 index 037247d..0000000 --- a/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/src/main/proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service.proto b/src/main/proto/opentelemetry/proto/collector/profiles/v1development/profiles_service.proto similarity index 91% rename from src/main/proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service.proto rename to src/main/proto/opentelemetry/proto/collector/profiles/v1development/profiles_service.proto index d0e7894..ab2433e 100644 --- a/src/main/proto/opentelemetry/proto/collector/profiles/v1experimental/profiles_service.proto +++ b/src/main/proto/opentelemetry/proto/collector/profiles/v1development/profiles_service.proto @@ -14,15 +14,15 @@ syntax = "proto3"; -package opentelemetry.proto.collector.profiles.v1experimental; +package opentelemetry.proto.collector.profiles.v1development; -import "opentelemetry/proto/profiles/v1experimental/profiles.proto"; +import "opentelemetry/proto/profiles/v1development/profiles.proto"; -option csharp_namespace = "OpenTelemetry.Proto.Collector.Profiles.V1Experimental"; +option csharp_namespace = "OpenTelemetry.Proto.Collector.Profiles.V1Development"; option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.collector.profiles.v1experimental"; +option java_package = "io.opentelemetry.proto.collector.profiles.v1development"; option java_outer_classname = "ProfilesServiceProto"; -option go_package = "go.opentelemetry.io/proto/otlp/collector/profiles/v1experimental"; +option go_package = "go.opentelemetry.io/proto/otlp/collector/profiles/v1development"; // Service that can be used to push profiles between one Application instrumented with // OpenTelemetry and a collector, or between a collector and a central collector. @@ -38,7 +38,7 @@ message ExportProfilesServiceRequest { // element. Intermediary nodes (such as OpenTelemetry Collector) that receive // data from multiple origins typically batch the data before forwarding further and // in that case this array will contain multiple elements. - repeated opentelemetry.proto.profiles.v1experimental.ResourceProfiles resource_profiles = 1; + repeated opentelemetry.proto.profiles.v1development.ResourceProfiles resource_profiles = 1; } message ExportProfilesServiceResponse { diff --git a/src/main/proto/opentelemetry/proto/logs/v1/logs.proto b/src/main/proto/opentelemetry/proto/logs/v1/logs.proto index f9b97dd..261d229 100644 --- a/src/main/proto/opentelemetry/proto/logs/v1/logs.proto +++ b/src/main/proto/opentelemetry/proto/logs/v1/logs.proto @@ -56,7 +56,8 @@ message ResourceLogs { repeated ScopeLogs scope_logs = 2; // The Schema URL, if known. This is the identifier of the Schema that the resource data - // is recorded in. To learn more about Schema URL see + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to the data in the "resource" field. It does not apply // to the data in the "scope_logs" field which have their own schema_url field. @@ -74,7 +75,8 @@ message ScopeLogs { repeated LogRecord log_records = 2; // The Schema URL, if known. This is the identifier of the Schema that the log data - // is recorded in. To learn more about Schema URL see + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to all logs in the "logs" field. string schema_url = 3; @@ -208,4 +210,18 @@ message LogRecord { // - the field is not present, // - the field contains an invalid value. bytes span_id = 10; + + // A unique identifier of event category/type. + // All events with the same event_name are expected to conform to the same + // schema for both their attributes and their body. + // + // Recommended to be fully qualified and short (no longer than 256 characters). + // + // Presence of event_name on the log record identifies this record + // as an event. + // + // [Optional]. + // + // Status: [Development] + string event_name = 12; } diff --git a/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto b/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto index 19bb7ff..00c5112 100644 --- a/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto +++ b/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto @@ -29,6 +29,24 @@ option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1"; // storage, OR can be embedded by other protocols that transfer OTLP metrics // data but do not implement the OTLP protocol. // +// MetricsData +// └─── ResourceMetrics +// ├── Resource +// ├── SchemaURL +// └── ScopeMetrics +// ├── Scope +// ├── SchemaURL +// └── Metric +// ├── Name +// ├── Description +// ├── Unit +// └── data +// ├── Gauge +// ├── Sum +// ├── Histogram +// ├── ExponentialHistogram +// └── Summary +// // The main difference between this message and collector protocol is that // in this message there will not be any "control" or "metadata" specific to // OTLP protocol. @@ -56,7 +74,8 @@ message ResourceMetrics { repeated ScopeMetrics scope_metrics = 2; // The Schema URL, if known. This is the identifier of the Schema that the resource data - // is recorded in. To learn more about Schema URL see + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to the data in the "resource" field. It does not apply // to the data in the "scope_metrics" field which have their own schema_url field. @@ -74,7 +93,8 @@ message ScopeMetrics { repeated Metric metrics = 2; // The Schema URL, if known. This is the identifier of the Schema that the metric data - // is recorded in. To learn more about Schema URL see + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to all metrics in the "metrics" field. string schema_url = 3; @@ -85,7 +105,6 @@ message ScopeMetrics { // // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md // -// // The data model and relation between entities is shown in the // diagram below. Here, "DataPoint" is the term used to refer to any // one of the specific data point value types, and "points" is the term used @@ -97,7 +116,7 @@ message ScopeMetrics { // - DataPoint contains timestamps, attributes, and one of the possible value type // fields. // -// Metric +// Metric // +------------+ // |name | // |description | @@ -251,6 +270,9 @@ message ExponentialHistogram { // data type. These data points cannot always be merged in a meaningful way. // While they can be useful in some applications, histogram data points are // recommended for new applications. +// Summary metrics do not have an aggregation temporality field. This is +// because the count and sum fields of a SummaryDataPoint are assumed to be +// cumulative values. message Summary { repeated SummaryDataPoint data_points = 1; } @@ -430,7 +452,7 @@ message HistogramDataPoint { // events, and is assumed to be monotonic over the values of these events. // Negative events *can* be recorded, but sum should not be filled out when // doing so. This is specifically to enforce compatibility w/ OpenMetrics, - // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram + // see: https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#histogram optional double sum = 5; // bucket_counts is an optional field contains the count values of histogram @@ -509,7 +531,7 @@ message ExponentialHistogramDataPoint { // events, and is assumed to be monotonic over the values of these events. // Negative events *can* be recorded, but sum should not be filled out when // doing so. This is specifically to enforce compatibility w/ OpenMetrics, - // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram + // see: https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#histogram optional double sum = 5; // scale describes the resolution of the histogram. Boundaries are @@ -589,7 +611,8 @@ message ExponentialHistogramDataPoint { } // SummaryDataPoint is a single data point in a timeseries that describes the -// time-varying values of a Summary metric. +// time-varying values of a Summary metric. The count and sum fields represent +// cumulative values. message SummaryDataPoint { reserved 1; @@ -622,7 +645,7 @@ message SummaryDataPoint { // events, and is assumed to be monotonic over the values of these events. // Negative events *can* be recorded, but sum should not be filled out when // doing so. This is specifically to enforce compatibility w/ OpenMetrics, - // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary + // see: https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#summary double sum = 5; // Represents the value at a given quantile of a distribution. diff --git a/src/main/proto/opentelemetry/proto/profiles/v1experimental/pprofextended.proto b/src/main/proto/opentelemetry/proto/profiles/v1development/profiles.proto similarity index 54% rename from src/main/proto/opentelemetry/proto/profiles/v1experimental/pprofextended.proto rename to src/main/proto/opentelemetry/proto/profiles/v1development/profiles.proto index bd30083..1cb20b0 100644 --- a/src/main/proto/opentelemetry/proto/profiles/v1experimental/pprofextended.proto +++ b/src/main/proto/opentelemetry/proto/profiles/v1development/profiles.proto @@ -28,6 +28,126 @@ // See the License for the specific language governing permissions and // limitations under the License. +syntax = "proto3"; + +package opentelemetry.proto.profiles.v1development; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Development"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.profiles.v1development"; +option java_outer_classname = "ProfilesProto"; +option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1development"; + +// Relationships Diagram +// +// ┌──────────────────┐ LEGEND +// │ ProfilesData │ +// └──────────────────┘ ─────▶ embedded +// │ +// │ 1-n ─────▷ referenced by index +// ▼ +// ┌──────────────────┐ +// │ ResourceProfiles │ +// └──────────────────┘ +// │ +// │ 1-n +// ▼ +// ┌──────────────────┐ +// │ ScopeProfiles │ +// └──────────────────┘ +// │ +// │ 1-1 +// ▼ +// ┌──────────────────┐ +// │ Profile │ +// └──────────────────┘ +// │ n-1 +// │ 1-n ┌───────────────────────────────────────┐ +// ▼ │ ▽ +// ┌──────────────────┐ 1-n ┌──────────────┐ ┌──────────┐ +// │ Sample │ ──────▷ │ KeyValue │ │ Link │ +// └──────────────────┘ └──────────────┘ └──────────┘ +// │ 1-n △ △ +// │ 1-n ┌─────────────────┘ │ 1-n +// ▽ │ │ +// ┌──────────────────┐ n-1 ┌──────────────┐ +// │ Location │ ──────▷ │ Mapping │ +// └──────────────────┘ └──────────────┘ +// │ +// │ 1-n +// ▼ +// ┌──────────────────┐ +// │ Line │ +// └──────────────────┘ +// │ +// │ 1-1 +// ▽ +// ┌──────────────────┐ +// │ Function │ +// └──────────────────┘ +// + +// ProfilesData represents the profiles data that can be stored in persistent storage, +// OR can be embedded by other protocols that transfer OTLP profiles data but do not +// implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +message ProfilesData { + // An array of ResourceProfiles. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + repeated ResourceProfiles resource_profiles = 1; +} + + +// A collection of ScopeProfiles from a Resource. +message ResourceProfiles { + reserved 1000; + + // The resource for the profiles in this message. + // If this field is not set then no resource info is known. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of ScopeProfiles that originate from a resource. + repeated ScopeProfiles scope_profiles = 2; + + // The Schema URL, if known. This is the identifier of the Schema that the resource data + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_profiles" field which have their own schema_url field. + string schema_url = 3; +} + +// A collection of Profiles produced by an InstrumentationScope. +message ScopeProfiles { + // The instrumentation scope information for the profiles in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + + // A list of Profiles that originate from an instrumentation scope. + repeated Profile profiles = 2; + + // The Schema URL, if known. This is the identifier of the Schema that the profile data + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // This schema_url applies to all profiles in the "profiles" field. + string schema_url = 3; +} + // Profile is a common stacktrace profile format. // // Measurements represented with this format should follow the @@ -52,18 +172,15 @@ // mappings. For every nonzero Location.mapping_id there must be a // unique Mapping with that index. -syntax = "proto3"; - -package opentelemetry.proto.profiles.v1experimental; - -import "opentelemetry/proto/common/v1/common.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Experimental"; -option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1experimental"; - // Represents a complete profile, including sample types, samples, // mappings to binaries, locations, functions, string table, and additional metadata. +// It modifies and annotates pprof Profile with OpenTelemetry specific fields. +// +// Note that whilst fields in this message retain the name and field id from pprof in most cases +// for ease of understanding data migration, it is not intended that pprof:Profile and +// OpenTelemetry:Profile encoding be wire compatible. message Profile { + // A description of the samples associated with each Sample.value. // For a cpu profile this might be: // [["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]] @@ -77,58 +194,92 @@ message Profile { repeated Sample sample = 2; // Mapping from address ranges to the image/binary/library mapped // into that address range. mapping[0] will be the main binary. - repeated Mapping mapping = 3; + // If multiple binaries contribute to the Profile and no main + // binary can be identified, mapping[0] has no special meaning. + repeated Mapping mapping_table = 3; // Locations referenced by samples via location_indices. - repeated Location location = 4; + repeated Location location_table = 4; // Array of locations referenced by samples. - repeated int64 location_indices = 15; + repeated int32 location_indices = 5; // Functions referenced by locations. - repeated Function function = 5; + repeated Function function_table = 6; // Lookup table for attributes. - repeated opentelemetry.proto.common.v1.KeyValue attribute_table = 16; + repeated opentelemetry.proto.common.v1.KeyValue attribute_table = 7; // Represents a mapping between Attribute Keys and Units. - repeated AttributeUnit attribute_units = 17; + repeated AttributeUnit attribute_units = 8; // Lookup table for links. - repeated Link link_table = 18; + repeated Link link_table = 9; // A common table for strings referenced by various messages. // string_table[0] must always be "". - repeated string string_table = 6; - // frames with Function.function_name fully matching the following - // regexp will be dropped from the samples, along with their successors. - int64 drop_frames = 7; // Index into string table. - // frames with Function.function_name fully matching the following - // regexp will be kept, even if it matches drop_frames. - int64 keep_frames = 8; // Index into string table. - - // The following fields are informational, do not affect + repeated string string_table = 10; + + // The following fields 9-14 are informational, do not affect // interpretation of results. // Time of collection (UTC) represented as nanoseconds past the epoch. - int64 time_nanos = 9; + int64 time_nanos = 11; // Duration of the profile, if a duration makes sense. - int64 duration_nanos = 10; + int64 duration_nanos = 12; // The kind of events between sampled occurrences. // e.g [ "cpu","cycles" ] or [ "heap","bytes" ] - ValueType period_type = 11; + ValueType period_type = 13; // The number of events between sampled occurrences. - int64 period = 12; + int64 period = 14; // Free-form text associated with the profile. The text is displayed as is // to the user by the tools that read profiles (e.g. by pprof). This field // should not be used to store any machine-readable information, it is only // for human-friendly content. The profile must stay functional if this field // is cleaned. - repeated int64 comment = 13; // Indices into string table. + repeated int32 comment_strindices = 15; // Indices into string table. // Index into the string table of the type of the preferred sample // value. If unset, clients should default to the last sample value. - int64 default_sample_type = 14; + int32 default_sample_type_strindex = 16; + + + // A globally unique identifier for a profile. The ID is a 16-byte array. An ID with + // all zeroes is considered invalid. + // + // This field is required. + bytes profile_id = 17; + + // dropped_attributes_count is 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. + uint32 dropped_attributes_count = 19; + + // Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present] + string original_payload_format = 20; + + // Original payload can be stored in this field. This can be useful for users who want to get the original payload. + // Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. + // Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. + // If the original payload is in pprof format, it SHOULD not be included in this field. + // The field is optional, however if it is present then equivalent converted data should be populated in other fields + // of this message as far as is practicable. + bytes original_payload = 21; + + // References to attributes in attribute_table. [optional] + // It is a collection of key/value pairs. Note, global attributes + // like server name can be set using the 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 + // + // The OpenTelemetry API specification further restricts the allowed value types: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated int32 attribute_indices = 22; } // Represents a mapping between Attribute Keys and Units. message AttributeUnit { // Index into string table. - int64 attribute_key = 1; + int32 attribute_key_strindex = 1; // Index into string table. - int64 unit = 2; + int32 unit_strindex = 2; } // A pointer from a profile Sample to a trace Span. @@ -203,7 +354,7 @@ enum AggregationTemporality { 11. A request is received, the system measures 1 request. 12. The 1 second collection cycle ends. A metric is exported for the number of requests received over the interval of time t_1 to - t_0+1 with a value of 1. + t_1+1 with a value of 1. Note: Even though, when reporting changes since last report time, using CUMULATIVE is valid, it is not recommended. */ @@ -212,8 +363,8 @@ enum AggregationTemporality { // ValueType describes the type and units of a value, with an optional aggregation temporality. message ValueType { - int64 type = 1; // Index into string table. - int64 unit = 2; // Index into string table. + int32 type_strindex = 1; // Index into string table. + int32 unit_strindex = 2; // Index into string table. AggregationTemporality aggregation_temporality = 3; } @@ -223,120 +374,63 @@ message ValueType { // augmented with auxiliary information like the thread-id, some // indicator of a higher level request being handled etc. message Sample { - // The indices recorded here correspond to locations in Profile.location. - // The leaf is at location_index[0]. [deprecated, superseded by locations_start_index / locations_length] - repeated uint64 location_index = 1; - // locations_start_index along with locations_length refers to to a slice of locations in Profile.location. + // locations_start_index along with locations_length refers to to a slice of locations in Profile.location_indices. + int32 locations_start_index = 1; + // locations_length along with locations_start_index refers to a slice of locations in Profile.location_indices. // Supersedes location_index. - uint64 locations_start_index = 7; - // locations_length along with locations_start_index refers to a slice of locations in Profile.location. - // Supersedes location_index. - uint64 locations_length = 8; - // A 128bit id that uniquely identifies this stacktrace, globally. Index into string table. [optional] - uint32 stacktrace_id_index = 9; + int32 locations_length = 2; // The type and unit of each value is defined by the corresponding // entry in Profile.sample_type. All samples must have the same // number of values, the same as the length of Profile.sample_type. // When aggregating multiple samples into a single sample, the // result has a list of values that is the element-wise sum of the // lists of the originals. - repeated int64 value = 2; - // label includes additional context for this sample. It can include - // things like a thread id, allocation size, etc. - // - // NOTE: While possible, having multiple values for the same label key is - // strongly discouraged and should never be used. Most tools (e.g. pprof) do - // not have good (or any) support for multi-value labels. And an even more - // discouraged case is having a string label and a numeric label of the same - // name on a sample. Again, possible to express, but should not be used. - // [deprecated, superseded by attributes] - repeated Label label = 3; + repeated int64 value = 3; // References to attributes in Profile.attribute_table. [optional] - repeated uint64 attributes = 10; + repeated int32 attribute_indices = 4; // Reference to link in Profile.link_table. [optional] - uint64 link = 12; + optional int32 link_index = 5; // Timestamps associated with Sample represented in nanoseconds. These timestamps are expected // to fall within the Profile's time range. [optional] - repeated uint64 timestamps_unix_nano = 13; -} - -// Provides additional context for a sample, -// such as thread ID or allocation size, with optional units. [deprecated] -message Label { - int64 key = 1; // Index into string table - - // At most one of the following must be present - int64 str = 2; // Index into string table - int64 num = 3; - - // Should only be present when num is present. - // Specifies the units of num. - // Use arbitrary string (for example, "requests") as a custom count unit. - // If no unit is specified, consumer may apply heuristic to deduce the unit. - // Consumers may also interpret units like "bytes" and "kilobytes" as memory - // units and units like "seconds" and "nanoseconds" as time units, - // and apply appropriate unit conversions to these. - int64 num_unit = 4; // Index into string table -} - -// Indicates the semantics of the build_id field. -enum BuildIdKind { - // Linker-generated build ID, stored in the ELF binary notes. - BUILD_ID_LINKER = 0; - // Build ID based on the content hash of the binary. Currently no particular - // hashing approach is standardized, so a given producer needs to define it - // themselves and thus unlike BUILD_ID_LINKER this kind of hash is producer-specific. - // We may choose to provide a standardized stable hash recommendation later. - BUILD_ID_BINARY_HASH = 1; + repeated uint64 timestamps_unix_nano = 6; } // Describes the mapping of a binary in memory, including its address range, // file offset, and metadata like build ID message Mapping { - // Unique nonzero id for the mapping. [deprecated] - uint64 id = 1; // Address at which the binary (or DLL) is loaded into memory. - uint64 memory_start = 2; + uint64 memory_start = 1; // The limit of the address range occupied by this mapping. - uint64 memory_limit = 3; + uint64 memory_limit = 2; // Offset in the binary that corresponds to the first mapped address. - uint64 file_offset = 4; + uint64 file_offset = 3; // The object this entry is loaded from. This can be a filename on // disk for the main binary and shared libraries, or virtual // abstractions like "[vdso]". - int64 filename = 5; // Index into string table - // A string that uniquely identifies a particular program version - // with high probability. E.g., for binaries generated by GNU tools, - // it could be the contents of the .note.gnu.build-id field. - int64 build_id = 6; // Index into string table - // Specifies the kind of build id. See BuildIdKind enum for more details [optional] - BuildIdKind build_id_kind = 11; + int32 filename_strindex = 4; // Index into string table // References to attributes in Profile.attribute_table. [optional] - repeated uint64 attributes = 12; + repeated int32 attribute_indices = 5; // The following fields indicate the resolution of symbolic info. - bool has_functions = 7; - bool has_filenames = 8; - bool has_line_numbers = 9; - bool has_inline_frames = 10; + bool has_functions = 6; + bool has_filenames = 7; + bool has_line_numbers = 8; + bool has_inline_frames = 9; } // Describes function and line table debug information. message Location { - // Unique nonzero id for the location. A profile could use - // instruction addresses or any integer sequence as ids. [deprecated] - uint64 id = 1; - // The index of the corresponding profile.Mapping for this location. + // Reference to mapping in Profile.mapping_table. // It can be unset if the mapping is unknown or not applicable for // this profile type. - uint64 mapping_index = 2; + optional int32 mapping_index = 1; // The instruction address for this location, if available. It // should be within [Mapping.memory_start...Mapping.memory_limit] // for the corresponding mapping. A non-leaf address may be in the // middle of a call instruction. It is up to display tools to find // the beginning of the instruction if necessary. - uint64 address = 3; + uint64 address = 2; // Multiple line indicates this location has inlined functions, // where the last entry represents the caller into which the // preceding entries were inlined. @@ -344,25 +438,22 @@ message Location { // E.g., if memcpy() is inlined into printf: // line[0].function_name == "memcpy" // line[1].function_name == "printf" - repeated Line line = 4; + repeated Line line = 3; // Provides an indication that multiple symbols map to this location's // address, for example due to identical code folding by the linker. In that // case the line information above represents one of the multiple // symbols. This field must be recomputed when the symbolization state of the // profile changes. - bool is_folded = 5; - - // Type of frame (e.g. kernel, native, python, hotspot, php). Index into string table. - uint32 type_index = 6; + bool is_folded = 4; // References to attributes in Profile.attribute_table. [optional] - repeated uint64 attributes = 7; + repeated int32 attribute_indices = 5; } // Details a specific line in a source code, linked to a function. message Line { - // The index of the corresponding profile.Function for this line. - uint64 function_index = 1; + // Reference to function in Profile.function_table. + int32 function_index = 1; // Line number in source code. int64 line = 2; // Column number in source code. @@ -372,15 +463,13 @@ message Line { // Describes a function, including its human-readable name, system name, // source file, and starting line number in the source. message Function { - // Unique nonzero id for the function. [deprecated] - uint64 id = 1; // Name of the function, in human-readable form if available. - int64 name = 2; // Index into string table + int32 name_strindex = 1; // Index into string table // Name of the function, as identified by the system. // For instance, it can be a C++ mangled name. - int64 system_name = 3; // Index into string table + int32 system_name_strindex = 2; // Index into string table // Source file containing the function. - int64 filename = 4; // Index into string table + int32 filename_strindex = 3; // Index into string table // Line number in source file. - int64 start_line = 5; + int64 start_line = 4; } diff --git a/src/main/proto/opentelemetry/proto/profiles/v1experimental/profiles.proto b/src/main/proto/opentelemetry/proto/profiles/v1experimental/profiles.proto deleted file mode 100644 index bbc2b29..0000000 --- a/src/main/proto/opentelemetry/proto/profiles/v1experimental/profiles.proto +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2023, OpenTelemetry 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 opentelemetry.proto.profiles.v1experimental; - -import "opentelemetry/proto/common/v1/common.proto"; -import "opentelemetry/proto/resource/v1/resource.proto"; -import "opentelemetry/proto/profiles/v1experimental/pprofextended.proto"; - -option csharp_namespace = "OpenTelemetry.Proto.Profiles.V1Experimental"; -option java_multiple_files = true; -option java_package = "io.opentelemetry.proto.profiles.v1experimental"; -option java_outer_classname = "ProfilesProto"; -option go_package = "go.opentelemetry.io/proto/otlp/profiles/v1experimental"; - -// Relationships Diagram -// -// ┌──────────────────┐ LEGEND -// │ ProfilesData │ -// └──────────────────┘ ─────▶ embedded -// │ -// │ 1-n ─────▷ referenced by index -// ▼ -// ┌──────────────────┐ -// │ ResourceProfiles │ -// └──────────────────┘ -// │ -// │ 1-n -// ▼ -// ┌──────────────────┐ -// │ ScopeProfiles │ -// └──────────────────┘ -// │ -// │ 1-n -// ▼ -// ┌──────────────────┐ -// │ ProfileContainer │ -// └──────────────────┘ -// │ -// │ 1-1 -// ▼ -// ┌──────────────────┐ -// │ Profile │ -// └──────────────────┘ -// │ 1-n -// │ 1-n ┌───────────────────────────────────────┐ -// ▼ │ ▽ -// ┌──────────────────┐ 1-n ┌──────────────┐ ┌──────────┐ -// │ Sample │ ──────▷ │ KeyValue │ │ Link │ -// └──────────────────┘ └──────────────┘ └──────────┘ -// │ 1-n △ △ -// │ 1-n ┌─────────────────┘ │ 1-n -// ▽ │ │ -// ┌──────────────────┐ n-1 ┌──────────────┐ -// │ Location │ ──────▷ │ Mapping │ -// └──────────────────┘ └──────────────┘ -// │ -// │ 1-n -// ▼ -// ┌──────────────────┐ -// │ Line │ -// └──────────────────┘ -// │ -// │ 1-1 -// ▽ -// ┌──────────────────┐ -// │ Function │ -// └──────────────────┘ -// - -// ProfilesData represents the profiles data that can be stored in persistent storage, -// OR can be embedded by other protocols that transfer OTLP profiles data but do not -// implement the OTLP protocol. -// -// The main difference between this message and collector protocol is that -// in this message there will not be any "control" or "metadata" specific to -// OTLP protocol. -// -// When new fields are added into this message, the OTLP request MUST be updated -// as well. -message ProfilesData { - // An array of ResourceProfiles. - // For data coming from a single resource this array will typically contain - // one element. Intermediary nodes that receive data from multiple origins - // typically batch the data before forwarding further and in that case this - // array will contain multiple elements. - repeated ResourceProfiles resource_profiles = 1; -} - - -// A collection of ScopeProfiles from a Resource. -message ResourceProfiles { - reserved 1000; - - // The resource for the profiles in this message. - // If this field is not set then no resource info is known. - opentelemetry.proto.resource.v1.Resource resource = 1; - - // A list of ScopeProfiles that originate from a resource. - repeated ScopeProfiles scope_profiles = 2; - - // The Schema URL, if known. This is the identifier of the Schema that the resource data - // is recorded in. To learn more about Schema URL see - // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - // This schema_url applies to the data in the "resource" field. It does not apply - // to the data in the "scope_profiles" field which have their own schema_url field. - string schema_url = 3; -} - -// A collection of ProfileContainers produced by an InstrumentationScope. -message ScopeProfiles { - // The instrumentation scope information for the profiles in this message. - // Semantically when InstrumentationScope isn't set, it is equivalent with - // an empty instrumentation scope name (unknown). - opentelemetry.proto.common.v1.InstrumentationScope scope = 1; - - // A list of ProfileContainers that originate from an instrumentation scope. - repeated ProfileContainer profiles = 2; - - // The Schema URL, if known. This is the identifier of the Schema that the metric data - // is recorded in. To learn more about Schema URL see - // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - // This schema_url applies to all profiles in the "profiles" field. - string schema_url = 3; -} - -// A ProfileContainer represents a single profile. It wraps pprof profile with OpenTelemetry specific metadata. -message ProfileContainer { - // A globally unique identifier for a profile. The ID is a 16-byte array. An ID with - // all zeroes is considered invalid. - // - // This field is required. - bytes profile_id = 1; - - // start_time_unix_nano is the start time of the profile. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - fixed64 start_time_unix_nano = 2; - - // end_time_unix_nano is the end time of the profile. - // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. - // - // This field is semantically required and it is expected that end_time >= start_time. - fixed64 end_time_unix_nano = 3; - - // attributes is a collection of key/value pairs. Note, global attributes - // like server name can be set using the 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 - // - // The OpenTelemetry API specification further restricts the allowed value types: - // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute - // Attribute keys MUST be unique (it is not allowed to have more than one - // attribute with the same key). - repeated opentelemetry.proto.common.v1.KeyValue attributes = 4; - - // dropped_attributes_count is 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. - uint32 dropped_attributes_count = 5; - - // Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present] - string original_payload_format = 6; - - // Original payload can be stored in this field. This can be useful for users who want to get the original payload. - // Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. - // Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. - // If the original payload is in pprof format, it SHOULD not be included in this field. - // The field is optional, however if it is present `profile` MUST be present and contain the same profiling information. - bytes original_payload = 7; - - // This is a reference to a pprof profile. Required, even when original_payload is present. - opentelemetry.proto.profiles.v1experimental.Profile profile = 8; -} diff --git a/src/main/proto/opentelemetry/proto/trace/v1/trace.proto b/src/main/proto/opentelemetry/proto/trace/v1/trace.proto index 5cb2f3c..2444285 100644 --- a/src/main/proto/opentelemetry/proto/trace/v1/trace.proto +++ b/src/main/proto/opentelemetry/proto/trace/v1/trace.proto @@ -56,7 +56,8 @@ message ResourceSpans { repeated ScopeSpans scope_spans = 2; // The Schema URL, if known. This is the identifier of the Schema that the resource data - // is recorded in. To learn more about Schema URL see + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to the data in the "resource" field. It does not apply // to the data in the "scope_spans" field which have their own schema_url field. @@ -74,7 +75,8 @@ message ScopeSpans { repeated Span spans = 2; // The Schema URL, if known. This is the identifier of the Schema that the span data - // is recorded in. To learn more about Schema URL see + // is recorded in. Notably, the last part of the URL path is the version number of the + // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url // This schema_url applies to all spans and span events in the "spans" field. string schema_url = 3; diff --git a/src/main/proto/xds/data/orca/v3/orca_load_report.proto b/src/main/proto/xds/data/orca/v3/orca_load_report.proto index 53da75f..1b08475 100644 --- a/src/main/proto/xds/data/orca/v3/orca_load_report.proto +++ b/src/main/proto/xds/data/orca/v3/orca_load_report.proto @@ -10,7 +10,7 @@ option go_package = "github.com/cncf/xds/go/xds/data/orca/v3"; import "validate/validate.proto"; // See section `ORCA load report format` of the design document in -// :ref:`https://github.com/envoyproxy/envoy/issues/6614`. +// https://github.com/envoyproxy/envoy/issues/6614. message OrcaLoadReport { // CPU utilization expressed as a fraction of available CPU resources. This diff --git a/src/main/proto/xds/type/matcher/v3/cel.proto b/src/main/proto/xds/type/matcher/v3/cel.proto index b1ad1fa..a9a4e01 100644 --- a/src/main/proto/xds/type/matcher/v3/cel.proto +++ b/src/main/proto/xds/type/matcher/v3/cel.proto @@ -2,9 +2,7 @@ syntax = "proto3"; package xds.type.matcher.v3; -import "xds/annotations/v3/status.proto"; import "xds/type/v3/cel.proto"; - import "validate/validate.proto"; option java_package = "com.github.xds.type.matcher.v3"; @@ -12,8 +10,6 @@ option java_outer_classname = "CelProto"; option java_multiple_files = true; option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; -option (xds.annotations.v3.file_status).work_in_progress = true; - // [#protodoc-title: Common Expression Language (CEL) matchers] // Performs a match by evaluating a `Common Expression Language @@ -30,8 +26,7 @@ option (xds.annotations.v3.file_status).work_in_progress = true; // Refer to :ref:`Unified Matcher API ` documentation // for usage details. // -// [#comment:TODO(sergiitk): Link HttpAttributesMatchInput + usage example.] -// [#comment:TODO(sergiitk): When implemented, add the extension tag.] +// [#comment: envoy.matching.matchers.cel_matcher] message CelMatcher { // Either parsed or checked representation of the CEL program. type.v3.CelExpression expr_match = 1 [(validate.rules).message = {required: true}]; diff --git a/src/main/proto/xds/type/matcher/v3/http_inputs.proto b/src/main/proto/xds/type/matcher/v3/http_inputs.proto index 0dd80cd..5709d64 100644 --- a/src/main/proto/xds/type/matcher/v3/http_inputs.proto +++ b/src/main/proto/xds/type/matcher/v3/http_inputs.proto @@ -2,15 +2,11 @@ syntax = "proto3"; package xds.type.matcher.v3; -import "xds/annotations/v3/status.proto"; - option java_package = "com.github.xds.type.matcher.v3"; option java_outer_classname = "HttpInputsProto"; option java_multiple_files = true; option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; -option (xds.annotations.v3.file_status).work_in_progress = true; - // [#protodoc-title: Common HTTP Inputs] // Specifies that matching should be performed on the set of :ref:`HTTP attributes @@ -22,6 +18,6 @@ option (xds.annotations.v3.file_status).work_in_progress = true; // Refer to :ref:`Unified Matcher API ` documentation // for usage details. // -// [#comment:TODO(sergiitk): When implemented, add the extension tag.] +// [#comment: envoy.matching.inputs.cel_data_input] message HttpAttributesCelMatchInput { } diff --git a/src/main/proto/xds/type/matcher/v3/matcher.proto b/src/main/proto/xds/type/matcher/v3/matcher.proto index 4966b45..da7c1f9 100644 --- a/src/main/proto/xds/type/matcher/v3/matcher.proto +++ b/src/main/proto/xds/type/matcher/v3/matcher.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package xds.type.matcher.v3; -import "xds/annotations/v3/status.proto"; import "xds/core/v3/extension.proto"; import "xds/type/matcher/v3/string.proto"; @@ -21,8 +20,6 @@ option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; // As an on_no_match might result in another matching tree being evaluated, this process // might repeat several times until the final OnMatch (or no match) is decided. message Matcher { - option (xds.annotations.v3.message_status).work_in_progress = true; - // What to do if a match is successful. message OnMatch { oneof on_match { diff --git a/tools/API_SHAS b/tools/API_SHAS index 5bf2776..3edf88d 100644 --- a/tools/API_SHAS +++ b/tools/API_SHAS @@ -1,10 +1,11 @@ # envoy (source: SHA from https://github.com/envoyproxy/envoy) -ENVOY_SHA="6fe1905459ff267a43a8a26d042ae03a8aa7bc98" +ENVOY_SHA="40ab4828a48f05103573ddee3c807dfa0e3e23f7" -# dependencies (source: https://github.com/envoyproxy/envoy/blob/6fe1905459ff267a43a8a26d042ae03a8aa7bc98/api/bazel/repository_locations.bzl) -GOOGLEAPIS_SHA="fd52b5754b2b268bc3a22a10f29844f206abb327" # 2025-08-04 -PGV_VERSION="1.0.4" # 2023-06-26 -PROMETHEUS_VERSION="0.6.1" # 2025-08-04 -OPENTELEMETRY_VERSION="1.5.0" # 2025-08-04 -XDS_SHA="b4127c9b8d78b77423fd25169f05b7476b6ea932" 2025-08-04 -CEL_VERSION="0.22.1" 2025-08-04 \ No newline at end of file +# dependencies (source: https://github.com/envoyproxy/envoy/blob/40ab4828a48f05103573ddee3c807dfa0e3e23f7/api/bazel/repository_locations.bzl) +GOOGLEAPIS_VERSION="fd52b5754b2b268bc3a22a10f29844f206abb327" +PGV_VERSION="1.0.4" +PROMETHEUS_VERSION="0.6.1" +OPENTELEMETRY_VERSION="1.5.0" +XDS_VERSION="b4127c9b8d78b77423fd25169f05b7476b6ea932" +CEL_VERSION="0.22.1" +OPENCENSUS_VERSION="" \ No newline at end of file diff --git a/tools/update-api.sh b/tools/update-api.sh index 92ca0fe..3c14706 100755 --- a/tools/update-api.sh +++ b/tools/update-api.sh @@ -35,7 +35,7 @@ cp -r envoy-*/api/envoy/* "${protodir}/envoy" mkdir -p "${protodir}/contrib" cp -r envoy-*/api/contrib/* "${protodir}/contrib" -curl -sL https://github.com/googleapis/googleapis/archive/${GOOGLEAPIS_SHA}.tar.gz | tar xz --include '*.proto' +curl -sL https://github.com/googleapis/googleapis/archive/${GOOGLEAPIS_VERSION}.tar.gz | tar xz --include '*.proto' mkdir -p "${protodir}/google/api" mkdir -p "${protodir}/google/api/expr/v1alpha1" mkdir -p "${protodir}/google/rpc" @@ -53,7 +53,7 @@ curl -sL https://github.com/prometheus/client_model/archive/v${PROMETHEUS_VERSIO mkdir -p "${protodir}/io/prometheus/client/" cp client_model-*/io/prometheus/client/metrics.proto "${protodir}/io/prometheus/client/" -curl -sL https://github.com/cncf/xds/archive/${XDS_SHA}.tar.gz | tar xz --include '*.proto' +curl -sL https://github.com/cncf/xds/archive/${XDS_VERSION}.tar.gz | tar xz --include '*.proto' mkdir -p "${protodir}/udpa" mkdir -p "${protodir}/xds" cp -r xds-*/udpa/* "${protodir}/udpa" @@ -67,8 +67,4 @@ curl -sL https://github.com/google/cel-spec/archive/v${CEL_VERSION}.tar.gz | tar mkdir -p "${protodir}/cel/" cp -r cel-spec-*/proto/cel/* "${protodir}/cel/" -curl -sL https://github.com/census-instrumentation/opencensus-proto/archive/v${OPENCENSUS_VERSION}.tar.gz | tar xz --include '*.proto' -mkdir -p "${protodir}/opencensus/proto" -cp -r opencensus-proto-*/src/opencensus/proto/* "${protodir}/opencensus/proto" - popd >/dev/null diff --git a/tools/update-sha.sh b/tools/update-sha.sh index 59d66e7..5cde754 100755 --- a/tools/update-sha.sh +++ b/tools/update-sha.sh @@ -26,7 +26,7 @@ ENVOY_VERSION=$(find_envoy_sha_from_tag "$1") CURL_OUTPUT=$(curl -s "https://raw.githubusercontent.com/envoyproxy/envoy/$ENVOY_VERSION/api/bazel/repository_locations.bzl") -GOOGLEAPIS_SHA=$(find_sha "$CURL_OUTPUT" com_google_googleapis) +GOOGLEAPIS_VERSION=$(find_sha "$CURL_OUTPUT" com_google_googleapis) GOOGLEAPIS_DATE=$(find_date "$CURL_OUTPUT" com_google_googleapis) PGV_GIT_SHA=$(find_sha "$CURL_OUTPUT" com_envoyproxy_protoc_gen_validate) @@ -38,7 +38,7 @@ 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) -XDS_SHA=$(find_sha "$CURL_OUTPUT" com_github_cncf_xds) +XDS_VERSION=$(find_sha "$CURL_OUTPUT" com_github_cncf_xds) XDS_DATE=$(find_date "$CURL_OUTPUT" com_github_cncf_xds) OPENTELEMETRY_SHA=$(find_sha "$CURL_OUTPUT" opentelemetry_proto) @@ -50,10 +50,10 @@ echo -n "# Update the versions here and run update-api.sh ENVOY_SHA=\"$ENVOY_VERSION\" # dependencies (source: https://github.com/envoyproxy/envoy/blob/$ENVOY_VERSION/api/bazel/repository_locations.bzl) -GOOGLEAPIS_SHA=\"$GOOGLEAPIS_SHA\" # $GOOGLEAPIS_DATE +GOOGLEAPIS_VERSION=\"$GOOGLEAPIS_VERSION\" # $GOOGLEAPIS_DATE PGV_VERSION=\"$PGV_GIT_SHA\" # $PGV_GIT_DATE PROMETHEUS_VERSION=\"$PROMETHEUS_VERSION\" # $PROMETHEUS_DATE OPENCENSUS_VERSION=\"$OPENCENSUS_SHA\" # $OPENCENSUS_DATE OPENTELEMETRY_VERSION=\"$OPENTELEMETRY_SHA\" # $OPENTELEMETRY_DATE -XDS_SHA=\"$XDS_SHA\" # $XDS_DATE +XDS_VERSION=\"$XDS_VERSION\" # $XDS_DATE "