2021-10-08 21:38:18 +00:00
# OpentelemetryEcto
2024-04-11 15:37:07 +00:00
Telemetry handler that creates OpenTelemetry spans from Ecto query events. Because
2021-10-08 21:38:18 +00:00
Ecto emits telemetry events only after queries have finished, OpentelemetryEcto
estimates the start time of the span by subtracting the reported total duration
from the current timestamp.
2024-04-11 15:37:07 +00:00
After installing, set up the handler in your application's `start/2` callback before your
top-level supervisor starts, passing the Telemetry prefix of the Ecto repo you want to instrument.
2021-10-08 21:38:18 +00:00
```elixir
OpentelemetryEcto.setup([:blog, :repo])
```
2024-04-11 15:37:07 +00:00
See [the documentation for `OpentelemetryEcto.setup/2` ](https://hexdocs.pm/opentelemetry_ecto/OpentelemetryEcto.html#setup/2 ) for additional options that
2021-10-08 21:38:18 +00:00
may be supplied.
## Installation
2024-04-11 15:37:07 +00:00
Add the package to your list of dependencies in `mix.exs` :
2021-10-08 21:38:18 +00:00
```elixir
def deps do
[
2022-06-03 16:54:37 +00:00
{:opentelemetry_ecto, "~> 1.0"}
2021-10-08 21:38:18 +00:00
]
end
```
## Compatibility Matrix
2024-04-11 15:37:07 +00:00
| OpentelemetryEcto Version | OTel Version | Notes |
2021-10-08 21:38:18 +00:00
| :------------------------ | :----------- | :---- |
| | | |
| v0.1.0 | < = v.0.5.0 | |
| v1.0.0-rc.1 | v1.0.0-rc.1 | |
2021-10-08 22:27:42 +00:00
| v1.0.0-rc.2 | v1.0.0-rc.2 | |
2021-10-14 03:11:26 +00:00
| v1.0.0-rc.3 | v1.0.0-rc.3 | |
2021-12-28 23:39:06 +00:00
| v1.0.0-rc.4 | v1.0.0-rc.4 | |
2022-06-03 16:54:37 +00:00
| v1.0 | v1.0 | |