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 15:41:36 +00:00
|
|
|
defmodule OpentelemetryOban.MixProject do
|
|
|
|
use Mix.Project
|
|
|
|
|
2024-02-05 00:18:14 +00:00
|
|
|
@version "1.0.0"
|
|
|
|
|
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 15:41:36 +00:00
|
|
|
def project do
|
|
|
|
[
|
|
|
|
app: :opentelemetry_oban,
|
2024-02-05 00:18:14 +00:00
|
|
|
version: @version,
|
|
|
|
elixir: "~> 1.11",
|
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 15:41:36 +00:00
|
|
|
start_permanent: Mix.env() == :prod,
|
|
|
|
deps: deps(),
|
|
|
|
docs: [
|
2023-04-30 18:10:03 +00:00
|
|
|
source_url_pattern:
|
|
|
|
"https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_oban/%{path}#L%{line}",
|
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 15:41:36 +00:00
|
|
|
main: "OpentelemetryOban",
|
|
|
|
extras: ["README.md"]
|
|
|
|
],
|
|
|
|
elixirc_paths: elixirc_paths(Mix.env()),
|
|
|
|
package: [
|
|
|
|
name: "opentelemetry_oban",
|
|
|
|
description: "OpenTelemetry tracing for Oban",
|
|
|
|
maintainers: ["Glia TechMovers"],
|
|
|
|
licenses: ["Apache-2.0"],
|
|
|
|
links: %{
|
|
|
|
"GitHub" => "https://github.com/open-telemetry/opentelemetry-erlang-contrib",
|
|
|
|
"OpenTelemetry Erlang" => "https://github.com/open-telemetry/opentelemetry-erlang",
|
|
|
|
"OpenTelemetry.io" => "https://opentelemetry.io"
|
|
|
|
},
|
|
|
|
files: ~w(lib .formatter.exs mix.exs README* LICENSE* CHANGELOG*)
|
2023-04-30 18:10:03 +00:00
|
|
|
],
|
|
|
|
source_url:
|
|
|
|
"https://github.com/open-telemetry/opentelemetry-erlang-contrib/tree/main/instrumentation/opentelemetry_oban"
|
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 15:41:36 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
# Run "mix help compile.app" to learn about applications.
|
|
|
|
def application do
|
|
|
|
[
|
|
|
|
extra_applications: []
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
# Run "mix help deps" to learn about dependencies.
|
|
|
|
defp deps do
|
|
|
|
[
|
|
|
|
{:oban, "~> 2.0"},
|
2022-01-05 01:58:06 +00:00
|
|
|
{:opentelemetry_api, "~> 1.0"},
|
2022-06-03 16:54:37 +00:00
|
|
|
{:opentelemetry_telemetry, "~> 1.0.0"},
|
2023-01-06 20:46:06 +00:00
|
|
|
{:opentelemetry_semantic_conventions, "~> 0.2"},
|
2022-01-05 01:58:06 +00:00
|
|
|
{:opentelemetry, "~> 1.0", only: [:test]},
|
|
|
|
{:opentelemetry_exporter, "~> 1.0", only: [:test]},
|
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 15:41:36 +00:00
|
|
|
{:telemetry, "~> 0.4 or ~> 1.0"},
|
2024-01-17 18:27:19 +00:00
|
|
|
{:ex_doc, "~> 0.31", only: [:dev], runtime: false}
|
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 15:41:36 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
|
|
|
defp elixirc_paths(_), do: ["lib"]
|
|
|
|
end
|