From 4aaf86181a17643e01a530b2f1c475d94d29df12 Mon Sep 17 00:00:00 2001 From: Indrek Juhkam Date: Mon, 22 Nov 2021 20:49:58 +0200 Subject: [PATCH] Set opentelemetry_ecto span kind to CLIENT (#38) From the [semantic conventions][1]: > Span kind: MUST always be CLIENT. [1]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md Co-authored-by: Bryan Naegele --- instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex | 3 ++- .../opentelemetry_ecto/test/opentelemetry_ecto_test.exs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex index 267db69..f105e8b 100644 --- a/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex +++ b/instrumentation/opentelemetry_ecto/lib/opentelemetry_ecto.ex @@ -97,7 +97,8 @@ defmodule OpentelemetryEcto do s = OpenTelemetry.Tracer.start_span(span_name, %{ start_time: start_time, - attributes: attributes ++ base_attributes + attributes: attributes ++ base_attributes, + kind: :client }) OpenTelemetry.Span.end_span(s) diff --git a/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs b/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs index f4fb37c..8898ca1 100644 --- a/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs +++ b/instrumentation/opentelemetry_ecto/test/opentelemetry_ecto_test.exs @@ -39,7 +39,8 @@ defmodule OpentelemetryEctoTest do assert_receive {:span, span( name: "opentelemetry_ecto.test_repo.query:users", - attributes: list + attributes: list, + kind: :client )} assert [