Skip to content
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

Restore monkey patch introducing [] and []= to span instances. #3

Merged
merged 2 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion lib/traces/backend/datadog/interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

require 'ddtrace'
require 'datadog/tracing'

require 'traces/context'
require_relative 'version'

# We introduce some compatibility interfaces for getting and setting tags:
module Datadog::Tracing::Metadata::Tagging
alias []= set_tag
alias [] get_tag
end

module Traces
module Backend
module Datadog
Expand Down
10 changes: 5 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

require 'datadog/tracing'
require 'ddtrace'

Datadog.configure do |config|
# To enable debug mode
# config.diagnostics.debug = true
end
# Datadog.configure do |config|
# # To enable debug mode
# config.diagnostics.debug = true
# end

require "bundler/setup"
require "traces/backend/datadog"
Expand Down
8 changes: 8 additions & 0 deletions spec/traces/backend/datadog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ def my_span_and_context

it {is_expected.to be == "my_span"}
end

describe '#[]=' do
before {span["my_key"] = "tag_value"}

subject(:value) {span["my_key"]}

it {is_expected.to be == "tag_value"}
end
end

describe Datadog::Tracing::TraceOperation do
Expand Down