Commit Graph

9 Commits

Author SHA1 Message Date
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
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
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 2f2b31c1ce
Otel 1.0.0-rc.3 support (#27) 2021-10-13 21:11:26 -06:00
Bryan Naegele bfee0f71a4
Migrate otel ecto (#16)
* Migrate otel ecto
2021-10-08 15:38:18 -06:00