Add an OpenTelemetry (gRPC) access logger extension (#15105)
This PR adds an OTLP logger to Envoy, which allows users to flexibly configure their log structure (according to OpenTelemetry protos). The API users the common gRPC configuration, used in ALS, for gRPC settings. The flexible OT fields (body, attributes) are completely configurable and are filled with request/response information based on Envoy access log formatting. There are still a couple of TODOs - The 'filter_state_objects_to_log' from the common gRPC config isn't added to the log Resource attributes are not configurable, and only Envoy node info is added. Note: this extension was added as v3alpha API. Risk Level: Low - a new extension, so unlikely to break any existing setups (marked as v3alpha API). Testing: Unit tests. Docs Changes: Release Notes: access log: added a new :ref:OpenTelemetry access logger <envoy_v3_api_msg_extensions.access_loggers.open_telemetry.v3alpha.OpenTelemetryAccessLogConfig> extension, allowing a flexible log structure with native Envoy access log formatting. Signed-off-by: Itamar Kaminski <itamark@google.com> Mirrored from https://github.com/envoyproxy/envoy @ 4f52f9ef554e1522e763c0eaf6ef6833aab283e5pull/624/head
parent
ff1188ebd4
commit
a734cda3a9
8 changed files with 129 additions and 6 deletions
@ -0,0 +1,13 @@ |
||||
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. |
||||
|
||||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||
|
||||
licenses(["notice"]) # Apache 2 |
||||
|
||||
api_proto_package( |
||||
deps = [ |
||||
"//envoy/extensions/access_loggers/grpc/v3:pkg", |
||||
"@com_github_cncf_udpa//udpa/annotations:pkg", |
||||
"@opentelemetry_proto//:logs", |
||||
], |
||||
) |
@ -0,0 +1,42 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.extensions.access_loggers.open_telemetry.v3alpha; |
||||
|
||||
import "envoy/extensions/access_loggers/grpc/v3/als.proto"; |
||||
|
||||
import "opentelemetry/proto/common/v1/common.proto"; |
||||
|
||||
import "udpa/annotations/status.proto"; |
||||
import "validate/validate.proto"; |
||||
|
||||
option java_package = "io.envoyproxy.envoy.extensions.access_loggers.open_telemetry.v3alpha"; |
||||
option java_outer_classname = "LogsServiceProto"; |
||||
option java_multiple_files = true; |
||||
option (udpa.annotations.file_status).work_in_progress = true; |
||||
option (udpa.annotations.file_status).package_version_status = ACTIVE; |
||||
|
||||
// [#protodoc-title: OpenTelemetry (gRPC) Access Log] |
||||
|
||||
// Configuration for the built-in *envoy.access_loggers.open_telemetry* |
||||
// :ref:`AccessLog <envoy_api_msg_config.accesslog.v3.AccessLog>`. This configuration will |
||||
// populate `opentelemetry.proto.collector.v1.logs.ExportLogsServiceRequest.resource_logs <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/collector/logs/v1/logs_service.proto>`_. |
||||
// OpenTelemetry `Resource <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/resource/v1/resource.proto>`_ |
||||
// attributes are filled with Envoy node info. In addition, the request start time is set in the |
||||
// dedicated field. |
||||
// [#extension: envoy.access_loggers.open_telemetry] |
||||
// [#comment:TODO(itamarkam): allow configuration for resource attributes.] |
||||
message OpenTelemetryAccessLogConfig { |
||||
// [#comment:TODO(itamarkam): add 'filter_state_objects_to_log' to logs.] |
||||
grpc.v3.CommonGrpcAccessLogConfig common_config = 1 [(validate.rules).message = {required: true}]; |
||||
|
||||
// OpenTelemetry `LogResource <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/logs/v1/logs.proto>`_ |
||||
// fields, following `Envoy access logging formatting <https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage>`_. |
||||
// |
||||
// See 'body' in the LogResource proto for more details. |
||||
// Example: ``body { string_value: "%PROTOCOL%" }``. |
||||
opentelemetry.proto.common.v1.AnyValue body = 2; |
||||
|
||||
// See 'attributes' in the LogResource proto for more details. |
||||
// Example: ``attributes { values { key: "user_agent" value { string_value: "%REQ(USER-AGENT)%" } } }``. |
||||
opentelemetry.proto.common.v1.KeyValueList attributes = 3; |
||||
} |
@ -0,0 +1,14 @@ |
||||
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. |
||||
|
||||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") |
||||
|
||||
licenses(["notice"]) # Apache 2 |
||||
|
||||
api_proto_package( |
||||
deps = [ |
||||
"//envoy/extensions/access_loggers/grpc/v4alpha:pkg", |
||||
"//envoy/extensions/access_loggers/open_telemetry/v3alpha:pkg", |
||||
"@com_github_cncf_udpa//udpa/annotations:pkg", |
||||
"@opentelemetry_proto//:logs", |
||||
], |
||||
) |
@ -0,0 +1,47 @@ |
||||
syntax = "proto3"; |
||||
|
||||
package envoy.extensions.access_loggers.open_telemetry.v4alpha; |
||||
|
||||
import "envoy/extensions/access_loggers/grpc/v4alpha/als.proto"; |
||||
|
||||
import "opentelemetry/proto/common/v1/common.proto"; |
||||
|
||||
import "udpa/annotations/status.proto"; |
||||
import "udpa/annotations/versioning.proto"; |
||||
import "validate/validate.proto"; |
||||
|
||||
option java_package = "io.envoyproxy.envoy.extensions.access_loggers.open_telemetry.v4alpha"; |
||||
option java_outer_classname = "LogsServiceProto"; |
||||
option java_multiple_files = true; |
||||
option (udpa.annotations.file_status).work_in_progress = true; |
||||
option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; |
||||
|
||||
// [#protodoc-title: OpenTelemetry (gRPC) Access Log] |
||||
|
||||
// Configuration for the built-in *envoy.access_loggers.open_telemetry* |
||||
// :ref:`AccessLog <envoy_api_msg_config.accesslog.v4alpha.AccessLog>`. This configuration will |
||||
// populate `opentelemetry.proto.collector.v1.logs.ExportLogsServiceRequest.resource_logs <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/collector/logs/v1/logs_service.proto>`_. |
||||
// OpenTelemetry `Resource <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/resource/v1/resource.proto>`_ |
||||
// attributes are filled with Envoy node info. In addition, the request start time is set in the |
||||
// dedicated field. |
||||
// [#extension: envoy.access_loggers.open_telemetry] |
||||
// [#comment:TODO(itamarkam): allow configuration for resource attributes.] |
||||
message OpenTelemetryAccessLogConfig { |
||||
option (udpa.annotations.versioning).previous_message_type = |
||||
"envoy.extensions.access_loggers.open_telemetry.v3alpha.OpenTelemetryAccessLogConfig"; |
||||
|
||||
// [#comment:TODO(itamarkam): add 'filter_state_objects_to_log' to logs.] |
||||
grpc.v4alpha.CommonGrpcAccessLogConfig common_config = 1 |
||||
[(validate.rules).message = {required: true}]; |
||||
|
||||
// OpenTelemetry `LogResource <https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/logs/v1/logs.proto>`_ |
||||
// fields, following `Envoy access logging formatting <https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage>`_. |
||||
// |
||||
// See 'body' in the LogResource proto for more details. |
||||
// Example: ``body { string_value: "%PROTOCOL%" }``. |
||||
opentelemetry.proto.common.v1.AnyValue body = 2; |
||||
|
||||
// See 'attributes' in the LogResource proto for more details. |
||||
// Example: ``attributes { values { key: "user_agent" value { string_value: "%REQ(USER-AGENT)%" } } }``. |
||||
opentelemetry.proto.common.v1.KeyValueList attributes = 3; |
||||
} |
Loading…
Reference in new issue