open-telemetry / open-telemetry/opentelemetry-php
[opentelemetry-php-contrib] auto-laravel crashes when using mongodb models / query builders
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 912
- Forks
- 232
- Avg merge
- 7d 16h
- Merged PRs (30d)
- 4
Description
Is your feature request related to a problem?
Because mongodb models don't support ->toSql(), the getModels() hook fails when installed on a project using mongodb models. Instead, the builder exposes a ->toMql() method that returns an array that defines the mongo query being issued.
Describe the solution you'd like
Ideally the db.statement would be a json_encode() of the result of ->toMql(), instead of outright crashing.
Describe alternatives you've considered
We've added a custom patch in our projects to add support for this but would be nice if the package worked with it out of the box
Additional context
Tried to send a PR myself, but sorting the CLA agreement would take too many of my working hours to be justifiable
https://github.com/open-telemetry/opentelemetry-php-contrib/pull/688
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the auto-Laravel instrumentation around the getModels() hook and inspect how it currently calls toSql(). Compare the MongoDB builder's toMql() result and check the existing PR context. Done means MongoDB models no longer crash and db.statement represents the query as JSON; verify with the relevant instrumentation tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- laravel, mongodb, php
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100