tracing: enhance custom tags source (#8279)
Signed-off-by: Yi Tang <ssnailtang@gmail.com> Mirrored from https://github.com/envoyproxy/envoy @ 222890cbff2f9d7dff74fca6535771c063104d68master-ci-test
parent
7188a9fcf5
commit
8a1d99a8b2
15 changed files with 237 additions and 10 deletions
@ -0,0 +1,7 @@ |
||||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. |
||||
|
||||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||
|
||||
licenses(["notice"]) # Apache 2 |
||||
|
||||
api_proto_package() |
@ -0,0 +1,95 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.type.metadata.v2; |
||||
|
||||
option java_outer_classname = "MetadataProto"; |
||||
option java_multiple_files = true; |
||||
option java_package = "io.envoyproxy.envoy.type.metadata.v2"; |
||||
|
||||
import "validate/validate.proto"; |
||||
|
||||
// [#protodoc-title: Metadata] |
||||
|
||||
// MetadataKey provides a general interface using `key` and `path` to retrieve value from |
||||
// :ref:`Metadata <envoy_api_msg_core.Metadata>`. |
||||
// |
||||
// For example, for the following Metadata: |
||||
// |
||||
// .. code-block:: yaml |
||||
// |
||||
// filter_metadata: |
||||
// envoy.xxx: |
||||
// prop: |
||||
// foo: bar |
||||
// xyz: |
||||
// hello: envoy |
||||
// |
||||
// The following MetadataKey will retrieve a string value "bar" from the Metadata. |
||||
// |
||||
// .. code-block:: yaml |
||||
// |
||||
// key: envoy.xxx |
||||
// path: |
||||
// - key: prop |
||||
// - key: foo |
||||
// |
||||
message MetadataKey { |
||||
// Specifies the segment in a path to retrieve value from Metadata. |
||||
// Currently it is only supported to specify the key, i.e. field name, as one segment of a path. |
||||
message PathSegment { |
||||
oneof segment { |
||||
option (validate.required) = true; |
||||
|
||||
// If specified, use the key to retrieve the value in a Struct. |
||||
string key = 1 [(validate.rules).string = {min_bytes: 1}]; |
||||
} |
||||
} |
||||
|
||||
// The key name of Metadata to retrieve the Struct from the metadata. |
||||
// Typically, it represents a builtin subsystem or custom extension. |
||||
string key = 1 [(validate.rules).string = {min_bytes: 1}]; |
||||
|
||||
// The path to retrieve the Value from the Struct. It can be a prefix or a full path, |
||||
// e.g. ``[prop, xyz]`` for a struct or ``[prop, foo]`` for a string in the example, |
||||
// which depends on the particular scenario. |
||||
// |
||||
// Note: Due to that only the key type segment is supported, the path can not specify a list |
||||
// unless the list is the last segment. |
||||
repeated PathSegment path = 2 [(validate.rules).repeated = {min_items: 1}]; |
||||
} |
||||
|
||||
// Describes what kind of metadata. |
||||
message MetadataKind { |
||||
// Represents dynamic metadata associated with the request. |
||||
message Request { |
||||
} |
||||
|
||||
// Represents metadata from :ref:`the route<envoy_api_field_route.Route.metadata>`. |
||||
message Route { |
||||
} |
||||
|
||||
// Represents metadata from :ref:`the upstream cluster<envoy_api_field_Cluster.metadata>`. |
||||
message Cluster { |
||||
} |
||||
|
||||
// Represents metadata from :ref:`the upstream |
||||
// host<envoy_api_field_endpoint.LbEndpoint.metadata>`. |
||||
message Host { |
||||
} |
||||
|
||||
oneof kind { |
||||
option (validate.required) = true; |
||||
|
||||
// Request kind of metadata. |
||||
Request request = 1; |
||||
|
||||
// Route kind of metadata. |
||||
Route route = 2; |
||||
|
||||
// Cluster kind of metadata. |
||||
Cluster cluster = 3; |
||||
|
||||
// Host kind of metadata. |
||||
Host host = 4; |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. |
||||
|
||||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||
|
||||
licenses(["notice"]) # Apache 2 |
||||
|
||||
api_proto_package( |
||||
deps = ["//envoy/type/metadata/v2:pkg"], |
||||
) |
@ -0,0 +1,83 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.type.tracing.v2; |
||||
|
||||
option java_outer_classname = "CustomTagProto"; |
||||
option java_multiple_files = true; |
||||
option java_package = "io.envoyproxy.envoy.type.tracing.v2"; |
||||
|
||||
import "envoy/type/metadata/v2/metadata.proto"; |
||||
|
||||
import "validate/validate.proto"; |
||||
|
||||
// [#protodoc-title: Custom Tag] |
||||
|
||||
// Describes custom tags for the active span. |
||||
// [#next-free-field: 6] |
||||
message CustomTag { |
||||
// Literal type custom tag with static value for the tag value. |
||||
message Literal { |
||||
// Static literal value to populate the tag value. |
||||
string value = 1 [(validate.rules).string = {min_bytes: 1}]; |
||||
} |
||||
|
||||
// Environment type custom tag with environment name and default value. |
||||
message Environment { |
||||
// Environment variable name to obtain the value to populate the tag value. |
||||
string name = 1 [(validate.rules).string = {min_bytes: 1}]; |
||||
|
||||
// When the environment variable is not found, |
||||
// the tag value will be populated with this default value if specified, |
||||
// otherwise no tag will be populated. |
||||
string default_value = 2; |
||||
} |
||||
|
||||
// Header type custom tag with header name and default value. |
||||
message Header { |
||||
// Header name to obtain the value to populate the tag value. |
||||
string name = 1 [(validate.rules).string = {min_bytes: 1}]; |
||||
|
||||
// When the header does not exist, |
||||
// the tag value will be populated with this default value if specified, |
||||
// otherwise no tag will be populated. |
||||
string default_value = 2; |
||||
} |
||||
|
||||
// Metadata type custom tag using |
||||
// :ref:`MetadataKey <envoy_api_msg_type.metadata.v2.MetadataKey>` to retrieve the protobuf value |
||||
// from :ref:`Metadata <envoy_api_msg_core.Metadata>`, and populate the tag value with |
||||
// `the canonical JSON <https://developers.google.com/protocol-buffers/docs/proto3#json>`_ |
||||
// representation of it. |
||||
message Metadata { |
||||
// Specify what kind of metadata to obtain tag value from. |
||||
metadata.v2.MetadataKind kind = 1; |
||||
|
||||
// Metadata key to define the path to retrieve the tag value. |
||||
metadata.v2.MetadataKey metadata_key = 2; |
||||
|
||||
// When no valid metadata is found, |
||||
// the tag value would be populated with this default value if specified, |
||||
// otherwise no tag would be populated. |
||||
string default_value = 3; |
||||
} |
||||
|
||||
// Used to populate the tag name. |
||||
string tag = 1 [(validate.rules).string = {min_bytes: 1}]; |
||||
|
||||
// Used to specify what kind of custom tag. |
||||
oneof type { |
||||
option (validate.required) = true; |
||||
|
||||
// A literal custom tag. |
||||
Literal literal = 2; |
||||
|
||||
// An environment custom tag. |
||||
Environment environment = 3; |
||||
|
||||
// A request header custom tag. |
||||
Header request_header = 4; |
||||
|
||||
// A custom tag to obtain tag value from the metadata. |
||||
Metadata metadata = 5; |
||||
} |
||||
} |
Loading…
Reference in new issue