Skip to content

Commit 48e280f

Browse files
committed
fix: add safeguard for string splitting; Fixes #42
1 parent d2d642a commit 48e280f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

technology_specific_extractors/zipkin/zip_entry.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ def detect_zipkin_server(microservices: dict, information_flows: dict, iterative
8686
microservices[correct_id]["tagged_values"] =[("Tracing Server", "Zipkin")]
8787

8888
if not zipkin_server_exists and connections_exist:
89-
port = connections_exist.split("http:")[1].split(":")[1].strip("/").strip()
90-
try:
91-
id = max(microservices.keys()) + 1
92-
except:
93-
id = 0
94-
microservices[id] = dict()
95-
microservices[id]["name"] = "zipkin-server"
96-
microservices[id]["image"] = "placeholder_image"
97-
microservices[id]["properties"] = [("port", port, ("file", "line", "span"))]
98-
microservices[id]["stereotype_instances"] = ["tracing_server"]
99-
microservices[id]["tagged_values"] = [("Tracing Server", "Zipkin")]
89+
if "http:" in connections_exist:
90+
port = connections_exist.split("http:")[1]
91+
if ":" in port:
92+
port = port.split(":")[1].strip("/").strip()
93+
id_ = max(microservices.keys(), default=-1) + 1
94+
microservices[id_] = dict()
95+
microservices[id_]["name"] = "zipkin-server"
96+
microservices[id_]["image"] = "placeholder_image"
97+
microservices[id_]["properties"] = [("port", port, ("file", "line", "span"))]
98+
microservices[id_]["stereotype_instances"] = ["tracing_server"]
99+
microservices[id_]["tagged_values"] = [("Tracing Server", "Zipkin")]
100100

101101

102102
if not iterative:

0 commit comments

Comments
 (0)