Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pump, Cedric
lab-tracing
Commits
72d2dc8d
Commit
72d2dc8d
authored
Dec 27, 2020
by
Nane Kratzke
Browse files
inject span
parent
fcc4d3db
Changes
1
Hide whitespace changes
Inline
Side-by-side
hiphop/service.py
View file @
72d2dc8d
...
@@ -2,6 +2,7 @@ from flask import Flask, redirect, request
...
@@ -2,6 +2,7 @@ from flask import Flask, redirect, request
from
jaeger_client
import
Config
from
jaeger_client
import
Config
from
flask_opentracing
import
FlaskTracer
#, FlaskTracing
from
flask_opentracing
import
FlaskTracer
#, FlaskTracing
import
opentracing
import
opentracing
from
opentracing.propagation
import
Format
import
requests
import
requests
import
traceback
import
traceback
import
os
import
os
...
@@ -38,7 +39,9 @@ def hip():
...
@@ -38,7 +39,9 @@ def hip():
with
opentracing
.
tracer
.
start_span
(
operation_name
=
url
,
child_of
=
parent_span
)
as
span
:
with
opentracing
.
tracer
.
start_span
(
operation_name
=
url
,
child_of
=
parent_span
)
as
span
:
print
(
f
"
{
span
}
"
)
print
(
f
"
{
span
}
"
)
span
.
set_tag
(
"http.url"
,
url
)
span
.
set_tag
(
"http.url"
,
url
)
r
=
requests
.
get
(
url
)
headers
=
dict
(
request
.
headers
)
tracer
.
inject
(
span
,
Format
.
HTTP_HEADERS
,
headers
)
r
=
requests
.
get
(
url
,
headers
=
headers
)
span
.
set_tag
(
"http.status_code"
,
r
.
status_code
)
span
.
set_tag
(
"http.status_code"
,
r
.
status_code
)
print
(
r
)
print
(
r
)
r
=
r
.
content
.
decode
(
'utf-8'
)
r
=
r
.
content
.
decode
(
'utf-8'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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