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

Unable to detect request time when using ofetch or composables derive from it #42

Open
artmizu opened this issue May 13, 2024 · 6 comments

Comments

@artmizu
Copy link
Owner

artmizu commented May 13, 2024

Due to this issue in ofetch package @artmizu/nuxt-prometheus cannot detect network requests which take place through useFetch or $fetch, because they both use ofetch inside. So on the /metrics page, you don't see any request time related to ofetch.

I've already tried:

  1. Used different Nuxt hooks, for redefinition of global fetch. I'd try to do it before ofetch actually did it, but ofetch always did it first
  2. Tried different lifehacks around nuxt context to pass request information through functions and so on. In the end, it produced memory leaks or just didn't work.
  3. Try to reverse engineering ofetch to figure out the way how to overcome the issue, but for now don't see any outer way to modify its behavior, all variable is hidden inside closures, and so on

Maybe someone has an idea of how to overcome the issue? Or we'll just wait for updates from ofetch

@Gonzo17
Copy link

Gonzo17 commented Sep 1, 2024

Nice, I've just seen that the ofetch will be patched with the next release, so this issue will likely be solved as well. :) Since I want to use this module in my new project, I can offer you to help if needed.

@artmizu
Copy link
Owner Author

artmizu commented Sep 1, 2024

@Gonzo17 yeah, it's nice. I will send the update as soon as ofetch team publishes their own. So stay tuned :)

@ennc0d3
Copy link

ennc0d3 commented Nov 7, 2024

Any idea when this will be available? Thanks

@artmizu
Copy link
Owner Author

artmizu commented Nov 7, 2024

Any idea when this will be available? Thanks

hi. will try to check this weekend, ofetch update is already available so hope it will work

@Rigo-m
Copy link

Rigo-m commented Nov 11, 2024

Let us know <3

@artmizu
Copy link
Owner Author

artmizu commented Nov 12, 2024

Let us know <3

i tested the last version of nuxt in the context of compatibility with the @mswjs/interceptors package. requests through direct ofetch methods work fine and i can measure the duration, but if ofetch is wrapped in nuxt useFetch mswjs interceptors doesn't work, so right now trying to figure out why, through digging inside nuxt source code

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

No branches or pull requests

4 participants