Out-of-process OpenTelemetry autoinstrumentation
Problem
I need to modify my application that uses Prisma to enable OpenTelemetry instrumentation. I want to enable traces without modifying the application's source code. I want to do that so it's integrated well with the industry and OpenTelemetry. This should work with existing driver that Prisma uses and with other drivers that Prisma will support in the future.
Suggested solution
Support for autoinstrumentation with out-of-process configuration from OpenTelemetry. See this link
Autoinstrumentation enables turning open telemetry on by installing a couple of OTel libraries and setting some environment variables. This way users can enable instrumentation without modifying their application code at all. This works great for many libraries including pg (Postgres driver), Sequelize or web servers. See the list
Alternatives
Adding a configuration file to the project (like .env file) could also be a viable solution.
Additional context
This way users would be able to enable OpenTelemetry with no application code changes, and could use tools like Metis out of the box. I could just set some environment variables and point application with Prisma to send traces to Metis's docker running on the side.
The way I understand OpenTelemetry auto-instrumentaion (and correct me if I am wrong about that): @opentelemetry/auto-instrumentations-node package is managed by OTEL team and it consists of a fixed list of pre-packaged @opentelemetry/instrumentation-* packages, that are all activated on startup.
If that's the case, I feel like the request to include @prisma/instrumentation on that list belongs to OTEL project, rather than us. At the same time, i don't see any third-party instrumentations on pre-packaged list, so not sure if that's even an option.
You'd need to implement a project that would enable autoinstrumentation and then raise a pull request for OTel to integrate it with them.
Hey there. Any update in here? Did you have a chance to put this on your roadmap?