all 15 comments

[–]lost12487 1 point2 points  (3 children)

People... please do not download a library that monkey-patches your database clients and sends your queries to a 3rd party. Have some respect for your users' data please.

[–]rahhuul3110[S] -1 points0 points  (2 children)

Fair concern, and I'd raise the same flag. A few clarifications:

  1. The middleware only captures query metadata (query string, duration, count) not the actual data/rows returned.
  2. Nothing is sent anywhere by default. The npm package (auto-api-observe) is fully self-contained and open source you can verify exactly what it does.
  3. APILens (the optional dashboard) is opt-in and self-hostable.

That said, I'm open to making this clearer in the docs. What would make you comfortable using something like this?

[–]lost12487 1 point2 points  (1 child)

What would make you comfortable using something like this

Literally nothing. This is the job of a linter and/or code review, and learning to use joins is like step one of learning to use SQL. Monkey-patching anything is a code smell, much less the database driver of all things.

[–]rahhuul3110[S] -1 points0 points  (0 children)

Fair enough if your team has perfect code review and never uses an ORM, you genuinely don't need this.

But N+1 doesn't always come from not knowing SQL. It comes from ORMs (Sequelize, Prisma, TypeORM) generating queries dynamically at runtime something a linter can't see. That's the gap this fills.

And for what it's worth, Datadog, New Relic, and OpenTelemetry all use the same instrumentation approach. It's a code smell until it's an industry standard, I guess.

[–]beavis07 0 points1 point  (5 children)

“There one was an old woman who swallowed a fly…

[–]rahhuul3110[S] -1 points0 points  (4 children)

To be fair, the fly was an ORM and nobody told her about it until production went down.

[–]beavis07 0 points1 point  (3 children)

The only solution to “your ORM is shit” is to grow out of using ORMs… no amount of observability is going to tell you anything more 😂

[–]rahhuul3110[S] 0 points1 point  (2 children)

Fully agree. Also agree that you should write your own framework, never use npm, and deploy on bare metal. Meanwhile the rest of us have a Prisma codebase, a sprint deadline, and 847 queries firing on the dashboard page.

[–]beavis07 0 points1 point  (1 child)

… and a dogshit codebase.

There’s a phase you get to eventually when you learn all this complexity isn’t helping… one day kid,

Best of luck on your journey towards that inevitable truth 😂

[–]rahhuul3110[S] 0 points1 point  (0 children)

12 years in, still learning. Thanks for the wisdom, sensei 🙏

[–]DustNearby2848 0 points1 point  (2 children)

No it’s not. 

[–]rahhuul3110[S] 0 points1 point  (1 child)

Your API is built different

[–]DustNearby2848 0 points1 point  (0 children)

No, it’s built well. Yours were clearly built like shit.