datadog: event scheduling portion of new tracing library#25170
Conversation
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to |
|
The dependency changes are in multiple PRs - https://github.com/envoyproxy/envoy/pull/25121/files#diff-a2ca502474bb8ec5f092176f7ee6d2f11fc395ebb00e1717d6fbad9b16ee8fd8 Is this intentional? |
|
Yes, it's intentional. In retrospect, it might have been better to first add only the dependency changes, wait for those changes to be merged into I wanted instead to propose the first round of pull requests ASAP, and so duplicated the shared added dependency in all of those lowest level PRs. I could create a dedicated dependency PR and rebase the others onto it, if you like. |
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
ping myself, sorry for the delay. 😞 |
|
Thanks for the review. I'll push a commit and merge from main within the next couple of days. |
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
/wait ci and conflict. |
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Hmmm. Looks like calling Also interesting in the logger, which was recently merged, I'd except these kinds of tests: https://github.com/envoyproxy/envoy/pull/25025/files#diff-ab9f820e99ec92b52dd7334d825976ab5b5e2240dc9693e58fd4c99fab4c7dddR96-R103 I'll have to look closer. [edit]: Ah, the logger and its sink(s) have separate levels. It's the logger level that matters most. |
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
Ping @jmarantz |
jmarantz
left a comment
There was a problem hiding this comment.
Sorry for the delay this fell off my radar.
I found a few minor suggestions, but I'm not going to be available for the next few days. Whatever you decide is fine.
@wbpcode feel free to make the final call and merge for this.
| // separate tests. | ||
| TEST(DatadogEventSchedulerTest, ScheduleRecurringEventEnablesATimer) { | ||
| testing::NiceMock<ThreadLocal::MockInstance> thread_local_storage_; | ||
| auto* const timer_ = new testing::NiceMock<Event::MockTimer>(&thread_local_storage_.dispatcher_); |
There was a problem hiding this comment.
nit: don't use an underscore suffix for a local. Comment on memory management: who deletes timer?
There was a problem hiding this comment.
This pattern is copied from here:
Which was copied from here:
It occurs to me now that the raw pointer is probably a substitute for "optional" in the original code.
who deletes timer?
Nobody, it's leaked, as in the copied-from code.
I'll see if it works the same with just a testing::NiceMock<Event::MockTimer> on the stack (no pointer). That'd be better.
There was a problem hiding this comment.
Ah, it's not for lack of optional. This is indeed the intended usage of MockTimer:
envoy/test/mocks/event/mocks.h
Lines 183 to 186 in eee9b7c
|
|
||
| TEST(DatadogEventSchedulerTest, TriggeredTimerInvokesCallbackAndReschedulesItself) { | ||
| testing::NiceMock<ThreadLocal::MockInstance> thread_local_storage_; | ||
| auto* const timer_ = new testing::NiceMock<Event::MockTimer>(&thread_local_storage_.dispatcher_); |
Signed-off-by: David Goffredo <david.goffredo@datadoghq.com>
|
Thanks! Another week has gone by and I still haven't produced the final pair of pull requests. Those are coming soon... |
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.
EventSchedulerallows 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.