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

feat: first pass at d1 support #83

Merged
merged 5 commits into from
Sep 16, 2024

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Jan 28, 2024

This provides a first pass implementation of D1 support, I'll do some testing and tweaking tomorrow

A few notes:

  • Instrumenting .batch() requires peaking into D1 internals
    • Not 100% sure if & how we should record sub-queries in a batch as spans
  • D1 isn't replicated right now, so there's a huge divergence between reported duration (which is essentially CPU time in the compute note processing the query) and true wall clock time experienced by the worker.
  • Not sure about leaking through the api names (i.e:first, all, ...) instead of grouping them under query/exec
  • Going off https://github.com/cloudflare/workerd/blob/main/src/cloudflare/internal/d1-api.ts, we could likely just wrap _send but that's abstraction breaking, so I instead stuck to the publicly exposed TS APIs

Example

Here's some traces generated by this PR in an otel viewer:

image

@evanderkoogh
Copy link
Owner

I am so sorry it took 8 months to get this PR merged.. I have had to set away from maintaining the library for more than a year due to family circumstances and while Jacob and Dani did a great job in keeping things going in the meantime they might not have felt comfortable merging this PR.

Thanks again for the PR. I (and a bunch of people who have asked for D1 support) greatly appreciate it!

@evanderkoogh evanderkoogh merged commit aa45bbf into evanderkoogh:main Sep 16, 2024
1 check passed
@AaronO
Copy link
Contributor Author

AaronO commented Sep 16, 2024

@evanderkoogh No problem, life happens, been in a similar boat, hope things are better !

I think there were a few other things I wanted to instrument when I did this a while back, I'll take another look, wasn't 100% sure if this lib was still being developed.

@AaronO AaronO deleted the feat/d1-support branch September 16, 2024 07:01
@evanderkoogh
Copy link
Owner

Well it was in hiatus mode with some people looking to make sure it kept running, but without the time to really develop it. But I am back in business and this is now part of my job at Honeycomb, so will have a lot more time for it..

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.

2 participants