From fdb3631d77eb19fb6b3383991b6e1e128008120b Mon Sep 17 00:00:00 2001 From: Jesse Van Volkinburg <42327429+vanvoljg@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:39:08 -0700 Subject: [PATCH 1/2] lock sigaws_otp_24 --- mix.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/mix.lock b/mix.lock index 34644b5..c4761fb 100644 --- a/mix.lock +++ b/mix.lock @@ -27,6 +27,7 @@ "poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], [], "hexpm", "8f7168911120e13419e086e78d20e4d1a6776f1eee2411ac9f790af10813389f"}, "postgrex": {:hex, :postgrex, "0.15.7", "724410acd48abac529d0faa6c2a379fb8ae2088e31247687b16cacc0e0883372", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "88310c010ff047cecd73d5ceca1d99205e4b1ab1b9abfdab7e00f5c9d20ef8f9"}, "sigaws": {:hex, :sigaws, "0.7.2", "2b0bcd3979f2ae19337d0a6e52b4b1f37ac3d778201019240e641471a2d36685", [:mix], [], "hexpm", "5d3f3c9a259b052015297b3392800b95a7672c7cf3e878cf88c0d33213ac2e55"}, + "sigaws_otp_24": {:hex, :sigaws_otp_24, "1.0.0", "cd8e41a6c198ba8c9005d2ec8cf427196100d7f0d6089b68afa501df3e035049", [:mix], [], "hexpm", "624550f60c651be6680fa200afc11e01fa8c10df16e3b6dfe2c8b0f2a54abddd"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, From 41b69bd4fa3d0ebfb685110f59944fa499520ed9 Mon Sep 17 00:00:00 2001 From: Jesse Van Volkinburg <42327429+vanvoljg@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:39:28 -0700 Subject: [PATCH 2/2] include start_metadata in the stop_metadata returned from :telemetry.span for all calls --- lib/elasticsearch.ex | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/lib/elasticsearch.ex b/lib/elasticsearch.ex index 569111e..ddd0ec1 100644 --- a/lib/elasticsearch.ex +++ b/lib/elasticsearch.ex @@ -12,17 +12,40 @@ defmodule Elasticsearch do * `[:elasticsearch, :request, :start]` - emitted at the beginning of the request to Elasticsearch. * Measurement: `%{system_time: System.system_time()}` - * Metadata: `%{telemetry_span_context: term(), config: Elasticsearch.Cluster.config(), - method: Elasticsearch.API.method(), url: Elasticsearch.API.url(), data: Elasticsearch.API.data()}` + * Metadata: + %{ + telemetry_span_context: term(), + config: Elasticsearch.Cluster.config(), + method: Elasticsearch.API.method(), + url: Elasticsearch.API.url(), + data: Elasticsearch.API.data() + } * `[:elasticsearch, :request, :stop]` - emitted at the end of the request to Elasticsearch. * Measurement: `%{duration: native_time}` - * Metadata: `%{telemetry_span_context: term(), result: Elasticsearch.API.response()}` + * Metadata: + %{ + telemetry_span_context: term(), + config: Elasticsearch.Cluster.config(), + method: Elasticsearch.API.method(), + url: Elasticsearch.API.url(), + data: Elasticsearch.API.data(), + result: Elasticsearch.API.response() + } * `[:elasticsearch, :request, :exception]` - emitted when an exception has been raised. * Measurement: `%{system_time: System.system_time()}` - * Metadata: `%{telemetry_span_context: term(), kind: Exception.kind(), reason: term(), - stacktrace: Exception.stacktrace()}` + * Metadata: + %{ + telemetry_span_context: term(), + config: Elasticsearch.Cluster.config(), + method: Elasticsearch.API.method(), + url: Elasticsearch.API.url(), + data: Elasticsearch.API.data(), + kind: Exception.kind(), + reason: term(), + stacktrace: Exception.stacktrace() + } """ alias Elasticsearch.{ @@ -503,7 +526,9 @@ defmodule Elasticsearch do :telemetry.span([:elasticsearch, :request], start_metadata, fn -> result = config.api.request(config, method, url, data, opts) - {result, %{result: result}} + stop_metadata = Map.merge(start_metadata, %{result: result}) + + {result, stop_metadata} end) end