Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification du code custom Telemetry AppSignal Ecto #4280

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/transport/lib/transport/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule Transport.Application do
:ok = Transport.Jobs.ObanLogger.setup()

:ok = Transport.Telemetry.setup()
:ok = Transport.EctoTelemetry.setup()
:ok = Transport.AppSignal.EctoTelemetry.setup()

opts = [strategy: :one_for_one, name: Transport.Supervisor]
Supervisor.start_link(children, opts)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Transport.EctoTelemetry do
defmodule Transport.AppSignal.EctoTelemetry do
require Logger

@moduledoc """
Expand All @@ -12,7 +12,7 @@ defmodule Transport.EctoTelemetry do
* https://github.com/appsignal/appsignal-elixir/issues/887 (which ensures calls are fast & mostly safe)

A few notes extracted from the doc (with extra comments):
* `:idle_time` - the time the connection spent waiting before being checked out for the query.
* `:idle_time` - the time the connection spent waiting before being checked out for the query.
the higher the better ; if this gets low (close to 0), the pool is over-used (not good).
* `:queue_time` - the time spent waiting to check out a database connection.
the lower the better. if this gets too high, the pool is over-used (not good).
Expand Down Expand Up @@ -65,13 +65,13 @@ defmodule Transport.EctoTelemetry do
end

def setup do
Logger.info("Setting up telemetry for AppSignal + Ecto")
Logger.info("Setting up telemetry for our custom AppSignal's Ecto integration")

:telemetry.attach(
"transport-ecto",
"transport-appsignal-ecto",
# NOTE: the first two params are I believe mapped to `DB.Repo`
[:db, :repo, :query],
&Transport.EctoTelemetry.handle_event/4,
&Transport.AppSignal.EctoTelemetry.handle_event/4,
nil
)
end
Expand Down