Commit Graph

14 Commits

Author SHA1 Message Date
Andrea Leopardi c2cb6bc86c
Improve docs and README for opentelemetr_ecto (#312) 2024-04-11 09:37:07 -06:00
Tom Taylor 8068002c17
Include `db.system` attribute in `opentelemetry_ecto` (#187)
* Run mix format

* Upgrade dependencies to build on OTP 26

* Add db.system attribute

* Add support for mssql and fallback to other_sql

* Fallback to not including db_system if adapter is unrecognised

---------

Co-authored-by: Tristan Sloughter <t@crashfast.com>
2023-09-23 05:56:42 -06:00
Tom Taylor 17d31cc594
Improve test matrix and add support for Elixir 1.15 and OTP 26 (#188)
* Use test matrix from file

* Only check formatting on specific Elixir version

* Use latest patch version of each Elixir/OTP release in test matrix

* Test on Elixir 1.15 and OTP 26

* Run formatter on opentelemetry_httpoison

* Run formatter on opentelemetry_phoenix

* Run formatter on opentelemetry_tesla

* Fix building opentelemetry_ecto on Elixir 1.15

Upgraded deps to fix ssl_verify_fun not compiling

* Fix building opentelemetry_dataloader on Elixir 1.15

Upgraded deps to fix ssl_verify_fun and ecto_sql not compiling

* Upgrade opentelemetry_finch to build on Elixir 1.15

* Upgrade opentelemetry_httpoison deps to build on 1.15

* Upgrade opentelemetry_nebulex to build on Elixir 1.15

* Upgrade opentelemetry_oban to build on Elixir 1.15

* Upgrade opentelemetry_phoenix deps to build on 1.15

* Upgrade opentelemetry_redix deps to build on 1.15

* Fix warning about <> being ambiguous

* Fix assertion on attributes keys

These are always atoms, not strings.

* Upgrade ssl_verify_fun in opentelemetry_telemetry

* Deterministically sort keys before asserting in tests

* Upgrade opentelemetry_process_propogator to build on Elixir 1.15

* Run mix format on opentelemetry_process_propogator

* Assert keys are atoms, not strings

* Use matrix.os to define runs-on parameter

* Pin test matrix to specific OTP + Elixir versions

* Run formatter on telemetry and process_propagator

* Run formatter over opentelemetry_phoenix

---------

Co-authored-by: Tristan Sloughter <t@crashfast.com>
2023-08-25 14:11:23 -06:00
Josh Lee b85420afed
Don't record DB statements without sanitizaiton (#166)
* Don't record DB statements without sanitizaiton

This adds an option to OpentelemetryEcto.setup/1 that allows a query
sanitization function to be provided. If it is not provided, queries
are not captured (this is the default).

* test that db.statement isnt present unless query sanitizer is configured

* rename option to `:db_statement`

* run mix format
2023-06-13 05:13:01 -06:00
Cedric Ziel 8292870b66
Add db.name to ecto spans (#172)
* Add db.name to ecto spans

As per the spec, the db.name attribute is required on database spans. This changes adds it.

Ref: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md#call-level-attributes

* Add db.name attribute to tests

* Changelog update

* Update instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs

* Update instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs
2023-05-23 04:49:29 -06:00
Andrew Rosa 56c6503a93
Fix two use cases of Ecto span propagation (#82)
First one is related to `OpenTelemetry.Ctx` API. I've noticed in a few
scenarios the current span of a trace may get lost after Ecto calls.

Looking at the The `attach/1` typespec, it's a Ctx -> Token, while
`dettach/1` as Token -> Ctx function. That made me assume the expected
input of dettach is the return type of attach. Indeed, after this change
we got the behavior of Ecto calls preserve the parent span untouched.

That leads to a second bug found. When ecto does simple calls within a
Task, due the special propagation code for preloads that means it will
skip the current span, if any.  The solution here is to first check the
current process.

One test was added to reproduce this bug.
2022-11-15 17:55:32 -07:00
cevado a9e6fa0c84
opentelemetry_ecto - add possibility to setup additional attributes. (#94)
* Make possible to include additional attributes to the span through setup

* Adjust code review changes
2022-09-02 13:47:34 -06:00
Damir Vandic 0f137525b5
Make Ecto spans of preloads children of the parent span (#49)
🎉
2022-03-24 14:19:24 -06:00
Ho-Yon Mak a7b0c04aaf
Add idle_time measurement (#66)
Co-authored-by: Tristan Sloughter <t@crashfast.com>
2022-03-14 10:22:22 -06:00
Bryan Naegele 1d52d88e42
Otel 1.0.0-rc.4 updates (#54)
* Otel 1.0.0-rc.4 updates

* Unused module attribute

* Missed oban test
2021-12-28 16:39:06 -07:00
Ho-Yon Mak 352c17231a
Set error status for ecto errors in opentelemetry_ecto (#41)
* Set error status on error instead of just adding attribute

* Use Exception.message if error is an exception

Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
2021-11-22 12:08:31 -07:00
Indrek Juhkam 4aaf86181a
Set opentelemetry_ecto span kind to CLIENT (#38)
From the [semantic conventions][1]:

> Span kind: MUST always be CLIENT.

[1]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md

Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
2021-11-22 11:49:58 -07:00
Norberto Lopes d92d8ef7c8
Cosmetic change to avoid dangling suffix of ':' if source is nil (#23)
As it stands, when source is nil (which, for example, can happen if there is a
call to `Repo.transaction`), the name of the span ends in an odd ':'. This
removes that ':'.

Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
2021-10-13 21:16:07 -06:00
Bryan Naegele bfee0f71a4
Migrate otel ecto (#16)
* Migrate otel ecto
2021-10-08 15:38:18 -06:00