Commit Graph

162 Commits

Author SHA1 Message Date
Andrew Rosa 8df66285bb
Report Redix error messages through OTel status (#81)
Instead of custom attributes, leverage the status description as
described in Semantic Conventions. This approach is taken from current
`opentelemetry_ecto` implementation.

Small non-related change is a fix the license description in `mix.exs`.
2022-05-10 14:05:35 -06:00
Bryan Naegele e856486e30
Publish otel telemetry 1.0.0 (#78) 2022-04-13 19:22:28 -06:00
Greg Mefford 0939fe2de8
Relax requirement on telemetry library (#77) 2022-04-13 09:57:45 -06:00
Andrew Rosa daa6a97f3e
Bump dependencies and relax opentelemetry* to 1.0 (#75) 2022-03-31 11:23:32 -06:00
Tristan Sloughter af2a659631
bump otel-elli version number (#74) 2022-03-28 10:13:13 -06:00
Tristan Sloughter 74172effcd
add grpcbox instrumentation library (#70)
* add grpcbox instrumentation library

* grpcbox: fix .app file license and deps

* lock grpcbox
2022-03-27 11:42:36 -06:00
Tristan Sloughter db5193be45
elli instrumentation library (#69)
* elli instrumentation library

* Update instrumentation/opentelemetry_elli/README.md

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

* Update instrumentation/opentelemetry_elli/README.md

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

* Update instrumentation/opentelemetry_elli/README.md

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

* Update instrumentation/opentelemetry_elli/README.md

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

* Update instrumentation/opentelemetry_elli/README.md

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

* Update instrumentation/opentelemetry_elli/README.md

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

* add note about how excluded URL env var is parsed

* Update instrumentation/opentelemetry_elli/src/opentelemetry_elli.app.src

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>

Co-authored-by: Fred Hebert <mononcqc@ferd.ca>
2022-03-27 11:02:44 -06:00
Bryan Naegele c7fd3c9d9d
v0.1.0 (#73)
* v0.1.0

* v0.1.1
2022-03-25 14:53:37 -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 7a5802cb14
Process propagator library (#64)
* Process propagator library

* Fix Elixir API

* CI files

* Update propagators/opentelemetry_process_propagator/lib/opentelemetry_process_propagator.ex

Co-authored-by: Andrew Rosa <dev@andrewhr.io>

* Update propagators/opentelemetry_process_propagator/lib/opentelemetry_process_propagator.ex

Co-authored-by: Andrew Rosa <dev@andrewhr.io>

* format

Co-authored-by: Andrew Rosa <dev@andrewhr.io>
2022-03-23 13:02:28 -06:00
Patrice Chalin 2a25aab6d1
Update README.md (#71) 2022-03-20 16:44:31 -06:00
Kai e3f0ec8ee0
Handle binary and undefined response status and rename http.status to http.status_code in `opentelemetry-cowboy` (#48)
* Handle binary resp_status from Cowboy and rename http.status to http.status_code

* Fix test to use http.status_code as well

* Handle resp_status could be undefined but not error

- This could be due to websocket upgrade request.

* Rename Status1 and transform_status to a more concise naming

* Add test case for handling binary response code

* Fix syntax and failing tests

* Always convert cowboy status to status code

* Set otel span status as error when status code >= 500
2022-03-19 06:16:15 -06:00
Derek Kraan ddb2d3b963
Only attempt to record an exception if there is an active span. (#37)
There is an edge case, if you use `forward/4` and use Plug.ErrorHandler,
then when an exception reaches the outer router, then Plug.send_resp
will be called, triggering `[:phoenix, :endpoint, :stop]`, and the span
will be gone by the time the outer router gets the exception. This
causes this telemetry handler to crash and be detached.

Sequence of events:
- [:phoenix, :endpoint, :start]
- [:phoenix, :router_dispatch, :exception] (inner router)
- [:phoenix, :endpoint, :stop]
- [:phoenix, :router_dispatch, :exception] (outer router) ** here there is no span, crashes
2022-03-18 05:21:26 -06:00
Kai 563901d516
Add missing .env and update README (#67)
Co-authored-by: Tristan Sloughter <t@crashfast.com>
2022-03-15 13:49:17 -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
Kai 44fd2a6871
Add Phoenix + Ecto example (#60)
* Boostrap Phoenix application from mix phx.new

* Add opentelemetry dependencies

* Setup opentelemetry for local env

* Setup Dockerfile, docker-compose and otel config

* Configure runtime config for exporter to export to otel collector in prod env

* Generate Posts HTML resources

* Add Release module to run migration in release

* Generate Users LiveView resource

* Add exporter configuration to export directly to external service

* Update README.md to include description and instructions

* Update README.md to include more details on exporting traces

* Fix otlp collector deprecated ports as suggested
2022-02-25 18:45:46 -07:00
Bryan Naegele fb2595d2fb
Do not attempt to end a span if ctx wasn't found (#59)
* Do not attempt to end a span if ctx is undefined
2022-01-05 10:23:10 -07:00
Andrew Rosa f281a90f3c
Update CI config for opentelemetry_redix (#58)
Following the pattern on [this PR][1]

[1]: https://github.com/open-telemetry/opentelemetry-erlang-contrib/pull/55/files#diff-567a3fdf49d6f0f0119dda6d1c098fcb5ee3785ee956481b3daaf5a2f246076f

Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
2022-01-04 22:34:06 -07:00
Bryan Naegele 9446fe6a99
Otel 1.0 support (#57) 2022-01-04 18:58:06 -07:00
Andrew Rosa 50ed370444
Add OpenTelemetry integration to Redix (#29)
Initial approach follows Ecto instrumentation, recording spans for all
Redix `[:redix, :pipeline, :stop]` events.

The command sanitization is inspired-by and adapted from [Java
instrumentation][1], from where I've also copied the actual commands and
what configuration should they follow.

Network attributes are tracked via a "sidecar" process, which keeps
track of connection attributes also via `telemetry`. This extra bit of
bookkeeping is needed as command events doesn't include that piece of
information, unfortunately.

[1]: b2bc41453b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/db/RedisCommandSanitizer.java
2022-01-04 14:39:19 -07:00
Aaron Renner 50775c881e
Make plug dependency explicit (#53) 2022-01-04 13:47:21 -07:00
Alexandre Hamez 6722d00d77
Fix typo (#56) 2022-01-04 06:01: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
Bryan Naegele 4f087f85a5
Add elixir 1.13 to matrix; drop OTP 21 support (#55)
* Add elixir 1.13 to matrix; drop OTP 21 support
2021-12-28 14:14:26 -07:00
matthijsqd 9446655797
set phoenix attributes on span creation (#52) 2021-12-17 09:16:26 -07:00
Indrek Juhkam eecb238cff
Add opentelemetry integration to Oban (#6)
By default a new trace is automatically started when a job is processed
by monitoring these events:
* `[:oban, :job, :start]` — at the point a job is fetched from the database and will execute
* `[:oban, :job, :stop]` — after a job succeeds and the success is recorded in the database
* `[:oban, :job, :exception]` — after a job fails and the failure is recorded in the database

To also record a span when a job is created and to link traces together
`Oban.insert/2` has to be replaced by `OpentelemetryOban.insert/2`.

Before:

```elixir
  %{id: 1, in_the: "business", of_doing: "business"}
  |> MyApp.Business.new()
  |> Oban.insert()
```

After:

```elixir
  %{id: 1, in_the: "business", of_doing: "business"}
  |> MyApp.Business.new()
  |> OpentelemetryOban.insert()
```

Co-authored-by: Tristan Sloughter <t@crashfast.com>
2021-12-08 08:41:36 -07:00
Andrew Rosa f12a635d9d
Fix compilation warning on otel_telemetry (#46)
Fix of `Warning: variable 'Ctx' is unused` on compilation logs.
2021-11-28 12:16:37 -07:00
Bryan Naegele d7eb7b8a24
Migrate otel_telemetry to contrib (#43) 2021-11-27 18:33:47 -07:00
Raphael D. Pinheiro 8755d5fdba
Avoid syntax error for insecure key (#45)
According to the docs: https://opentelemetry.io/docs/collector/configuration/#exporters the insecure key should be inside tls key otherwise the service doesn't start.
2021-11-24 10:38:59 -07:00
Kai b4046eb073
Port example from opentelemetry-examples (#31)
* Copy opentelemetry-examples/basic_elixir over

* Bump opentelemtry and opentelemetry_exporter to 1,0.0-rc.3

* Remove OpenTelemetry.register_application_tracer

* Update example to be consistent with opentelemetry.io docs

Co-authored-by: Tristan Sloughter <t@crashfast.com>
2021-11-23 13:15:59 -07:00
Bryan Naegele 9bef47b7a0
Update .gitignore 2021-11-22 12:18:02 -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
Ho-Yon Mak 3f43f8dd9f
opentelemetry_phoenix http.status -> http_status_code (#42) 2021-11-19 07:15:43 -07:00
Timmo Verlaan f21b315e3e
inspect terms that otherwise can't be serialized by exporter (#40) 2021-11-18 18:02:36 -07:00
Maciej Szlosarczyk 9ce604153d
Add info about conventions to guides (#33)
Co-authored-by: Tristan Sloughter <t@crashfast.com>
2021-11-12 10:52:29 -07:00
Ho-Yon Mak 404aab58b2
Add opentelemetry-ecto to README (#34) 2021-11-11 14:13:08 -07:00
Seth Archer Brown f083f3d7e7
Remove outdate setup example (#30)
Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
2021-10-15 14:11:28 -06: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
Bryan Naegele 71e1e4ab48
Cowboy instrumentation (#18)
* Cowboy instrumentation
2021-10-06 13:36:22 -06:00
Damir Vandic 1cd2251768
Fix typos (#17)
Co-authored-by: Bryan Naegele <bryannaegele@users.noreply.github.com>
2021-10-06 12:37:01 -06:00
Manu 18aa2eca97
Update github URL for Hex.pm (#21) 2021-10-06 12:36:16 -06:00
Marco "Efesto" Polita 3334b07b9d
Adds readme entry on Plug.Telemetry (#20)
* adds entry about Plug.Telemetry

* Adds reference to phoenix endpoint template
2021-10-01 10:30:49 -06:00
Bryan Naegele 2e45dc6a63
Start PR templates for existing projects and general PR (#8)
* Start PR templates for existing projects and general PR

* Add spec compliance requirement
2021-09-19 20:20:18 -06:00
Bryan Naegele 401d05041f
opentelemetry-phoenix 1.0.0-rc3 (#15) 2021-09-19 18:17:51 -06:00