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

http-client instrumentation using hooks #144

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kakkun61
Copy link
Collaborator

@kakkun61 kakkun61 commented Aug 9, 2024

What

  • to use managerModifyRequest and managerModifyResponse to implement this instrumentation
    • instead of wrapping original http-client's Manager

Why

  • a lot of wrapping and unwrapping are necessary because the wrapper type is different from the original one of course when using http-client instrumentation

How

  • ManagerSetting provides hooks for requests and responses
  • to call createSpan in a hook for a request and to call endSpan in a hook for a response
  • ThreadLocalStorage is used to transport span data created in a hook for a request to a hook for a response

Note

Cachix @sandydoo seems to implement a similar instrumentation.

https://github.com/cachix/hs-opentelemetry-instrumentation-http-client/

This PR includes diffs of #142.

@kakkun61 kakkun61 self-assigned this Aug 9, 2024
@kakkun61 kakkun61 changed the title Use managerModifyRequest and managerModifyResponse to implement this instrumentation http-client instrumentation using hooks Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant