-
Notifications
You must be signed in to change notification settings - Fork 469
chore(httpx): revamp integration to follow repo standard #15522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
Bootstrap import analysisComparison of import times between this PR and base. SummaryThe average import time from this PR is: 250 ± 4 ms. The average import time from base is: 253 ± 3 ms. The import time difference between this PR and base is: -3.7 ± 0.2 ms. Import time breakdownThe following import paths have shrunk:
|
Performance SLOsComparing candidate dubloom/revamp-httpx (f7c8be6) with baseline main (874de50) 📈 Performance Regressions (3 suites)📈 iastaspects - 118/118✅ add_aspectTime: ✅ 0.403µs (SLO: <10.000µs 📉 -96.0%) vs baseline: +0.1% Memory: ✅ 40.560MB (SLO: <41.500MB -2.3%) vs baseline: +5.7% ✅ add_inplace_aspectTime: ✅ 0.406µs (SLO: <10.000µs 📉 -95.9%) vs baseline: -0.2% Memory: ✅ 40.305MB (SLO: <41.500MB -2.9%) vs baseline: +4.2% ✅ add_inplace_noaspectTime: ✅ 0.319µs (SLO: <10.000µs 📉 -96.8%) vs baseline: +1.1% Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +4.4% ✅ add_noaspectTime: ✅ 0.279µs (SLO: <10.000µs 📉 -97.2%) vs baseline: +0.5% Memory: ✅ 40.226MB (SLO: <41.500MB -3.1%) vs baseline: +4.4% ✅ bytearray_aspectTime: ✅ 1.351µs (SLO: <10.000µs 📉 -86.5%) vs baseline: -0.3% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +5.6% ✅ bytearray_extend_aspectTime: ✅ 1.490µs (SLO: <10.000µs 📉 -85.1%) vs baseline: -2.2% Memory: ✅ 40.324MB (SLO: <41.500MB -2.8%) vs baseline: +4.6% ✅ bytearray_extend_noaspectTime: ✅ 0.611µs (SLO: <10.000µs 📉 -93.9%) vs baseline: -1.0% Memory: ✅ 40.187MB (SLO: <41.500MB -3.2%) vs baseline: +4.4% ✅ bytearray_noaspectTime: ✅ 0.480µs (SLO: <10.000µs 📉 -95.2%) vs baseline: -1.1% Memory: ✅ 40.462MB (SLO: <41.500MB -2.5%) vs baseline: +4.5% ✅ bytes_aspectTime: ✅ 1.296µs (SLO: <10.000µs 📉 -87.0%) vs baseline: +1.4% Memory: ✅ 40.560MB (SLO: <41.500MB -2.3%) vs baseline: +5.8% ✅ bytes_noaspectTime: ✅ 0.493µs (SLO: <10.000µs 📉 -95.1%) vs baseline: ~same Memory: ✅ 40.580MB (SLO: <41.500MB -2.2%) vs baseline: +5.7% ✅ bytesio_aspectTime: ✅ 1.347µs (SLO: <10.000µs 📉 -86.5%) vs baseline: +1.8% Memory: ✅ 40.501MB (SLO: <41.500MB -2.4%) vs baseline: +5.5% ✅ bytesio_noaspectTime: ✅ 0.499µs (SLO: <10.000µs 📉 -95.0%) vs baseline: +0.2% Memory: ✅ 40.541MB (SLO: <41.500MB -2.3%) vs baseline: +5.8% ✅ capitalize_aspectTime: ✅ 0.736µs (SLO: <10.000µs 📉 -92.6%) vs baseline: +0.2% Memory: ✅ 40.069MB (SLO: <41.500MB -3.4%) vs baseline: +4.5% ✅ capitalize_noaspectTime: ✅ 0.440µs (SLO: <10.000µs 📉 -95.6%) vs baseline: +0.9% Memory: ✅ 40.403MB (SLO: <41.500MB -2.6%) vs baseline: +4.4% ✅ casefold_aspectTime: ✅ 0.740µs (SLO: <10.000µs 📉 -92.6%) vs baseline: +0.8% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +5.8% ✅ casefold_noaspectTime: ✅ 0.369µs (SLO: <10.000µs 📉 -96.3%) vs baseline: -0.3% Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +5.7% ✅ decode_aspectTime: ✅ 0.725µs (SLO: <10.000µs 📉 -92.7%) vs baseline: +0.6% Memory: ✅ 40.501MB (SLO: <41.500MB -2.4%) vs baseline: +4.6% ✅ decode_noaspectTime: ✅ 0.424µs (SLO: <10.000µs 📉 -95.8%) vs baseline: +0.3% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +5.7% ✅ encode_aspectTime: ✅ 0.706µs (SLO: <10.000µs 📉 -92.9%) vs baseline: -1.3% Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +4.6% ✅ encode_noaspectTime: ✅ 0.402µs (SLO: <10.000µs 📉 -96.0%) vs baseline: ~same Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +5.7% ✅ format_aspectTime: ✅ 3.416µs (SLO: <10.000µs 📉 -65.8%) vs baseline: -1.8% Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +4.5% ✅ format_map_aspectTime: ✅ 3.559µs (SLO: <10.000µs 📉 -64.4%) vs baseline: -0.8% Memory: ✅ 40.220MB (SLO: <41.500MB -3.1%) vs baseline: +4.7% ✅ format_map_noaspectTime: ✅ 0.773µs (SLO: <10.000µs 📉 -92.3%) vs baseline: +0.5% Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +4.5% ✅ format_noaspectTime: ✅ 0.594µs (SLO: <10.000µs 📉 -94.1%) vs baseline: +0.2% Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +5.1% ✅ index_aspectTime: ✅ 0.355µs (SLO: <10.000µs 📉 -96.5%) vs baseline: -0.2% Memory: ✅ 40.580MB (SLO: <41.500MB -2.2%) vs baseline: +5.6% ✅ index_noaspectTime: ✅ 0.281µs (SLO: <10.000µs 📉 -97.2%) vs baseline: +1.1% Memory: ✅ 40.442MB (SLO: <41.500MB -2.5%) vs baseline: +5.1% ✅ join_aspectTime: ✅ 1.328µs (SLO: <10.000µs 📉 -86.7%) vs baseline: ~same Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +5.3% ✅ join_noaspectTime: ✅ 0.488µs (SLO: <10.000µs 📉 -95.1%) vs baseline: -2.0% Memory: ✅ 40.206MB (SLO: <41.500MB -3.1%) vs baseline: +4.8% ✅ ljust_aspectTime: ✅ 2.904µs (SLO: <20.000µs 📉 -85.5%) vs baseline: 📈 +12.2% Memory: ✅ 40.462MB (SLO: <41.500MB -2.5%) vs baseline: +5.7% ✅ ljust_noaspectTime: ✅ 0.404µs (SLO: <10.000µs 📉 -96.0%) vs baseline: -1.3% Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +5.3% ✅ lower_aspectTime: ✅ 2.291µs (SLO: <10.000µs 📉 -77.1%) vs baseline: +3.1% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +5.3% ✅ lower_noaspectTime: ✅ 0.367µs (SLO: <10.000µs 📉 -96.3%) vs baseline: -0.8% Memory: ✅ 40.442MB (SLO: <41.500MB -2.5%) vs baseline: +5.5% ✅ lstrip_aspectTime: ✅ 2.264µs (SLO: <20.000µs 📉 -88.7%) vs baseline: +1.3% Memory: ✅ 40.659MB (SLO: <41.500MB -2.0%) vs baseline: +5.0% ✅ lstrip_noaspectTime: ✅ 0.379µs (SLO: <10.000µs 📉 -96.2%) vs baseline: -1.1% Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +5.4% ✅ modulo_aspectTime: ✅ 1.046µs (SLO: <10.000µs 📉 -89.5%) vs baseline: +5.5% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +4.8% ✅ modulo_aspect_for_bytearray_bytearrayTime: ✅ 1.550µs (SLO: <10.000µs 📉 -84.5%) vs baseline: -0.3% Memory: ✅ 40.311MB (SLO: <41.500MB -2.9%) vs baseline: +5.2% ✅ modulo_aspect_for_bytesTime: ✅ 0.978µs (SLO: <10.000µs 📉 -90.2%) vs baseline: -0.3% Memory: ✅ 40.423MB (SLO: <41.500MB -2.6%) vs baseline: +5.3% ✅ modulo_aspect_for_bytes_bytearrayTime: ✅ 1.245µs (SLO: <10.000µs 📉 -87.5%) vs baseline: +2.3% Memory: ✅ 40.678MB (SLO: <41.500MB 🟡 -2.0%) vs baseline: +6.2% ✅ modulo_noaspectTime: ✅ 0.630µs (SLO: <10.000µs 📉 -93.7%) vs baseline: -0.2% Memory: ✅ 40.541MB (SLO: <41.500MB -2.3%) vs baseline: +5.7% ✅ replace_aspectTime: ✅ 4.899µs (SLO: <10.000µs 📉 -51.0%) vs baseline: -0.6% Memory: ✅ 40.324MB (SLO: <41.500MB -2.8%) vs baseline: +5.0% ✅ replace_noaspectTime: ✅ 0.456µs (SLO: <10.000µs 📉 -95.4%) vs baseline: -1.2% Memory: ✅ 40.541MB (SLO: <41.500MB -2.3%) vs baseline: +5.8% ✅ repr_aspectTime: ✅ 0.904µs (SLO: <10.000µs 📉 -91.0%) vs baseline: -0.5% Memory: ✅ 40.501MB (SLO: <41.500MB -2.4%) vs baseline: +5.5% ✅ repr_noaspectTime: ✅ 0.415µs (SLO: <10.000µs 📉 -95.8%) vs baseline: ~same Memory: ✅ 40.167MB (SLO: <41.500MB -3.2%) vs baseline: +4.0% ✅ rstrip_aspectTime: ✅ 1.921µs (SLO: <20.000µs 📉 -90.4%) vs baseline: +0.2% Memory: ✅ 40.560MB (SLO: <41.500MB -2.3%) vs baseline: +4.9% ✅ rstrip_noaspectTime: ✅ 0.380µs (SLO: <10.000µs 📉 -96.2%) vs baseline: -0.3% Memory: ✅ 40.442MB (SLO: <41.500MB -2.5%) vs baseline: +5.6% ✅ slice_aspectTime: ✅ 0.494µs (SLO: <10.000µs 📉 -95.1%) vs baseline: -0.4% Memory: ✅ 40.639MB (SLO: <41.500MB -2.1%) vs baseline: +5.9% ✅ slice_noaspectTime: ✅ 0.451µs (SLO: <10.000µs 📉 -95.5%) vs baseline: +0.4% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +5.3% ✅ stringio_aspectTime: ✅ 1.536µs (SLO: <10.000µs 📉 -84.6%) vs baseline: -0.1% Memory: ✅ 40.619MB (SLO: <41.500MB -2.1%) vs baseline: +5.7% ✅ stringio_noaspectTime: ✅ 0.715µs (SLO: <10.000µs 📉 -92.8%) vs baseline: +0.5% Memory: ✅ 40.501MB (SLO: <41.500MB -2.4%) vs baseline: +5.3% ✅ strip_aspectTime: ✅ 2.225µs (SLO: <20.000µs 📉 -88.9%) vs baseline: -0.1% Memory: ✅ 40.637MB (SLO: <41.500MB -2.1%) vs baseline: +6.1% ✅ strip_noaspectTime: ✅ 0.387µs (SLO: <10.000µs 📉 -96.1%) vs baseline: +0.3% Memory: ✅ 40.600MB (SLO: <41.500MB -2.2%) vs baseline: +6.0% ✅ swapcase_aspectTime: ✅ 2.499µs (SLO: <10.000µs 📉 -75.0%) vs baseline: +1.7% Memory: ✅ 40.147MB (SLO: <41.500MB -3.3%) vs baseline: +4.6% ✅ swapcase_noaspectTime: ✅ 0.534µs (SLO: <10.000µs 📉 -94.7%) vs baseline: -0.9% Memory: ✅ 40.442MB (SLO: <41.500MB -2.5%) vs baseline: +5.5% ✅ title_aspectTime: ✅ 2.427µs (SLO: <10.000µs 📉 -75.7%) vs baseline: +2.5% Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +5.2% ✅ title_noaspectTime: ✅ 0.500µs (SLO: <10.000µs 📉 -95.0%) vs baseline: -1.2% Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +5.8% ✅ translate_aspectTime: ✅ 3.316µs (SLO: <10.000µs 📉 -66.8%) vs baseline: -0.9% Memory: ✅ 40.246MB (SLO: <41.500MB -3.0%) vs baseline: +4.7% ✅ translate_noaspectTime: ✅ 1.039µs (SLO: <10.000µs 📉 -89.6%) vs baseline: +0.1% Memory: ✅ 40.482MB (SLO: <41.500MB -2.5%) vs baseline: +4.6% ✅ upper_aspectTime: ✅ 2.324µs (SLO: <10.000µs 📉 -76.8%) vs baseline: +4.2% Memory: ✅ 40.521MB (SLO: <41.500MB -2.4%) vs baseline: +5.3% ✅ upper_noaspectTime: ✅ 0.370µs (SLO: <10.000µs 📉 -96.3%) vs baseline: +0.6% Memory: ✅ 40.462MB (SLO: <41.500MB -2.5%) vs baseline: +5.4% 📈 iastaspectsospath - 24/24✅ ospathbasename_aspectTime: ✅ 5.153µs (SLO: <10.000µs 📉 -48.5%) vs baseline: 📈 +24.1% Memory: ✅ 40.147MB (SLO: <41.000MB -2.1%) vs baseline: +4.6% ✅ ospathbasename_noaspectTime: ✅ 1.082µs (SLO: <10.000µs 📉 -89.2%) vs baseline: -0.2% Memory: ✅ 40.246MB (SLO: <41.000MB 🟡 -1.8%) vs baseline: +4.7% ✅ ospathjoin_aspectTime: ✅ 6.175µs (SLO: <10.000µs 📉 -38.2%) vs baseline: +1.2% Memory: ✅ 40.324MB (SLO: <41.000MB 🟡 -1.6%) vs baseline: +4.7% ✅ ospathjoin_noaspectTime: ✅ 2.281µs (SLO: <10.000µs 📉 -77.2%) vs baseline: ~same Memory: ✅ 40.324MB (SLO: <41.000MB 🟡 -1.6%) vs baseline: +5.0% ✅ ospathnormcase_aspectTime: ✅ 3.434µs (SLO: <10.000µs 📉 -65.7%) vs baseline: +0.9% Memory: ✅ 40.246MB (SLO: <41.000MB 🟡 -1.8%) vs baseline: +4.9% ✅ ospathnormcase_noaspectTime: ✅ 0.570µs (SLO: <10.000µs 📉 -94.3%) vs baseline: -0.6% Memory: ✅ 40.108MB (SLO: <41.000MB -2.2%) vs baseline: +4.3% ✅ ospathsplit_aspectTime: ✅ 4.711µs (SLO: <10.000µs 📉 -52.9%) vs baseline: -1.3% Memory: ✅ 40.167MB (SLO: <41.000MB -2.0%) vs baseline: +4.6% ✅ ospathsplit_noaspectTime: ✅ 1.593µs (SLO: <10.000µs 📉 -84.1%) vs baseline: +0.5% Memory: ✅ 40.265MB (SLO: <41.000MB 🟡 -1.8%) vs baseline: +4.9% ✅ ospathsplitdrive_aspectTime: ✅ 3.595µs (SLO: <10.000µs 📉 -64.1%) vs baseline: -2.2% Memory: ✅ 40.226MB (SLO: <41.000MB 🟡 -1.9%) vs baseline: +5.0% ✅ ospathsplitdrive_noaspectTime: ✅ 0.695µs (SLO: <10.000µs 📉 -93.1%) vs baseline: -0.7% Memory: ✅ 40.344MB (SLO: <41.000MB 🟡 -1.6%) vs baseline: +5.2% ✅ ospathsplitext_aspectTime: ✅ 4.494µs (SLO: <10.000µs 📉 -55.1%) vs baseline: -0.4% Memory: ✅ 40.128MB (SLO: <41.000MB -2.1%) vs baseline: +4.5% ✅ ospathsplitext_noaspectTime: ✅ 1.378µs (SLO: <10.000µs 📉 -86.2%) vs baseline: -0.5% Memory: ✅ 40.187MB (SLO: <41.000MB 🟡 -2.0%) vs baseline: +4.0% 📈 telemetryaddmetric - 30/30✅ 1-count-metric-1-timesTime: ✅ 3.396µs (SLO: <20.000µs 📉 -83.0%) vs baseline: 📈 +15.5% Memory: ✅ 34.760MB (SLO: <35.500MB -2.1%) vs baseline: +4.6% ✅ 1-count-metrics-100-timesTime: ✅ 199.588µs (SLO: <220.000µs -9.3%) vs baseline: -0.5% Memory: ✅ 34.760MB (SLO: <35.500MB -2.1%) vs baseline: +5.0% ✅ 1-distribution-metric-1-timesTime: ✅ 3.281µs (SLO: <20.000µs 📉 -83.6%) vs baseline: ~same Memory: ✅ 34.701MB (SLO: <35.500MB -2.2%) vs baseline: +4.7% ✅ 1-distribution-metrics-100-timesTime: ✅ 217.163µs (SLO: <230.000µs -5.6%) vs baseline: -0.3% Memory: ✅ 34.898MB (SLO: <35.500MB 🟡 -1.7%) vs baseline: +5.5% ✅ 1-gauge-metric-1-timesTime: ✅ 2.141µs (SLO: <20.000µs 📉 -89.3%) vs baseline: +0.1% Memory: ✅ 34.741MB (SLO: <35.500MB -2.1%) vs baseline: +4.8% ✅ 1-gauge-metrics-100-timesTime: ✅ 135.869µs (SLO: <150.000µs -9.4%) vs baseline: -0.7% Memory: ✅ 34.819MB (SLO: <35.500MB 🟡 -1.9%) vs baseline: +4.9% ✅ 1-rate-metric-1-timesTime: ✅ 3.067µs (SLO: <20.000µs 📉 -84.7%) vs baseline: +0.5% Memory: ✅ 34.800MB (SLO: <35.500MB 🟡 -2.0%) vs baseline: +4.9% ✅ 1-rate-metrics-100-timesTime: ✅ 213.522µs (SLO: <250.000µs 📉 -14.6%) vs baseline: -1.1% Memory: ✅ 34.819MB (SLO: <35.500MB 🟡 -1.9%) vs baseline: +4.5% ✅ 100-count-metrics-100-timesTime: ✅ 20.584ms (SLO: <22.000ms -6.4%) vs baseline: +0.4% Memory: ✅ 34.741MB (SLO: <35.500MB -2.1%) vs baseline: +4.7% ✅ 100-distribution-metrics-100-timesTime: ✅ 2.320ms (SLO: <2.550ms -9.0%) vs baseline: +1.3% Memory: ✅ 34.760MB (SLO: <35.500MB -2.1%) vs baseline: +4.8% ✅ 100-gauge-metrics-100-timesTime: ✅ 1.414ms (SLO: <1.550ms -8.8%) vs baseline: +0.9% Memory: ✅ 34.741MB (SLO: <35.500MB -2.1%) vs baseline: +4.7% ✅ 100-rate-metrics-100-timesTime: ✅ 2.219ms (SLO: <2.550ms 📉 -13.0%) vs baseline: ~same Memory: ✅ 34.741MB (SLO: <35.500MB -2.1%) vs baseline: +4.7% ✅ flush-1-metricTime: ✅ 4.572µs (SLO: <20.000µs 📉 -77.1%) vs baseline: -1.7% Memory: ✅ 34.977MB (SLO: <35.500MB 🟡 -1.5%) vs baseline: +4.6% ✅ flush-100-metricsTime: ✅ 174.380µs (SLO: <250.000µs 📉 -30.2%) vs baseline: -0.3% Memory: ✅ 35.212MB (SLO: <35.500MB 🟡 -0.8%) vs baseline: +4.9% ✅ flush-1000-metricsTime: ✅ 2.172ms (SLO: <2.500ms 📉 -13.1%) vs baseline: -0.3% Memory: ✅ 35.979MB (SLO: <36.500MB 🟡 -1.4%) vs baseline: +4.6% 🟡 Near SLO Breach (16 suites)🟡 coreapiscenario - 10/10 (1 unstable)
|
a7ae8ef to
05a8505
Compare
05a8505 to
f7c8be6
Compare
| To configure particular ``httpx`` client instances use the :class:`Pin <ddtrace.trace.Pin>` API:: | ||
| import httpx | ||
| from ddtrace._trace.pin import Pin | ||
| client = httpx.Client() | ||
| # Override service name for this instance | ||
| Pin.override(client, service="custom-http-service") | ||
| async_client = httpx.AsyncClient( | ||
| # Override service name for this instance | ||
| Pin.override(async_client, service="custom-async-http-service") | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a new way to do this or have we lost this feature altogether? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question, @brettlangdon @emmettbutler, do you know if we want to completely remove Pin from our integrations or we want to remove it only from the tracer retrieval part ?
Thanks in advance !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know if we want to completely remove Pin from our integrations
The public API for Pin is fully deprecated, if someone tries to use it they will get a warning in 3.x and the imports will fail in 4.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, also, we 100% want to remove every single trace of Pin from our entire codebase, not just from the public API/usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean we're removing functionality from ddtrace? It seems like users would previously have been able to set custom tags which they now can't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are lots of environment variables that can be used to set service names instead of doing so in code. DD_SERVICE, DD_SERVICE_MAPPING, DD_PEER_SERVICE_MAPPING, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay – I guess since this is standard it makes sense then to remove the help info from the docstring?
|
|
||
| def _get_service_name(pin, request): | ||
| # type: (Pin, httpx.Request) -> typing.Text | ||
| def _get_service_name(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we've lost the type hint here – can you add it back?
brettlangdon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor nits, but overall lgtm
|
|
||
| def _on_httpx_send(ctx, request): | ||
| span = ctx.span | ||
| span.set_metric(_SPAN_MEASURED_KEY, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| span.set_metric(_SPAN_MEASURED_KEY, 1) | |
| span._metrics[_SPAN_MEASURED_KEY] = 1 |
more performant
| span.link_span(context) | ||
|
|
||
|
|
||
| def _on_httpx_send(ctx, request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should at least type the ctx, and -> None:
| HTTPPropagator.inject(span.context, request.headers) | ||
|
|
||
|
|
||
| def _on_httpx_send_completed(ctx, request, response, url): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here re: typing
| service=_get_service_name(req), | ||
| tags=http_request_tags(), | ||
| ) as ctx: | ||
| core.dispatch("httpx.send", (ctx, req)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we want to avoid the extra dispatch call here, you could just pass req as an attribute into the context_with_data("httpx.request", ...) call.
then we will want to not use the generic start span handler, but at least we'd avoid triggering 2 events for this. unless we think we want to use httpx.send for something else?
| service=_get_service_name(req), | ||
| tags=http_request_tags(), | ||
| ) as ctx: | ||
| core.dispatch("httpx.send", (ctx, req)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
|
|
||
|
|
||
| @pytest.mark.snapshot(ignores=["meta.http.useragent"]) | ||
| def test_httpx_service_name(tracer, test_spans): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def test_httpx_service_name(tracer, test_spans): | |
| def test_httpx_service_name(): |
During my R&D week, I took httpx as an example.
Therefore, I took advantage of it to revamp httpx.
This PR brings httpx integration up to dd-trace-py standard: