-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate trace through Concurrent::Promises.future (#1522)
* Propagate trace through Concurrent::Promises.future Argument passing is preserved through the composited executor. Concurrent::Future has been moved to a prepend style to resolve an infinite call loop situation. * Use stub_const+dup to have a temporary inheritance chain This allows a rollback of the effects of prepend upon the original module being restored after each test. * updating propogate traces through promises tests to work with 1.x * Update context_composite_executor_service post method to use continue_trace method for thread safety --------- Co-authored-by: Edmund Kump <edmund.kump@datadoghq.com>
- Loading branch information
Showing
8 changed files
with
238 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
22 changes: 22 additions & 0 deletions
22
lib/datadog/tracing/contrib/concurrent_ruby/promises_future_patch.rb
This file contains 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,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'context_composite_executor_service' | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module ConcurrentRuby | ||
# This patches the Future - to wrap executor service using ContextCompositeExecutorService | ||
module PromisesFuturePatch | ||
def future_on(default_executor, *args, &task) | ||
unless default_executor.is_a?(ContextCompositeExecutorService) | ||
default_executor = ContextCompositeExecutorService.new(default_executor) | ||
end | ||
|
||
super(default_executor, *args, &task) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
sig/datadog/tracing/contrib/concurrent_ruby/promises_future_patch.rbs
This file contains 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,9 @@ | ||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module ConcurrentRuby | ||
def future_on: (untyped default_executor, untyped args, untyped task) -> untyped | ||
end | ||
end | ||
end | ||
end |
This file contains 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
Oops, something went wrong.