Current section
21 Versions
Jump to
Current section
21 Versions
Compare versions
4
files changed
+45
additions
-13
deletions
| @@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |
| 9 9 | |
| 10 10 | --- |
| 11 11 | |
| 12 | + ## [1.3.2] - 2024-06-26 |
| 13 | + |
| 14 | + ### Added |
| 15 | + |
| 16 | + - Add latest semantic convention resource attributes |
| 17 | + |
| 18 | + --- |
| 19 | + |
| 20 | + ## [1.3.1-rc.1] - 2024-05-28 |
| 21 | + |
| 22 | + --- |
| 23 | + |
| 12 24 | ## [1.3.1] - 2023-09-01 |
| 13 25 | |
| 14 26 | ### Changed |
| @@ -72,7 +84,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |
| 72 84 | - HTTPoison 2.0.0 is now supported |
| 73 85 | |
| 74 86 | |
| 75 | - [Unreleased]: https://github.com/primait/telepoison/compare/1.3.1...HEAD |
| 87 | + |
| 88 | + |
| 89 | + [Unreleased]: https://github.com/primait/telepoison/compare/1.3.2...HEAD |
| 90 | + [1.3.2]: https://github.com/primait/telepoison/compare/1.3.1-rc.1...1.3.2 |
| 91 | + [1.3.1-rc.1]: https://github.com/primait/telepoison/compare/1.3.1-rc.0...1.3.1-rc.1 |
| 76 92 | [1.3.1]: https://github.com/primait/telepoison/compare/1.3.0...1.3.1 |
| 77 93 | [1.3.0]: https://github.com/primait/telepoison/compare/1.2.2...1.3.0 |
| 78 94 | [1.2.2]: https://github.com/primait/telepoison/compare/1.2.1...1.2.2 |
| @@ -4,9 +4,9 @@ | |
| 4 4 | <<"Telepoison is a opentelemetry-instrumented wrapper around HTTPPoison.">>}. |
| 5 5 | {<<"elixir">>,<<"~> 1.12">>}. |
| 6 6 | {<<"files">>, |
| 7 | - [<<"lib">>,<<"lib/uri.ex">>,<<"lib/telepoison.ex">>, |
| 8 | - <<"lib/configuration.ex">>,<<".formatter.exs">>,<<"mix.exs">>, |
| 9 | - <<"README.md">>,<<"LICENSE.md">>,<<"CHANGELOG.md">>]}. |
| 7 | + [<<"lib">>,<<"lib/configuration.ex">>,<<"lib/telepoison.ex">>, |
| 8 | + <<"lib/uri.ex">>,<<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>, |
| 9 | + <<"LICENSE.md">>,<<"CHANGELOG.md">>]}. |
| 10 10 | {<<"licenses">>,[<<"MIT">>]}. |
| 11 11 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/primait/telepoison">>}]}. |
| 12 12 | {<<"name">>,<<"telepoison">>}. |
| @@ -26,4 +26,4 @@ | |
| 26 26 | {<<"optional">>,false}, |
| 27 27 | {<<"repository">>,<<"hexpm">>}, |
| 28 28 | {<<"requirement">>,<<"~> 0.2">>}]]}. |
| 29 | - {<<"version">>,<<"1.3.1">>}. |
| 29 | + {<<"version">>,<<"1.3.2">>}. |
| @@ -19,11 +19,18 @@ defmodule Telepoison do | |
| 19 19 | alias OpenTelemetry.Tracer |
| 20 20 | alias Telepoison.Configuration |
| 21 21 | |
| 22 | - @http_url Atom.to_string(Conventions.http_url()) |
| 23 22 | @http_method Atom.to_string(Conventions.http_method()) |
| 23 | + @http_request_method "http.request.method" |
| 24 | + @http_response_status_code "http.response.status_code" |
| 24 25 | @http_route Atom.to_string(Conventions.http_route()) |
| 25 26 | @http_status_code Atom.to_string(Conventions.http_status_code()) |
| 27 | + @http_url Atom.to_string(Conventions.http_url()) |
| 26 28 | @net_peer_name Atom.to_string(Conventions.net_peer_name()) |
| 29 | + @server_address "server.address" |
| 30 | + @server_port "server.port" |
| 31 | + @url_full "url.full" |
| 32 | + @url_scheme "url.scheme" |
| 33 | + @url_template "url.template" |
| 27 34 | |
| 28 35 | @doc ~S""" |
| 29 36 | Configures Telepoison using the provided `opts` `Keyword list`. |
| @@ -151,7 +158,7 @@ defmodule Telepoison do | |
| 151 158 | |
| 152 159 | span_name = Keyword.get_lazy(opts, :ot_span_name, fn -> default_span_name(request) end) |
| 153 160 | |
| 154 | - %URI{host: host} = request.url |> process_request_url() |> URI.parse() |
| 161 | + %URI{scheme: scheme, host: host, port: port} = request.url |> process_request_url() |> URI.parse() |
| 155 162 | |
| 156 163 | resource_route_attribute = |
| 157 164 | opts |
| @@ -159,14 +166,14 @@ defmodule Telepoison do | |
| 159 166 | |> get_resource_route(request) |
| 160 167 | |> case do |
| 161 168 | resource_route when is_binary(resource_route) -> |
| 162 | - [{@http_route, resource_route}] |
| 169 | + [{@http_route, resource_route}, {@url_template, resource_route}] |
| 163 170 | |
| 164 171 | nil -> |
| 165 172 | [] |
| 166 173 | end |
| 167 174 | |
| 168 175 | ot_attributes = |
| 169 | - get_standard_ot_attributes(request, host) ++ |
| 176 | + get_standard_ot_attributes(request, scheme, host, port) ++ |
| 170 177 | get_ot_attributes(opts) ++ |
| 171 178 | resource_route_attribute |
| 172 179 | |
| @@ -195,6 +202,7 @@ defmodule Telepoison do | |
| 195 202 | Tracer.set_status(:error, "") |
| 196 203 | end |
| 197 204 | |
| 205 | + Tracer.set_attribute(@http_response_status_code, status_code) |
| 198 206 | Tracer.set_attribute(@http_status_code, status_code) |
| 199 207 | end_span() |
| 200 208 | status_code |
| @@ -220,14 +228,22 @@ defmodule Telepoison do | |
| 220 228 | Tracer.set_current_span(ctx) |
| 221 229 | end |
| 222 230 | |
| 223 | - defp get_standard_ot_attributes(request, host) do |
| 231 | + defp get_standard_ot_attributes(request, scheme, host, port) do |
| 224 232 | [ |
| 225 233 | {@http_method, |
| 226 234 | request.method |
| 227 235 | |> Atom.to_string() |
| 228 236 | |> String.upcase()}, |
| 237 | + {@http_request_method, |
| 238 | + request.method |
| 239 | + |> Atom.to_string() |
| 240 | + |> String.upcase()}, |
| 229 241 | {@http_url, strip_uri_credentials(request.url)}, |
| 230 | - {@net_peer_name, host} |
| 242 | + {@net_peer_name, host}, |
| 243 | + {@server_address, host}, |
| 244 | + {@server_port, port}, |
| 245 | + {@url_full, strip_uri_credentials(request.url)}, |
| 246 | + {@url_scheme, scheme} |
| 231 247 | ] |
| 232 248 | end |
| @@ -2,7 +2,7 @@ defmodule Telepoison.MixProject do | |
| 2 2 | use Mix.Project |
| 3 3 | |
| 4 4 | @source_url "https://github.com/primait/telepoison" |
| 5 | - @version "1.3.1" |
| 5 | + @version "1.3.2" |
| 6 6 | |
| 7 7 | def project do |
| 8 8 | [ |
| @@ -75,7 +75,7 @@ defmodule Telepoison.MixProject do | |
| 75 75 | ], |
| 76 76 | main: "readme", |
| 77 77 | source_url: @source_url, |
| 78 | - source_ref: "v#{@version}", |
| 78 | + source_ref: @version, |
| 79 79 | formatters: ["html"] |
| 80 80 | ] |
| 81 81 | end |