12
12
import threading
13
13
14
14
import uuid
15
+ from urllib .parse import quote
15
16
16
17
try :
17
18
from urllib .request import Request , urlopen
18
19
except ImportError :
19
20
from urllib2 import Request , urlopen
20
21
21
- token = os . getenv ( "PYROSCOPE_API_TOKEN" )
22
+
22
23
app_name = 'pyroscopers.python.test'
23
24
logger = logging .getLogger ()
24
25
@@ -53,18 +54,18 @@ def multihash2(string):
53
54
def wait_render (canary ):
54
55
while True :
55
56
time .sleep (2 )
56
- u = 'https://pyroscope.cloud/render?from=now-1h&until=now&format=collapsed&query=' \
57
- + '{}.cpu%7Bcanary%3D%22{}%22%7D' . format ( app_name , canary )
57
+ query = f'process_cpu:cpu:nanoseconds:cpu:nanoseconds{{service_name="pyroscopers.python.test", canary=" { canary } "}}'
58
+ u = 'http://localhost:4040/pyroscope/render?from=now-1h&until=now&&query=' + quote ( query )
58
59
response = None
59
60
try :
60
61
logging .info ('render %s' , u )
61
62
req = Request (u )
62
- req .add_header ('Authorization' , 'Bearer {}' .format (token ))
63
63
response = urlopen (req )
64
64
code = response .getcode ()
65
65
body = response .read ()
66
66
logging .info ("render body %s" , body .decode ('utf-8' ))
67
67
if code == 200 and body != b'' and b'multihash' in body :
68
+ print (f'good { canary } ' )
68
69
return
69
70
except Exception :
70
71
if response is not None :
@@ -80,8 +81,7 @@ def do_one_test(on_cpu, gil_only, detect_subprocesses):
80
81
runid = os .getenv ("PYROSCOPE_RUN_ID" )
81
82
pyroscope .configure (
82
83
application_name = app_name ,
83
- server_address = "https://ingest.pyroscope.cloud" ,
84
- auth_token = '{}' .format (token ),
84
+ server_address = "http://localhost:4040" ,
85
85
enable_logging = True ,
86
86
detect_subprocesses = detect_subprocesses ,
87
87
oncpu = on_cpu ,
0 commit comments