-
Notifications
You must be signed in to change notification settings - Fork 5.4k
tracing: add datadog extension #4699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattklein123
merged 18 commits into
envoyproxy:master
from
DataDog:cgilmour/datadog-tracer
Nov 5, 2018
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2b5c3e6
tracing: add datadog extension
cgilmour 5bc8aa8
Merge branch 'master' into cgilmour/datadog-tracer
cgilmour 569bbc2
Updates from review comments.
cgilmour 35b8db6
Update dd-opentracing-cpp to v0.3.3
cgilmour 7e20b68
Minor fix and bump dd-opentracing-cpp to v0.3.4
cgilmour b837332
Use correct type name TraceEncoderSharedPtr
cgilmour 864db99
Use references instead of copies.
cgilmour 08bbe72
Remove priority_sampling option.
cgilmour cb479b2
Revert to addCopy for encoder headers.
cgilmour cf8c511
Use sensible default, remove config items. Fix test.
cgilmour 9b25a32
Change tracers to use checkCluster
cgilmour 160ff4e
Convert headers to LowerCaseString once. Pass refs
cgilmour 3ed7daf
Update dd-opentracing-cpp -> v0.3.5
cgilmour eb99d70
Merge branch 'master' into cgilmour/datadog-tracer
cgilmour 8c1fe84
Update repository locations
cgilmour 5a243ab
Update for clang_tidy errors
cgilmour fd5a4a3
Merge branch 'master' into cgilmour/datadog-tracer
cgilmour cf4dfb2
Update release notes and tracer docs.
cgilmour File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| # Trace driver for Datadog (https://datadoghq.com/) | ||
|
|
||
| load( | ||
| "//bazel:envoy_build_system.bzl", | ||
| "envoy_cc_library", | ||
| "envoy_package", | ||
| ) | ||
|
|
||
| envoy_package() | ||
|
|
||
| envoy_cc_library( | ||
| name = "datadog_tracer_lib", | ||
| srcs = [ | ||
| "datadog_tracer_impl.cc", | ||
| ], | ||
| hdrs = [ | ||
| "datadog_tracer_impl.h", | ||
| ], | ||
| external_deps = ["dd_opentracing_cpp"], | ||
| deps = [ | ||
| "//source/common/tracing:http_tracer_lib", | ||
| "//source/extensions/tracers:well_known_names", | ||
| "//source/extensions/tracers/common/ot:opentracing_driver_lib", | ||
| "//source/server:configuration_lib", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "config", | ||
| srcs = ["config.cc"], | ||
| hdrs = ["config.h"], | ||
| deps = [ | ||
| ":datadog_tracer_lib", | ||
| "//source/extensions/tracers:well_known_names", | ||
| "//source/server:configuration_lib", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #include "extensions/tracers/datadog/config.h" | ||
|
|
||
| #include "envoy/registry/registry.h" | ||
|
|
||
| #include "common/common/utility.h" | ||
| #include "common/tracing/http_tracer_impl.h" | ||
|
|
||
| #include "extensions/tracers/datadog/datadog_tracer_impl.h" | ||
| #include "extensions/tracers/well_known_names.h" | ||
|
|
||
| #include "datadog/opentracing.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Extensions { | ||
| namespace Tracers { | ||
| namespace Datadog { | ||
|
|
||
| Tracing::HttpTracerPtr | ||
| DatadogTracerFactory::createHttpTracer(const envoy::config::trace::v2::Tracing& configuration, | ||
| Server::Instance& server) { | ||
|
|
||
| ProtobufTypes::MessagePtr config_ptr = createEmptyConfigProto(); | ||
|
|
||
| if (configuration.http().has_config()) { | ||
| MessageUtil::jsonConvert(configuration.http().config(), *config_ptr); | ||
| } | ||
|
|
||
| const auto& datadog_config = | ||
| dynamic_cast<const envoy::config::trace::v2::DatadogConfig&>(*config_ptr); | ||
|
|
||
| Tracing::DriverPtr datadog_driver{ | ||
| std::make_unique<Driver>(datadog_config, server.clusterManager(), server.stats(), | ||
| server.threadLocal(), server.runtime())}; | ||
| return std::make_unique<Tracing::HttpTracerImpl>(std::move(datadog_driver), server.localInfo()); | ||
| } | ||
|
|
||
| std::string DatadogTracerFactory::name() { return TracerNames::get().Datadog; } | ||
|
|
||
| /** | ||
| * Static registration for the Datadog tracer. @see RegisterFactory. | ||
| */ | ||
| static Registry::RegisterFactory<DatadogTracerFactory, Server::Configuration::TracerFactory> | ||
| register_; | ||
|
|
||
| } // namespace Datadog | ||
| } // namespace Tracers | ||
| } // namespace Extensions | ||
| } // namespace Envoy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "envoy/server/instance.h" | ||
|
|
||
| #include "server/configuration_impl.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Extensions { | ||
| namespace Tracers { | ||
| namespace Datadog { | ||
|
|
||
| /** | ||
| * Config registration for the Datadog tracer. @see TracerFactory. | ||
| */ | ||
| class DatadogTracerFactory : public Server::Configuration::TracerFactory { | ||
| public: | ||
| // TracerFactory | ||
| Tracing::HttpTracerPtr createHttpTracer(const envoy::config::trace::v2::Tracing& configuration, | ||
| Server::Instance& server) override; | ||
|
|
||
| ProtobufTypes::MessagePtr createEmptyConfigProto() override { | ||
| return std::make_unique<envoy::config::trace::v2::DatadogConfig>(); | ||
| } | ||
|
|
||
| std::string name() override; | ||
| }; | ||
|
|
||
| } // namespace Datadog | ||
| } // namespace Tracers | ||
| } // namespace Extensions | ||
| } // namespace Envoy |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a release note for this? Are there any other docs that need updating? Perhaps https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/tracing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to do this once the main code changes are acceptable.