Datadog tracing extension: remove OpenTracing#23958
Conversation
|
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to |
|
As David is away for a bit, I'll sort out the conflicts and DCO so this can at least have CI checks run on them. |
|
/lgtm deps |
|
/wait |
ae85761 to
90deb68
Compare
|
I'm back. The format checker does not like our use of I looked through the history of this policy, and it looks like forbidding the use of the In any case, I'm looking into adding an alternative build mode to Otherwise this PR remains ready for review. |
bcd8734 to
1d8476c
Compare
|
If I'm reading https://dev.azure.com/cncf/envoy/_build/results?buildId=122708&view=results correctly, the CI checks have the following complaints:
(1) I'm happy to fix, though it seems unnecessary. |
|
/lgtm deps |
|
/assign @cgilmour |
|
I'm currently working on increasing the code coverage of the Datadog tracing unit tests. Don't hesitate to submit review comments or concerns in the mean time. This pull request is my top priority. |
|
It looks like I have appeased the CI system. ✔️ |
|
@cgilmour can you take another look at this PR? |
|
@cgilmour is on holiday as of today, I believe. He has already looked over the code, though he did not submit a review. I'm interested in getting feedback from an Envoy maintainer, if one is available to do a code review. |
|
/assign-from @envoyproxy/first-pass-reviewers |
|
Part 6/9 is grinding through the CI: #25170 |
|
@dgoffredo thanks for these great contributions. Thanks again. |
|
@wbpcode Happy New Year! Take your time, I have plenty more to do before I'm blocked on these PRs. |
|
Part 7/9 is grinding through the CI: #25417 |
|
Here's an update on the status of these pull requests. I'll propose two or three more pull requests. "8/9" will introduce the "9/9" will introduce the "10/9" will remove the old implementation, and probably update the version of the dd-trace-cpp dependency (it's changed since work began on this within Envoy). It's possible that "10/9" will be part of "9/9" instead. This week is "R&D Week" at my company, so I'm working on other things. I'll resume work on the remaining pull requests next week. |
This is part of the initiative described in #23958. This revision introduces a new library dependency for Datadog tracing, and adds a component that will be used in the future when more of the new library is integrated into the Datadog tracing extension. EventScheduler allows the new tracing library to schedule a recurring timer that fires every two seconds; this is when the tracing library will send its batched traces to the Datadog Agent. Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
/wait |
|
Part 8/9 is grinding through the CI: #26148 |
|
Part 9/9 is grinding through the CI: #26284 Rejoice! |
This is part of the work proposed in #23958. This adds the Tracer class, which has one member function, startSpan, for creating a new trace or extracting one from incoming (HTTP) request headers. Tracer is a thread-local wrapper around the corresponding class in dd-trace-cpp, except that failure to configure the underlying tracer puts Tracer into a "no-op mode" that always produces NullSpan instances. In addition to that code and its corresponding unit tests, I also updated the version of dd-trace-cpp used. The newer version has additional Span methods that made testing easier. Additionally, the newer dd-trace-cpp models TraceID as its own class to accommodate 128-bit IDs. The existing unit test for Span needed to be modified to account for this. Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
This is part of the work proposed in envoyproxy#23958. This adds the Tracer class, which has one member function, startSpan, for creating a new trace or extracting one from incoming (HTTP) request headers. Tracer is a thread-local wrapper around the corresponding class in dd-trace-cpp, except that failure to configure the underlying tracer puts Tracer into a "no-op mode" that always produces NullSpan instances. In addition to that code and its corresponding unit tests, I also updated the version of dd-trace-cpp used. The newer version has additional Span methods that made testing easier. Additionally, the newer dd-trace-cpp models TraceID as its own class to accommodate 128-bit IDs. The existing unit test for Span needed to be modified to account for this. Signed-off-by: David Goffredo <david.goffredo@datadoghq.com> Signed-off-by: River Phillips <riverphillips1@gmail.com>
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
/wait I'll close this (without merging) once #26284 is merged. |
This is the final part of the work proposed in #23958. This PR additionally contains all of the changes from #26148. This diff will shrink when that PR is merged. This revision alters the DatadogTracerFactory in source/extensions/tracers/datadog/config.h to produce instances of the new dd-trace-cpp based implementation of the Datadog tracer, instead of the old dd-opentracing-cpp based one. This revision actually alters the implementation of the Datadog tracer. Previous pull requests have only added code for use here. This revision also moves some unit tests around: Two tests that were part of datadog_tracer_impl_test.cc have been moved into agent_http_client_test.cc, because they're about HTTP requests. One test that was part of datadog_tracer_impl_test.cc has been removed because its behavior is already covered by tests added in other PRs in this series. The remaining tests in datadog_tracer_impl_test_.cc were moved into config_test.cc, since they all now have to do with the configuration of the tracer and the resulting behavior. Finally, all references to dd-opentracing-cpp and msgpack have been removed from the repo, and the documentation (READMEs) and demo/ directory from #23958 have been added. Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
#26284 is merged, so this work is now complete. Thanks for playing. |
) This is the final part of the work proposed in envoyproxy#23958. This PR additionally contains all of the changes from envoyproxy#26148. This diff will shrink when that PR is merged. This revision alters the DatadogTracerFactory in source/extensions/tracers/datadog/config.h to produce instances of the new dd-trace-cpp based implementation of the Datadog tracer, instead of the old dd-opentracing-cpp based one. This revision actually alters the implementation of the Datadog tracer. Previous pull requests have only added code for use here. This revision also moves some unit tests around: Two tests that were part of datadog_tracer_impl_test.cc have been moved into agent_http_client_test.cc, because they're about HTTP requests. One test that was part of datadog_tracer_impl_test.cc has been removed because its behavior is already covered by tests added in other PRs in this series. The remaining tests in datadog_tracer_impl_test_.cc were moved into config_test.cc, since they all now have to do with the configuration of the tracer and the resulting behavior. Finally, all references to dd-opentracing-cpp and msgpack have been removed from the repo, and the documentation (READMEs) and demo/ directory from envoyproxy#23958 have been added. Signed-off-by: David Goffredo <david.goffredo@datadoghq.com> Signed-off-by: Ryan Eskin <ryan.eskin89@protonmail.com>
Commit Message: Datadog tracing extension uses new tracing library
Additional Description: See below.
Risk Level: Medium
Testing: Existing unit tests are sufficient.
Docs Changes: User-facing documentation for the Datadog tracing integration does not need to change, because these changes do not change the configuration.
Release Notes: N/A or unsure
Platform Specific Features: N/A
[Optional Runtime guard:]
[Optional Fixes #Issue] #21083
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]
Overview
This is rewrite of the Datadog tracing extension.
Now that there is a non-OpenTracing Datadog C++ Tracing library
(dd-trace-cpp), the first order of business is to remove the
OpenTracing dependency on Envoy's Datadog tracing extension by rewriting
the extension in terms of the new library.
This pull request addresses a longstanding issue, and if accepted will
allow Datadog tracing in Envoy to catch up with Datadog tracing in other
projects. Due to the OpenTracing dependency of the existing extension, Datadog
tracing has been frozen on an old version for a long time.
Changing to a non-OpenTracing, recent tracing library allows us to address
multiple problems with the current extension:
error.*span tags,DD_TRACE_SAMPLE_RATE,DD_TRACE_RATE_LIMIT, andDD_SPAN_SAMPLING_RULESenvironment variables,
the same trace.
In general, we have not been able to update the Datadog tracing extension since
January 2021. With these changes we will be able to make updates from now on.
Design
The components of this extension are described in the included
README.mdfile.There's even a diagram.
There is further description of the inner workings of the underlying tracing
library in its own readme and more extensively in its maintainer
documentation.
dd-trace-cpp exports mostly concrete types. However, there are two
context-dependent interfaces that are implemented in this pull request.
See
event_scheduler.{h,cc}andagent_http_client.{h,cc}.Testing
I made minimal modifications to the existing unit tests, and added several new ones.
There is also a
demo/directory in the source tree that I used for manualad hoc integration testing during development. If that directory does not
belong, then we can remove it.
Code Style
I read Envoy's contributing guidelines and C++ style guide, and have formatted
the code using
ci/run_envoy_docker.sh './ci/do_ci.sh format'.This is my first time contributing to Envoy. Anywhere that the style of this
extension differs from Envoy's house style, I would be happy to make changes
to conform to the house style.
Datadog Contacts
I'll be on vacation for three weeks right after I propose this pull request.Until I return (or succumb to the temptation to check this pull request),
my teammate @cgilmour can address questions and make modifications.
We're willing to make modifications to dd-trace-cpp per this code review
as well. Envoy will be the first client of the new library.
Let's get this code in ship shape so that we can carry on adding features.