Skip to content
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

✨ instrument (opentelemetry) httpx clients #6715

Merged

Conversation

bisgaard-itis
Copy link
Contributor

@bisgaard-itis bisgaard-itis commented Nov 13, 2024

What do these changes do?

import httpx
client = httpx.AsyncClient()

produces an instrumented client whereas

from httpx import AsyncClient
client = AsyncClient()

doesn't. Essentially they are mocking the httpx clients. I prefer passing objects around to using black magic.

  • One advantage of this approach is that all httpx clients pass through a single fcn so if in the future we want to customize instrumentation and how they handle tracing this should be rather easy.

Related issue/s

How to test

Dev-ops checklist

@bisgaard-itis bisgaard-itis self-assigned this Nov 13, 2024
@bisgaard-itis bisgaard-itis added the t:maintenance Some planned maintenance work label Nov 13, 2024
@bisgaard-itis bisgaard-itis added this to the Event Horizon milestone Nov 13, 2024
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.31%. Comparing base (a4b7c7a) to head (ec9c254).
Report is 1 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (a4b7c7a) and HEAD (ec9c254). Click for more details.

HEAD has 30 uploads less than BASE
Flag BASE (a4b7c7a) HEAD (ec9c254)
unittests 31 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6715       +/-   ##
===========================================
- Coverage   87.74%   65.31%   -22.43%     
===========================================
  Files        1571      638      -933     
  Lines       63215    31554    -31661     
  Branches     2117      265     -1852     
===========================================
- Hits        55465    20611    -34854     
- Misses       7425    10882     +3457     
+ Partials      325       61      -264     
Flag Coverage Δ *Carryforward flag
integrationtests 64.82% <ø> (-0.01%) ⬇️ Carriedforward from a4b7c7a
unittests 94.05% <ø> (+8.35%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library ∅ <ø> (∅)
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration ∅ <ø> (∅)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 77.44% <ø> (-7.84%) ⬇️
agent ∅ <ø> (∅)
api_server ∅ <ø> (∅)
autoscaling ∅ <ø> (∅)
catalog ∅ <ø> (∅)
clusters_keeper ∅ <ø> (∅)
dask_sidecar ∅ <ø> (∅)
datcore_adapter 94.05% <ø> (ø)
director ∅ <ø> (∅)
director_v2 76.31% <ø> (-14.52%) ⬇️
dynamic_scheduler ∅ <ø> (∅)
dynamic_sidecar 59.72% <ø> (-30.07%) ⬇️
efs_guardian ∅ <ø> (∅)
invitations ∅ <ø> (∅)
osparc_gateway_server 79.68% <ø> (-5.73%) ⬇️
payments ∅ <ø> (∅)
resource_usage_tracker ∅ <ø> (∅)
storage ∅ <ø> (∅)
webclient ∅ <ø> (∅)
webserver 59.79% <ø> (-28.92%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4b7c7a...ec9c254. Read the comment docs.

@bisgaard-itis bisgaard-itis marked this pull request as ready for review November 13, 2024 13:05
Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting one.. :D

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice! thanks

@mrnicegyu11
Copy link
Member

very nice thanks a lot, all good!

Copy link
Member

@mrnicegyu11 mrnicegyu11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good I see no issues, thx!

@bisgaard-itis bisgaard-itis merged commit a44de5c into ITISFoundation:master Nov 14, 2024
84 of 89 checks passed
@bisgaard-itis bisgaard-itis deleted the 6704-instrument-httpx-clients branch November 14, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:maintenance Some planned maintenance work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opentelemetry instrument httpx clients to ensure traces also "propagate" through them
6 participants