elixir-ecto / myxql

MySQL 5.5+ driver for Elixir
Apache License 2.0
273 stars 67 forks source link

Telemetry support #179

Closed yoonwaiyan closed 6 months ago

yoonwaiyan commented 6 months ago

Hi, does myxql support telemetry out of the box? I've been trying to add Datadog APM to my project which currently uses MyXQL adapter but it doesn't receive any instrumentation from Ecto. Docs from ecto: https://hexdocs.pm/ecto/Ecto.Repo.html#module-adapter-specific-events, specifically this:

Below we list all events developers should expect from Ecto. All examples below consider a repository named MyApp.Repo:

[:my_app, :repo, :query] This event should be invoked on every query sent to the adapter, including queries that are related to the transaction management.

From here I'm expecting MyXQL as an adapter to fire out the telemetry [:my_app, :repo, :query] event which will be handled by spandex_ecto and send the log to Datadog, but I don't see any telemetry events being fired here within the adapter.

Am I in the correct place to request for MyXQL to support telemetry? If not, can you point me out if there's already an existing telemetry being fired somewhere along a phoenix app?

josevalim commented 6 months ago

Yes, MyXQL will fire the event above (because it is fired by Ecto, not MyXQL). You should investigate spandex_ecto and explore why the event is not consumed. :)

yoonwaiyan commented 6 months ago

@josevalim thanks for the info, I managed to resolve the issue. The documentation was confusing which I thought each ecto adapter (in this case, MyXQL) needs to know how to fire the events.