From d92d8ef7c8b6ff6c91d58d33e0598cc5ce650dda Mon Sep 17 00:00:00 2001 From: Norberto Lopes Date: Thu, 14 Oct 2021 04:16:07 +0100 Subject: [PATCH] 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 --- instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex index 2a2457f..267db69 100644 --- a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex +++ b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex @@ -57,7 +57,7 @@ defmodule OpentelemetryEcto do case Keyword.fetch(config, :span_prefix) do {:ok, prefix} -> prefix :error -> Enum.join(event, ".") - end <> ":#{source}" + end <> if source != nil, do: ":#{source}", else: "" time_unit = Keyword.get(config, :time_unit, :microsecond)