Skip to content

Commit c2b7fe1

Browse files
committed
fix python test, do not use og cloud
1 parent 39515b8 commit c2b7fe1

File tree

1 file changed

+6
-6
lines changed
  • pyroscope_ffi/python/scripts/tests

1 file changed

+6
-6
lines changed

pyroscope_ffi/python/scripts/tests/test.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
import threading
1313

1414
import uuid
15+
from urllib.parse import quote
1516

1617
try:
1718
from urllib.request import Request, urlopen
1819
except ImportError:
1920
from urllib2 import Request, urlopen
2021

21-
token = os.getenv("PYROSCOPE_API_TOKEN")
22+
2223
app_name = 'pyroscopers.python.test'
2324
logger = logging.getLogger()
2425

@@ -53,18 +54,18 @@ def multihash2(string):
5354
def wait_render(canary):
5455
while True:
5556
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)
5859
response = None
5960
try:
6061
logging.info('render %s', u)
6162
req = Request(u)
62-
req.add_header('Authorization', 'Bearer {}'.format(token))
6363
response = urlopen(req)
6464
code = response.getcode()
6565
body = response.read()
6666
logging.info("render body %s", body.decode('utf-8'))
6767
if code == 200 and body != b'' and b'multihash' in body:
68+
print(f'good {canary}')
6869
return
6970
except Exception:
7071
if response is not None:
@@ -80,8 +81,7 @@ def do_one_test(on_cpu, gil_only, detect_subprocesses):
8081
runid = os.getenv("PYROSCOPE_RUN_ID")
8182
pyroscope.configure(
8283
application_name=app_name,
83-
server_address="https://ingest.pyroscope.cloud",
84-
auth_token='{}'.format(token),
84+
server_address="http://localhost:4040",
8585
enable_logging=True,
8686
detect_subprocesses=detect_subprocesses,
8787
oncpu=on_cpu,

0 commit comments

Comments
 (0)