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>
This commit is contained in:
Norberto Lopes 2021-10-14 04:16:07 +01:00 committed by GitHub
parent 2f2b31c1ce
commit d92d8ef7c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@ defmodule OpentelemetryEcto do
case Keyword.fetch(config, :span_prefix) do case Keyword.fetch(config, :span_prefix) do
{:ok, prefix} -> prefix {:ok, prefix} -> prefix
:error -> Enum.join(event, ".") :error -> Enum.join(event, ".")
end <> ":#{source}" end <> if source != nil, do: ":#{source}", else: ""
time_unit = Keyword.get(config, :time_unit, :microsecond) time_unit = Keyword.get(config, :time_unit, :microsecond)