Commit Graph

21 Commits

Author SHA1 Message Date
Cedric Ziel 6a5fc4c884
Bump version to 1.1.1 (#175) 2023-05-23 05:04: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
Patrik Stenmark ddf0706bf1
Make exdocs settings a bit more similar between different packages (#168)
* Add source_url_pattern to be able to use the "link to source" button
* Add README.md as an "extra" where it wasn't already
* Add a `main` setting. They all have a very obvious main module. Set
  that as `main`, so a user is shown this immediately instead of a list
  of usually only this module.
2023-04-30 12:10:03 -06:00
Bryan Naegele c8b760e776
publish latest updates (#127) 2022-11-16 19:07:23 -07: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
Bryan Naegele 4d39f47b03
update elixir package deps (#126)
* update elixir package deps

* Oban test updates
2022-11-15 17:48:50 -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
Bryan Naegele 6591b28166
Publish updates for Phoenix, Ecto, and Cowboy (#79)
* Publish 1.0 for Phoenix, Ecto, and Cowboy

* Missed version in changelog
2022-06-03 10:54:37 -06:00
Greg Mefford 0939fe2de8
Relax requirement on telemetry library (#77) 2022-04-13 09:57:45 -06:00
Damir Vandic 0f137525b5
Make Ecto spans of preloads children of the parent span (#49)
🎉
2022-03-24 14:19:24 -06:00
Andrew Rosa 3faa246d02
Remove exporter race-condition on tests (#44)
Default exporter immediately attempts on start connect to
`:otel-collector` default port. As we don't have any collector running
on our test environment, this results in a few warnings. That's not an
issue in itself, as code immediately switches to another export, but
creates a lot of noise.

This patch moves the exporter setup to `config/test.exs`, essentially
removing the need to restart opentelemetry applicationn for each test
case. The only work setup blocks do is update the exporter's target pid.

The processor was changed to simple mode, available now, which also remove
another vector of (unlikely but theoretically possible) race-conditions.
2022-03-24 11:48:59 -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 9446fe6a99
Otel 1.0 support (#57) 2022-01-04 18:58:06 -07: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
Bryan Naegele 27727e40cd
Publish packages (#28) 2021-10-15 14:01:11 -06: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 2f2b31c1ce
Otel 1.0.0-rc.3 support (#27) 2021-10-13 21:11:26 -06:00
Bryan Naegele aece932faf
Lock Otel versions and publish updates (#22) 2021-10-08 16:27:42 -06:00
Bryan Naegele bfee0f71a4
Migrate otel ecto (#16)
* Migrate otel ecto
2021-10-08 15:38:18 -06:00