Skip to content

Commit

Permalink
reshape/1 everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
am-kantox committed Nov 27, 2024
1 parent 32c6c78 commit 099dc2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/otel/config/.telemetria.config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"events":[["otel","f_to_c"]],"otp_app":"otel"}
{"events":[["otel","do_f_to_c"],["otel","f_to_c"]],"otp_app":"otel"}
3 changes: 2 additions & 1 deletion examples/otel/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ config :telemetria,
purge_level: :debug,
level: :info,
events: [
[:tm, :f_to_c]
[:tm, :f_to_c],
[:tm, :do_f_to_c]
],
throttle: %{some_group: {1_000, :last}}

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

@telemetria level: :info, group: :weather_reports, locals: [:celsius]
def f_to_c(fahrenheit) do
celsius = (fahrenheit - 32) * 5 / 9
celsius = do_f_to_c(fahrenheit)
round(celsius)
end

@telemetria level: :info, group: :weather_reports
defp do_f_to_c(fahrenheit), do: (fahrenheit - 32) * 5 / 9
end
2 changes: 1 addition & 1 deletion lib/telemetria/backend/open_telemetry.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ case {Telemetria.Application.open_telemetry?(), Code.ensure_compiled(OpenTelemet

@impl true
def reshape(updates),
do: Estructura.Flattenable.flatten(updates, jsonify: true) |> IO.inspect()
do: Estructura.Flattenable.flatten(updates, jsonify: true)

defp fix_block_id(block_id) when is_list(block_id), do: Enum.join(block_id, ".")
defp fix_block_id(block_id), do: block_id
Expand Down

0 comments on commit 099dc2d

Please sign in to comment.