Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pump, Cedric
lab-tracing
Commits
90b089bd
Commit
90b089bd
authored
Dec 27, 2020
by
Nane Kratzke
Browse files
tweaking span creation
parent
72d2dc8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
hiphop/service.py
View file @
90b089bd
...
...
@@ -33,7 +33,7 @@ def hip():
print
(
request
.
headers
)
r
=
""
try
:
parent_span
=
tracer
.
get_span
(
request
)
if
"X-B3-Traceid"
in
request
.
headers
else
tracer
.
get_span
()
parent_span
=
tracer
.
extract
(
Format
.
HTTP_HEADERS
,
request
.
headers
)
if
tier
>
1
else
tracer
.
get_span
()
print
(
f
"
{
parent_span
}
"
)
url
=
f
"http://
{
service
}
-
{
tier
+
1
}
/hip"
with
opentracing
.
tracer
.
start_span
(
operation_name
=
url
,
child_of
=
parent_span
)
as
span
:
...
...
@@ -41,6 +41,7 @@ def hip():
span
.
set_tag
(
"http.url"
,
url
)
headers
=
dict
(
request
.
headers
)
tracer
.
inject
(
span
,
Format
.
HTTP_HEADERS
,
headers
)
print
(
f
"tracer injected headers:
{
headers
}
"
)
r
=
requests
.
get
(
url
,
headers
=
headers
)
span
.
set_tag
(
"http.status_code"
,
r
.
status_code
)
print
(
r
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment