11defmodule Sentry.Transaction do
2- @ type t ( ) :: % __MODULE__ { }
2+ @ moduledoc """
3+ The struct for the **transaction** interface.
34
4- alias Sentry . { Config , UUID }
5+ See <https://develop.sentry.dev/sdk/event-payloads/transactions>.
6+ """
7+
8+ @ moduledoc since: "11.0.0"
9+
10+ @ typedoc since: "11.0.0"
11+
12+ @ type t ( ) :: % __MODULE__ {
13+ event_id: String . t ( ) ,
14+ environment: String . t ( ) ,
15+ transaction: String . t ( ) ,
16+ transaction_info: map ( ) ,
17+ contexts: map ( ) ,
18+ measurements: map ( ) ,
19+ type: String . t ( )
20+ }
21+
22+ alias Sentry . { Config , UUID , Interfaces.Span }
523
624 @ enforce_keys [ :event_id , :span_id , :spans , :environment ]
725
@@ -24,7 +42,6 @@ defmodule Sentry.Transaction do
2442 )
2543 end
2644
27- # Used to then encode the returned map to JSON.
2845 @ doc false
2946 def to_map ( % __MODULE__ { } = transaction ) do
3047 transaction_attrs =
@@ -41,32 +58,9 @@ defmodule Sentry.Transaction do
4158 { [ root_span ] , child_spans } = Enum . split_with ( transaction . spans , & is_nil ( & 1 . parent_span_id ) )
4259
4360 root_span
44- |> Sentry. Span. to_map ( )
45- |> Map . put ( :spans , Enum . map ( child_spans , & Sentry. Span. to_map / 1 ) )
61+ |> Span . to_map ( )
62+ |> Map . put ( :spans , Enum . map ( child_spans , & Span . to_map / 1 ) )
4663 |> Map . drop ( [ :description ] )
4764 |> Map . merge ( transaction_attrs )
4865 end
4966end
50-
51- defmodule Sentry.Span do
52- @ moduledoc false
53-
54- @ enforce_keys [ :trace_id , :span_id , :start_timestamp , :timestamp ]
55-
56- defstruct @ enforce_keys ++
57- [
58- :parent_span_id ,
59- :description ,
60- :op ,
61- :status ,
62- :tags ,
63- :data ,
64- :origin
65- ]
66-
67- # Used to then encode the returned map to JSON.
68- @ doc false
69- def to_map ( % __MODULE__ { } = span ) do
70- Map . from_struct ( span )
71- end
72- end
0 commit comments