Skip to content

Instantly share code, notes, and snippets.

View Kyle-Verhoog's full-sized avatar
🦺

kyle Kyle-Verhoog

🦺
View GitHub Profile
@Kyle-Verhoog
Kyle-Verhoog / repro
Last active December 8, 2021 21:52
wrapt py3.10 warning repro
#!/bin/bash
pip install wrapt
python3.10 -Wall repro.py
@Kyle-Verhoog
Kyle-Verhoog / py27
Last active November 13, 2020 23:43
span tag optimization
============================================================================================ test session starts =============================================================================================
platform linux2 -- Python 2.7.15, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
benchmark: 3.2.3 (defaults: timer=time.time disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/kyle/dev/dd-trace-py, inifile: tox.ini
plugins: benchmark-3.2.3
collected 2 items
tests/benchmark.py .. [100%]
import pytest
import ddtrace
import random
from ddtrace.vendor.six.moves.queue import Queue, Full, Empty
from ddtrace.internal._queue import TraceQueue
# Old queue
class Q(Queue):
"""
@Kyle-Verhoog
Kyle-Verhoog / patch
Last active June 19, 2020 16:39
runtime benchmarks
diff --git a/ddtrace/api.py b/ddtrace/api.py
index 26891f5c..e3d64885 100644
--- a/ddtrace/api.py
+++ b/ddtrace/api.py
@@ -58,6 +58,7 @@ class Response(object):
:rtype: ``Response``
:returns: A new ``Response``
"""
+ assert resp.status == 200
return cls(
@Kyle-Verhoog
Kyle-Verhoog / benchmarks.py
Created May 29, 2020 04:12
ddtrace fork checking investigation
@pytest.mark.benchmark(group="start_span", min_time=0.005)
def test_tracer_start_span(benchmark, tracer):
benchmark(tracer.start_span, "benchmark")
@pytest.mark.benchmark(group="start_span", min_time=0.005)
def test_tracer_start_span_no_process_check(benchmark, tracer):
benchmark(tracer.start_span2, "benchmark")
@Kyle-Verhoog
Kyle-Verhoog / cython.py
Created May 19, 2020 16:13
cython dynamic building
import pyximport; pyximport.install()
Traceback (most recent call last):
File "/Users/kyle.verhoog/.pyenv/versions/3.6.10/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "_test.py", line 48, in run
PERIODIC_THREAD_IDS.remove(self.ident)
KeyError: 123145450659840
Traceback (most recent call last):
File "_test.py", line 173, in <module>
test()
@Kyle-Verhoog
Kyle-Verhoog / ranq2.py
Created April 23, 2020 04:46
ranq2 python implementation from Numeric Recipes
def ranq2():
"""Generator for pseudorandom 64-bit integers.
This algorithm is from Numeric Recipes Chapter 7 (Ranq2).
"""
j = compat.getrandbits(64)
v = 4101842887655102017
w = 1
v ^= j
diff --git a/tracers/sanic_opentracer.py b/tracers/sanic_opentracer.py
index ab42f5a..2eecdce 100644
--- a/tracers/sanic_opentracer.py
+++ b/tracers/sanic_opentracer.py
@@ -16,6 +16,7 @@ def init_tracer(app_name, agent_hostname, agent_port):
scope_manager=ContextVarsScopeManager(),
)
set_global_tracer(tracer)
+
return tracer
@Kyle-Verhoog
Kyle-Verhoog / officequotes.txt
Last active April 12, 2020 18:24
office quotes
why waste time say lot word when few word do trick?
my mind is going a mile an hour
How do I feel about losing the sale? It's like if Michael Phelps, came out of retirement, jumped in the pool, bellyflopped and drowned.
I decided to stay home, eat a bunch of tacos in my basement. Now my basement smells like tacos. You can't air out a basement. And taco air is heavy. It settles at the lowest point.