Skip to content

Commit

Permalink
test serializers with custom metrics and custom tags
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Sep 21, 2023
1 parent 777899f commit 648e839
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/datadog/ci/test_visibility/serializers/span_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"_dd.origin" => "ciapp-test"
}
)
expect(metrics).to eq({"_dd.top_level" => 1.0, "custom_metric" => 42})
# TODO: test start and duration with timecop
# expect(content["start"]).to eq(1)
# expect(content["duration"]).to eq(1)
Expand Down
6 changes: 5 additions & 1 deletion spec/datadog/ci/test_visibility/serializers/test_v1_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@
{
"test.framework" => "rspec",
"test.status" => "pass",
"_dd.origin" => "ciapp-test"
"_dd.origin" => "ciapp-test",
"test_owner" => "my_team"
}
)
expect(metrics).to eq(
{"_dd.measured" => 1.0, "_dd.top_level" => 1.0, "memory_allocations" => 16}
)
# TODO: test start and duration with timecop
# expect(content["start"]).to eq(1)
# expect(content["duration"]).to eq(1)
Expand Down
4 changes: 4 additions & 0 deletions spec/support/tracer_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ def produce_test_trace(
if with_http_span
Datadog::Tracing.trace("http-call", type: "http", service: "net-http") do |span, trace|
span.set_tag("custom_tag", "custom_tag_value")
span.set_tag("custom_metric", 42)
end
end

Datadog::Tracing.active_span.set_tag("test_owner", "my_team")
Datadog::Tracing.active_span.set_metric("memory_allocations", 16)

case result
when "FAILED"
Datadog::CI::Recorder.failed!(span, exception)
Expand Down

0 comments on commit 648e839

Please sign in to comment.