Skip to content

Commit

Permalink
[:ant:] improper event name for Otel
Browse files Browse the repository at this point in the history
  • Loading branch information
am-kantox committed Dec 3, 2024
1 parent f2f097e commit 2b3167b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions examples/otel/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ config :telemetria,
],
throttle: %{some_group: {1_000, :last}}

# create a slack app and put URL here
# messenger_channels: %{slack: {:slack, url: ""}}

config :opentelemetry,
traces_exporter: :none

Expand Down
2 changes: 1 addition & 1 deletion examples/otel/lib/otel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Otel do

use Telemetria

@telemetria level: :info, group: :weather_reports, locals: [:celsius]
@telemetria level: :info, group: :weather_reports, locals: [:celsius], messenger: :slack
def f_to_c(fahrenheit) do
celsius = do_f_to_c(fahrenheit)
round(celsius)
Expand Down
2 changes: 1 addition & 1 deletion examples/otel/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defmodule Otel.MixProject do
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
extra_applications: [:logger, :inets, :ssl],
mod: {Otel.Application, []}
]
end
Expand Down
4 changes: 2 additions & 2 deletions lib/telemetria.ex
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ defmodule Telemetria do

Telemetria.Throttler.execute(
unquote(group),
{block_ctx, %{system_time: now, consumed: benchmark}, attributes, unquote(reshape),
unquote(messenger)}
{unquote(event), %{system_time: now, consumed: benchmark}, attributes,
unquote(reshape), unquote(messenger), block_ctx}
)

Backend.exit(block_ctx)
Expand Down
3 changes: 3 additions & 0 deletions lib/telemetria/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ defmodule Telemetria.Application do

@impl Elixir.Application
def start(_type, _args) do
Application.ensure_all_started(:inets)
Application.ensure_all_started(:ssl)

if telemetry?(), do: Application.ensure_all_started(:telemetry)
Application.put_all_env(telemetria: Telemetria.Options.initial())

Expand Down
4 changes: 2 additions & 2 deletions lib/telemetria/throttler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ defmodule Telemetria.Throttler do
Logger.warning("Wrong config for group: #{group}, skipping")
end

defp do_execute(group, {event, measurements, metadata, reshaper, messenger}) do
defp do_execute(group, {event, measurements, metadata, reshaper, messenger, block_ctx}) do
{context, updates} =
metadata
|> Map.put(:telemetria_group, group)
Expand All @@ -87,7 +87,7 @@ defmodule Telemetria.Throttler do
|> Map.put(:context, context)
|> Telemetria.Backend.reshape()

Telemetria.Backend.return(event, updates)
Telemetria.Backend.return(block_ctx, updates)
end

defp do_execute(group, [event]),
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Telemetria.MixProject do
use Mix.Project

@app :telemetria
@version "0.21.2"
@version "0.21.3"

def project do
[
Expand Down

0 comments on commit 2b3167b

Please sign in to comment.