diff --git a/instrumentation/opentelemetry_finch/lib/opentelemetry_finch.ex b/instrumentation/opentelemetry_finch/lib/opentelemetry_finch.ex index fee2297..ce9bbf6 100644 --- a/instrumentation/opentelemetry_finch/lib/opentelemetry_finch.ex +++ b/instrumentation/opentelemetry_finch/lib/opentelemetry_finch.ex @@ -15,6 +15,9 @@ defmodule OpentelemetryFinch do """ + alias OpenTelemetry.SemanticConventions.Trace + + require Trace require OpenTelemetry.Tracer @typedoc "Setup options" @@ -48,13 +51,13 @@ defmodule OpentelemetryFinch do url = build_url(meta.request.scheme, meta.request.host, meta.request.port, meta.request.path) attributes = %{ - "http.url": url, - "http.scheme": meta.request.scheme, - "net.peer.name": meta.request.host, - "net.peer.port": meta.request.port, - "http.target": meta.request.path, - "http.method": meta.request.method, - "http.status_code": status + Trace.http_url() => url, + Trace.http_scheme() => meta.request.scheme, + Trace.net_peer_name() => meta.request.host, + Trace.net_peer_port() => meta.request.port, + Trace.http_target() => meta.request.path, + Trace.http_method() => meta.request.method, + Trace.http_status_code() => status } s = diff --git a/instrumentation/opentelemetry_finch/mix.exs b/instrumentation/opentelemetry_finch/mix.exs index da372f5..4a42f6f 100644 --- a/instrumentation/opentelemetry_finch/mix.exs +++ b/instrumentation/opentelemetry_finch/mix.exs @@ -48,6 +48,7 @@ defmodule OpentelemetryFinch.MixProject do [ {:telemetry, "~> 0.4 or ~> 1.0"}, {:opentelemetry_api, "~> 1.0"}, + {:opentelemetry_semantic_conventions, "~> 0.1.0"}, {:opentelemetry, "~> 1.0", only: [:dev, :test]}, {:opentelemetry_exporter, "~> 1.0", only: [:dev, :test]}, {:ex_doc, "~> 0.29.0", only: [:dev], runtime: false}, diff --git a/instrumentation/opentelemetry_finch/mix.lock b/instrumentation/opentelemetry_finch/mix.lock index d53bc7b..2d5ea25 100644 --- a/instrumentation/opentelemetry_finch/mix.lock +++ b/instrumentation/opentelemetry_finch/mix.lock @@ -27,6 +27,7 @@ "opentelemetry": {:hex, :opentelemetry, "1.1.2", "77ba2fd2fee67bebde590851a4afeda45b3f298310aa410a2a3804b364cb598a", [:rebar3], [{:opentelemetry_api, "~> 1.1", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}], "hexpm", "5c60be189d6aed64a9fd17055f72c93eab144be441e625276c3c95533e6bb4c7"}, "opentelemetry_api": {:hex, :opentelemetry_api, "1.1.1", "3b43877c456c8a7f5448a95d9bf4fb4bb8cc2abbbea2c62d5f8e8c538b4af14f", [:mix, :rebar3], [], "hexpm", "a9554b3208b60a70043318d051ea78fbbc7a1b8f4c418ebc16ccb40015995675"}, "opentelemetry_exporter": {:hex, :opentelemetry_exporter, "1.2.2", "3966c56656627ef7db6c34c4ce28d44ac8629dcd065a310d7c33712fc2a1cfe3", [:rebar3], [{:grpcbox, ">= 0.0.0", [hex: :grpcbox, repo: "hexpm", optional: false]}, {:opentelemetry, "~> 1.1", [hex: :opentelemetry, repo: "hexpm", optional: false]}, {:opentelemetry_api, "~> 1.1", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}, {:tls_certificate_check, "~> 1.11", [hex: :tls_certificate_check, repo: "hexpm", optional: false]}], "hexpm", "5c11adeda19e0d203a04efe92cdd7a183da4b09ae8acaba7608e9303fa258e74"}, + "opentelemetry_semantic_conventions": {:hex, :opentelemetry_semantic_conventions, "0.1.0", "0a7463c0ec4541d9c8e09ee99bd7b5480fa6f90f40313a6d071fd7521b5a712f", [:mix, :rebar3], [], "hexpm", "eccf41bc7afec299484075aff570bf504a2f7e5c38fbcdaceb33a6d6b901448d"}, "plug": {:hex, :plug, "1.14.0", "ba4f558468f69cbd9f6b356d25443d0b796fbdc887e03fa89001384a9cac638f", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "bf020432c7d4feb7b3af16a0c2701455cbbbb95e5b6866132cb09eb0c29adc14"}, "plug_cowboy": {:hex, :plug_cowboy, "2.6.0", "d1cf12ff96a1ca4f52207c5271a6c351a4733f413803488d75b70ccf44aebec2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "073cf20b753ce6682ed72905cd62a2d4bd9bad1bf9f7feb02a1b8e525bd94fa6"}, "plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"},