Skip to content

Commit

Permalink
use keyword arguments for CI.trace_test
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Nov 1, 2023
1 parent 12e04e4 commit 746b9c6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/ci.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Datadog
module CI
module_function

def trace_test(test_name, service_name, operation_name, tags = {})
def trace_test(test_name, service_name: nil, operation_name: nil, tags: {})
span_options = {
resource: test_name,
service: service_name
Expand Down
8 changes: 4 additions & 4 deletions lib/datadog/ci/contrib/cucumber/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def bind_events(config)
def on_test_case_started(event)
@current_feature_span = CI.trace_test(
event.test_case.name,
configuration[:service_name],
configuration[:operation_name],
{
tags: {
framework: Ext::FRAMEWORK,
framework_version: CI::Contrib::Cucumber::Integration.version.to_s,
test_type: Ext::TEST_TYPE,
test_suite: event.test_case.location.file
}
},
service_name: configuration[:service_name],
operation_name: configuration[:operation_name]
)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/datadog/ci/contrib/minitest/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ def before_setup

test_span = CI.trace_test(
test_name,
configuration[:service_name],
configuration[:operation_name],
{
tags: {
framework: Ext::FRAMEWORK,
framework_version: CI::Contrib::Minitest::Integration.version.to_s,
test_type: Ext::TEST_TYPE,
test_suite: test_suite
}
},
service_name: configuration[:service_name],
operation_name: configuration[:operation_name]
)

@current_test_span = test_span
Expand Down
8 changes: 4 additions & 4 deletions lib/datadog/ci/contrib/rspec/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def run(example_group_instance, reporter)

CI.trace_test(
test_name,
configuration[:service_name],
configuration[:operation_name],
{
tags: {
framework: Ext::FRAMEWORK,
framework_version: CI::Contrib::RSpec::Integration.version.to_s,
test_type: Ext::TEST_TYPE,
test_suite: metadata[:example_group][:file_path]
}
},
service_name: configuration[:service_name],
operation_name: configuration[:operation_name]
) do |test_span|
result = super

Expand Down
8 changes: 4 additions & 4 deletions spec/support/tracer_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def produce_test_trace(

Datadog::CI.trace_test(
test_name,
service,
operation,
{
tags: {
framework: framework,
framework_version: "1.0.0",
test_type: "test",
test_suite: test_suite
}
},
service_name: service,
operation_name: operation
) do |test|
if with_http_span
Datadog::Tracing.trace("http-call", type: "http", service: "net-http") do |span, trace|
Expand Down

0 comments on commit 746b9c6

Please sign in to comment.