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

Create execution boxes for consumer spans #28

Merged
merged 2 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions src/atlas/domain/sequence_diagram.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

(defn- server-span? [{:keys [tags]}] (has-tag? "span.kind" "server" tags))

(defn- consumer-span? [{:keys [tags]}] (has-tag? "span.kind" "consumer" tags))

(defn- client-span? [{:keys [tags]}] (has-tag? "span.kind" "client" tags))

(defn- producer-span? [{:keys [tags]}] (has-tag? "span.kind" "producer" tags))
Expand Down Expand Up @@ -88,8 +90,9 @@

(s/defn execution-boxes :- [s-sequence-diagram/ExecutionBox]
[trace :- s-jaeger/Trace]
(let [server-spans (->> trace :spans (filter server-span?))]
(map (span->execution-box trace) server-spans)))
(let [server-spans (->> trace :spans (filter server-span?))
lucasmafra marked this conversation as resolved.
Show resolved Hide resolved
consumer-spans (->> trace :spans (filter consumer-span?))]
(map (span->execution-box trace) (concat server-spans consumer-spans))))

(s/defn arrows :- [s-sequence-diagram/Arrow]
[trace :- s-jaeger/Trace]
Expand Down
19 changes: 19 additions & 0 deletions test/atlas/domain/sequence_diagram_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@
:tags [{:key "span.kind"
:type "string"
:value "producer"}
{:key "message_bus.destination"
:type "string"
:value "PROCESS_ORDER"}]}
{:trace-id "1"
lucasmafra marked this conversation as resolved.
Show resolved Hide resolved
:span-id "5"
:process-id :p2
:operation-name "kafka.in PROCESS_ORDER"
:start-time 1500000000350000
:duration 50
:references [{:ref-type :child-of
:trace-id "1"
:span-id "4"}]
:tags [{:key "span.kind"
:type "string"
:value "consumer"}
{:key "message_bus.destination"
:type "string"
:value "PROCESS_ORDER"}]}]
Expand Down Expand Up @@ -104,6 +119,10 @@
{:id "3"
:start-time #epoch 1500000000200
:duration-ms 100
:lifeline "orders"}
{:id "5"
:start-time #epoch 1500000000350
:duration-ms 50
:lifeline "orders"}]
(nut/execution-boxes trace)))))

Expand Down
19 changes: 19 additions & 0 deletions test/flows/get_sequence_diagram.clj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@
"tags" [{"key" "span.kind"
"type" "string"
"value" "producer"}
{"key" "message_bus.destination"
"type" "string"
"value" "PROCESS_ORDER"}]}
{"traceID" "1"
"spanID" "5"
"processID" "p2"
"operationName" "kafka.in PROCESS_ORDER"
"startTime" 1500000000350000
"duration" 50
"references" [{"ref-type" "CHILD_OF"
"traceID" "1"
"spanID" "4"}]
"tags" [{"key" "span.kind"
"type" "string"
"value" "consumer"}
{"key" "message_bus.destination"
"type" "string"
"value" "PROCESS_ORDER"}]}]
Expand All @@ -97,6 +112,10 @@
{"id" "3"
"start_time" 1500000000200
"duration_ms" 100
"lifeline" "orders"}
{"id" "5"
"start_time" 1500000000350
"duration_ms" 50
"lifeline" "orders"}]
"arrows" [{"id" "2"
"from" "bff"
Expand Down