Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/envoy/config/trace/v3/trace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import public "envoy/config/trace/v3/http_tracer.proto";
import public "envoy/config/trace/v3/lightstep.proto";
import public "envoy/config/trace/v3/opencensus.proto";
import public "envoy/config/trace/v3/service.proto";
import public "envoy/config/trace/v3/tracer.proto";
import public "envoy/config/trace/v3/zipkin.proto";

option java_package = "io.envoyproxy.envoy.config.trace.v3";
Expand Down
29 changes: 29 additions & 0 deletions api/envoy/config/trace/v3/tracer.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";

package envoy.config.trace.v3;

import "google/protobuf/any.proto";

import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.config.trace.v3";
option java_outer_classname = "TracerProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Tracing]
// Tracing :ref:`architecture overview <arch_overview_tracing>`.

// The tracing configuration specifies settings for an tracer provider used by Envoy.
message TracerProvider {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where this is used?

And the content of this message is exactly same as TypedExtensionConfig so we can just use that.

@wbpcode wbpcode Apr 27, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's designed to replace envoy.config.trace.v3.Tracing.Http in the future. There is no place to use it yet. But you are right, we can use TypedExtensionConfig directly. I will remove it.

// The name of the trace driver to instantiate. The name must match a supported trace driver.
// See the :ref:`extensions listed in typed_config below <extension_category_envoy.tracers>` for the
// default list of the trace driver.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places I see "tracing driver", "tracer driver" in addition to "trace driver" used interchangeably. Can we stick to a single term?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

string name = 1 [(validate.rules).string = {min_len: 1}];

// Trace driver specific configuration which must be set according to the driver being instantiated.
// [#extension-category: envoy.tracers]
google.protobuf.Any typed_config = 2;
}
32 changes: 32 additions & 0 deletions api/envoy/config/trace/v4alpha/tracer.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions generated_api_shadow/envoy/config/trace/v3/trace.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions generated_api_shadow/envoy/config/trace/v3/tracer.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions generated_api_shadow/envoy/config/trace/v4alpha/tracer.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions include/envoy/http/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ envoy_cc_library(
],
deps = [
":header_formatter_interface",
"//include/envoy/tracing:trace_context_interface",
"//source/common/common:assert_lib",
"//source/common/common:hash_lib",
],
Expand Down
6 changes: 4 additions & 2 deletions include/envoy/http/header_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "envoy/common/optref.h"
#include "envoy/common/pure.h"
#include "envoy/http/header_formatter.h"
#include "envoy/tracing/trace_context.h"

#include "common/common/assert.h"
#include "common/common/hash.h"
Expand Down Expand Up @@ -64,7 +65,7 @@ class LowerCaseString {
return *this;
}

explicit LowerCaseString(const std::string& new_string) : string_(new_string) {
explicit LowerCaseString(const absl::string_view new_string) : string_(new_string) {
ASSERT(valid());
lower();
}
Expand Down Expand Up @@ -817,7 +818,8 @@ class RequestOrResponseHeaderMap : public HeaderMap {
// Request headers.
class RequestHeaderMap
: public RequestOrResponseHeaderMap,
public CustomInlineHeaderBase<CustomInlineHeaderRegistry::Type::RequestHeaders> {
public CustomInlineHeaderBase<CustomInlineHeaderRegistry::Type::RequestHeaders>,
public Tracing::TracingContext {
public:
INLINE_REQ_STRING_HEADERS(DEFINE_INLINE_STRING_HEADER)
INLINE_REQ_NUMERIC_HEADERS(DEFINE_INLINE_NUMERIC_HEADER)
Expand Down
12 changes: 6 additions & 6 deletions include/envoy/server/tracer_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ class TracerFactory : public Config::TypedFactory {
~TracerFactory() override = default;

/**
* Create a particular HttpTracer implementation. If the implementation is unable to produce an
* HttpTracer with the provided parameters, it should throw an EnvoyException in the case of
* general error or a Json::Exception if the json configuration is erroneous. The returned
* Create a particular tracer driver implementation. If the implementation is unable to produce
* an tracer driver with the provided parameters, it should throw an EnvoyException in the case
Comment thread
wbpcode marked this conversation as resolved.
Outdated
* of general error or a Json::Exception if the json configuration is erroneous. The returned
* pointer should always be valid.
*
* NOTE: Due to the corner case of OpenCensus, who can only support a single tracing
* configuration per entire process, the returned HttpTracer instance is not guaranteed
* configuration per entire process, the returned Driver instance is not guaranteed
* to be unique.
* That is why the return type has been changed to std::shared_ptr<> instead of a more
* idiomatic std::unique_ptr<>.
*
* @param config supplies the proto configuration for the HttpTracer
* @param context supplies the factory context
*/
virtual Tracing::HttpTracerSharedPtr createHttpTracer(const Protobuf::Message& config,
TracerFactoryContext& context) PURE;
virtual Tracing::DriverSharedPtr createTracerDriver(const Protobuf::Message& config,
TracerFactoryContext& context) PURE;

std::string category() const override { return "envoy.tracers"; }
};
Expand Down
18 changes: 16 additions & 2 deletions include/envoy/tracing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,26 @@ licenses(["notice"]) # Apache 2

envoy_package()

envoy_cc_library(
name = "trace_context_interface",
hdrs = ["trace_context.h"],
)

envoy_cc_library(
name = "trace_driver_interface",
hdrs = ["trace_driver.h"],
deps = [
":trace_context_interface",
":trace_reason_interface",
"//include/envoy/stream_info:stream_info_interface",
],
)

envoy_cc_library(
name = "http_tracer_interface",
hdrs = ["http_tracer.h"],
deps = [
":trace_reason_interface",
"//include/envoy/access_log:access_log_interface",
":trace_driver_interface",
"//include/envoy/http:header_map_interface",
],
)
Expand Down
Loading