mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Stress test: ability to use multiple dsns (projects)
This commit is contained in:
@@ -204,6 +204,7 @@ def evict_for_max_events(project, timestamp, stored_event_count=None, include_ne
|
||||
|
||||
if max_total_irrelevance < -1: # < -1: as in `evict_for_irrelevance`
|
||||
if not include_never_evict:
|
||||
# everything that remains is 'never_evict'. 'never say never' and evict those as a last measure
|
||||
return evict_for_max_events(project, timestamp, stored_event_count - evicted, True)
|
||||
|
||||
raise Exception("No more effective eviction possible but target not reached") # "should not happen"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import random
|
||||
import io
|
||||
import uuid
|
||||
import brotli
|
||||
@@ -19,7 +20,7 @@ class Command(BaseCommand):
|
||||
parser.add_argument("--threads", type=int, default=1)
|
||||
parser.add_argument("--requests", type=int, default=1)
|
||||
|
||||
parser.add_argument("--dsn")
|
||||
parser.add_argument("--dsn", nargs="+", action="extend")
|
||||
parser.add_argument("--fresh-id", action="store_true")
|
||||
parser.add_argument("--fresh-timestamp", action="store_true")
|
||||
parser.add_argument("--compress", action="store", choices=["gzip", "deflate", "br"], default=None)
|
||||
@@ -35,7 +36,7 @@ class Command(BaseCommand):
|
||||
# usually not what we want to do our stress-tests for. (if this assumption is still true later in 2024, we can
|
||||
# just remove the non-envelope mode support completely.)
|
||||
assert use_envelope, "Only envelope mode is supported"
|
||||
dsn = options['dsn']
|
||||
dsns = options['dsn']
|
||||
|
||||
json_filename = options["filename"]
|
||||
with open(json_filename) as f:
|
||||
@@ -56,7 +57,7 @@ class Command(BaseCommand):
|
||||
t0 = time.time()
|
||||
for i in range(options["threads"]):
|
||||
t = threading.Thread(target=self.loop_send_to_server, args=(
|
||||
dsn, options, use_envelope, compress, prepared_data[i], timings[i]))
|
||||
dsns, options, use_envelope, compress, prepared_data[i], timings[i]))
|
||||
t.start()
|
||||
|
||||
print("waiting for threads to finish")
|
||||
@@ -107,8 +108,10 @@ class Command(BaseCommand):
|
||||
return compressed_data
|
||||
|
||||
@staticmethod
|
||||
def loop_send_to_server(dsn, options, use_envelope, compress, compressed_datas, timings):
|
||||
def loop_send_to_server(dsns, options, use_envelope, compress, compressed_datas, timings):
|
||||
for compressed_data in compressed_datas.values():
|
||||
dsn = random.choice(dsns)
|
||||
|
||||
t0 = time.time()
|
||||
Command.send_to_server(dsn, options, use_envelope, compress, compressed_data)
|
||||
taken = time.time() - t0
|
||||
|
||||
Reference in New Issue
Block a user