diff --git a/config/config.exs b/config/config.exs index bcc17b7..23afe79 100644 --- a/config/config.exs +++ b/config/config.exs @@ -2,18 +2,4 @@ # and its dependencies with the aid of the Mix.Config module. use Mix.Config -config :git_ops, - mix_project: Spandex.Mixfile, - changelog_file: "CHANGELOG.md", - repository_url: "https://github.com/spandex-project/spandex", - types: [], - # Instructs the tool to manage your mix version in your `mix.exs` file - # See below for more information - manage_mix_version?: true, - # Instructs the tool to manage the version in your README.md - # Pass in `true` to use `"README.md"` or a string to customize - manage_readme_version: "README.md" - -if Mix.env() == :test do - import_config "./test.exs" -end +import_config "#{Mix.env()}.exs" diff --git a/config/dev.exs b/config/dev.exs new file mode 100644 index 0000000..da44dcd --- /dev/null +++ b/config/dev.exs @@ -0,0 +1,15 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Mix.Config module. +use Mix.Config + +config :git_ops, + mix_project: Spandex.Mixfile, + changelog_file: "CHANGELOG.md", + repository_url: "https://github.com/spandex-project/spandex", + types: [], + # Instructs the tool to manage your mix version in your `mix.exs` file + # See below for more information + manage_mix_version?: true, + # Instructs the tool to manage the version in your README.md + # Pass in `true` to use `"README.md"` or a string to customize + manage_readme_version: "README.md" diff --git a/mix.lock b/mix.lock index 63b1cca..27cb226 100644 --- a/mix.lock +++ b/mix.lock @@ -1,37 +1,32 @@ %{ "benchee": {:hex, :benchee, "0.13.2", "30cd4ff5f593fdd218a9b26f3c24d580274f297d88ad43383afe525b1543b165", [:mix], [{:deep_merge, "~> 0.1", [hex: :deep_merge, repo: "hexpm", optional: false]}], "hexpm", "d8b3f1720073413c36a21e56a1d1112a4d67a9ad0ec900437efed08b39e515b2"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, - "certifi": {:hex, :certifi, "2.4.2", "75424ff0f3baaccfd34b1214184b6ef616d89e420b258bb0a5ea7d7bc628f7f0", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "01d479edba0569a7b7a2c8bf923feeb6dc6a358edc2965ef69aea9ba288bb243"}, - "credo": {:hex, :credo, "0.9.2", "841d316612f568beb22ba310d816353dddf31c2d94aa488ae5a27bb53760d0bf", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm", "8394e6ad3f53b74a75013f79b8104c935add0247ec5dfcde7f444ffe509000c0"}, - "decorator": {:hex, :decorator, "1.2.3", "258681ae943e57bd92d821ea995e3994b4e0b62ae8404b5d892cb8b23b55b050", [:mix], [], "hexpm", "9f632910acfbeb875e538206286834f1bf062fb837b0a25f0c9fe4ee1f0edf71"}, + "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, + "credo": {:hex, :credo, "0.9.3", "76fa3e9e497ab282e0cf64b98a624aa11da702854c52c82db1bf24e54ab7c97a", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm", "dcd1d45626f6a02abeef3fc424eaf101b05a851d3cceb9535b8ea3e14c3c17e6"}, + "decorator": {:hex, :decorator, "1.3.2", "63b8ac9e23b28053390abdda33bb9e1f3dd9e8f9a981f47a06fc2f2fe2e2f772", [:mix], [], "hexpm", "b80bd089e3c8579e6d9ea84eed307b1597a0d94af25331e424a209477ad1a7fc"}, "deep_merge": {:hex, :deep_merge, "0.2.0", "c1050fa2edf4848b9f556fba1b75afc66608a4219659e3311d9c9427b5b680b3", [:mix], [], "hexpm", "e3bf435a54ed27b0ba3a01eb117ae017988804e136edcbe8a6a14c310daa966e"}, - "dialyxir": {:hex, :dialyxir, "0.5.0", "5bc543f9c28ecd51b99cc1a685a3c2a1a93216990347f259406a910cf048d1d7", [:mix], [], "hexpm", "7c5c6c1eceb93e26a06c36148cb6f8021ae6f4f9a07bb1ae95f588e0a01ea8e1"}, - "earmark": {:hex, :earmark, "1.2.6", "b6da42b3831458d3ecc57314dff3051b080b9b2be88c2e5aa41cd642a5b044ed", [:mix], [], "hexpm", "b42a23e9bd92d65d16db2f75553982e58519054095356a418bb8320bbacb58b1"}, - "ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "dc87f778d8260da0189a622f62790f6202af72f2f3dee6e78d91a18dd2fcd137"}, - "exactor": {:hex, :exactor, "2.2.3", "a6972f43bb6160afeb73e1d8ab45ba604cd0ac8b5244c557093f6e92ce582786", [:mix], []}, - "excoveralls": {:hex, :excoveralls, "0.10.1", "407d50ac8fc63dfee9175ccb4548e6c5512b5052afa63eedb9cd452a32a91495", [:mix], [{:hackney, "~> 1.13", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "afa0d55f95f050d89692bc1ce99557972ff4f5adaac812a2361014f16439d646"}, - "exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4526f4d2a1e976f4b428d347614f0f", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, optional: false]}]}, - "exvcr": {:hex, :exvcr, "0.8.11", "76d6f3f93cb764ccb34abca3f54ecdd980a178f908d175e6a326535e0f18e863", [:mix], [{:exactor, "~> 2.2", [hex: :exactor, optional: false]}, {:exjsx, "~> 3.2", [hex: :exjsx, optional: false]}, {:httpoison, "~> 0.11", [hex: :httpoison, optional: true]}, {:httpotion, "~> 3.0", [hex: :httpotion, optional: true]}, {:ibrowse, "~> 4.2.2", [hex: :ibrowse, optional: true]}, {:meck, "~> 0.8.3", [hex: :meck, optional: false]}]}, + "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm", "6c32a70ed5d452c6650916555b1f96c79af5fc4bf286997f8b15f213de786f73"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, + "ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"}, + "excoveralls": {:hex, :excoveralls, "0.13.2", "5ca05099750c086f144fcf75842c363fc15d7d9c6faa7ad323d010294ced685e", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1e7ed75c158808a5a8f019d3ad63a5efe482994f2f8336c0a8c77d2f0ab152ce"}, "git_cli": {:hex, :git_cli, "0.3.0", "a5422f9b95c99483385b976f5d43f7e8233283a47cda13533d7c16131cb14df5", [:mix], [], "hexpm", "78cb952f4c86a41f4d3511f1d3ecb28edb268e3a7df278de2faa1bd4672eaf9b"}, - "git_ops": {:hex, :git_ops, "2.0.0", "d720b54de2ce9ca242164c57c982e4f05c1b6c020db2785e338f93b6190980aa", [:mix], [{:git_cli, "~> 0.2", [hex: :git_cli, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "9aa270ea1cd4500eac4f38cac9b24019eee0aa524b96c95ad2f90cb0010840db"}, - "hackney": {:hex, :hackney, "1.14.3", "b5f6f5dcc4f1fba340762738759209e21914516df6be440d85772542d4a5e412", [:rebar3], [{:certifi, "2.4.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "ed15491f324aa0e95647dca8ef4340418dac479d1204d57e455d52dcfba3f705"}, - "httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, - "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"}, - "inch_ex": {:git, "https://github.com/rrrene/inch_ex.git", "ff86f20c3ba25de3434d70a87904c1250f795400", []}, - "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"}, - "jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [:mix, :rebar3], []}, - "makeup": {:hex, :makeup, "1.0.1", "82f332e461dc6c79dbd82fbe2a9c10d48ed07146f0a478286e590c83c52010b5", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "49736fe5b66a08d8575bf5321d716bac5da20c8e6b97714fec2bcd6febcfa1f8"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"}, - "meck": {:hex, :meck, "0.8.7", "ebad16ca23f685b07aed3bc011efff65fbaf28881a8adf925428ef5472d390ee", [:rebar3], []}, + "git_ops": {:hex, :git_ops, "2.0.1", "9d3df6c710a80a8779dbb144c79fb24c777660ae862cc454ab3193afd0c02a37", [:mix], [{:git_cli, "~> 0.2", [hex: :git_cli, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 0.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cd499a72523ba338c20973eadb707d25a42e4a77c46d2ff5c45e61e7adae6190"}, + "hackney": {:hex, :hackney, "1.16.0", "5096ac8e823e3a441477b2d187e30dd3fff1a82991a806b2003845ce72ce2d84", [:rebar3], [{:certifi, "2.5.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.0", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3bf0bebbd5d3092a3543b783bf065165fa5d3ad4b899b836810e513064134e18"}, + "idna": {:hex, :idna, "6.0.1", "1d038fb2e7668ce41fbf681d2c45902e52b3cb9e9c77b55334353b222c2ee50c", [:rebar3], [{:unicode_util_compat, "0.5.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a02c8a1c4fd601215bb0b0324c8a6986749f807ce35f25449ec9e69758708122"}, + "inch_ex": {:git, "https://github.com/rrrene/inch_ex.git", "c8eeaa65312df3ce150e91d7dddb50e2983b3209", []}, + "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, + "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], [], "hexpm", "33dd09e615daab5668c15cc3a33829892728fdbed910ab0c0a0edb06b45fc54d"}, - "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm", "7a4c8e1115a2732a67d7624e28cf6c9f30c66711a9e92928e745c255887ba465"}, - "msgpax": {:hex, :msgpax, "1.1.0", "e31625e256db2decca1ae2b841f21b4d2483b1332649ce3ebc96c7ff7a4986e3", [:mix], [{:plug, "~> 1.0", [hex: :plug, optional: true]}]}, + "mime": {:hex, :mime, "1.4.0", "5066f14944b470286146047d2f73518cf5cca82f8e4815cf35d196b58cf07c47", [:mix], [], "hexpm", "75fa42c4228ea9a23f70f123c74ba7cece6a03b1fd474fe13f6a7a85c6ea4ff6"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, "nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"}, - "optimal": {:hex, :optimal, "0.3.3", "467d0e9678a92202e3598537b802d868cb982142dff0b8ec2ada53ef612ccf14", [:mix], [], "hexpm", "f1e7167755e5534f1bb12ae63718cd9feab142e4a0fbd137bd1596c98c1485da"}, + "optimal": {:hex, :optimal, "0.3.6", "46bbf52fbbbd238cda81e02560caa84f93a53c75620f1fe19e81e4ae7b07d1dd", [:mix], [], "hexpm", "1a06ea6a653120226b35b283a1cd10039550f2c566edcdec22b29316d73640fd"}, "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, - "plug": {:hex, :plug, "1.3.5", "7503bfcd7091df2a9761ef8cecea666d1f2cc454cbbaf0afa0b6e259203b7031", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm", "141058cca1fa800128391ece7f442f71a7b42a7411e6eaa56dc8f85283c8dde7"}, + "plug": {:hex, :plug, "1.10.4", "41eba7d1a2d671faaf531fa867645bd5a3dce0957d8e2a3f398ccff7d2ef017f", [:mix], [{:mime, "~> 1.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", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad1e233fe73d2eec56616568d260777b67f53148a999dc2d048f4eb9778fe4a0"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.0", "1cb20793aa63a6c619dd18bb33d7a3aa94818e5fd39ad357051a67f26dfa2df6", [:mix], [], "hexpm", "a48b538ae8bf381ffac344520755f3007cc10bd8e90b240af98ea29b69683fc2"}, "poison": {:hex, :poison, "4.0.1", "bcb755a16fac91cad79bfe9fc3585bb07b9331e50cfe3420a24bcc2d735709ae", [:mix], [], "hexpm", "ba8836feea4b394bb718a161fc59a288fe0109b5006d6bdf97b6badfcf6f0f25"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.4", "f0eafff810d2041e93f915ef59899c923f4568f4585904d010387ed74988e77b", [:make, :mix, :rebar3], [], "hexpm", "603561dc0fd62f4f2ea9b890f4e20e1a0d388746d6e20557cafb1b16950de88c"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"}, } diff --git a/test/spandex_test.exs b/test/spandex_test.exs index fa33d8b..2466546 100644 --- a/test/spandex_test.exs +++ b/test/spandex_test.exs @@ -76,10 +76,10 @@ defmodule Spandex.Test.SpandexTest do describe "Spandex.start_span/2" do test "creates a new Span under the active Span with the given name" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{id: root_span_id} = Spandex.current_span(@base_opts) assert {:ok, %Span{} = span} = Spandex.start_span("span_name", opts) - assert %Span{id: span_id, name: "span_name", parent_id: ^root_span_id} = span + assert %Span{id: _span_id, name: "span_name", parent_id: ^root_span_id} = span end test "returns an error if there is not a trace in progress" do @@ -93,14 +93,14 @@ defmodule Spandex.Test.SpandexTest do test "inherits service and resource from parent span if not specified" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:ok, %Span{} = span} = Spandex.start_span("span_name", @base_opts) assert %Span{name: "span_name", service: :test_service, resource: "test_resource"} = span end test "returns an error if invalid options are specified" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:error, validation_errors} = Spandex.start_span("span_name", @base_opts ++ [type: "not an atom"]) @@ -125,9 +125,9 @@ defmodule Spandex.Test.SpandexTest do describe "Spandex.update_span/1" do test "modifies the current span" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{} = root_span = Spandex.current_span(@base_opts) - assert {:ok, %Span{} = span} = Spandex.start_span("span_name", opts) + assert {:ok, %Span{} = _span} = Spandex.start_span("span_name", opts) updated_opts = Keyword.put(@base_opts, :sql_query, query: "SELECT * FROM users;") assert {:ok, %Span{} = span} = Spandex.update_span(updated_opts) @@ -157,7 +157,7 @@ defmodule Spandex.Test.SpandexTest do test "returns an error if invalid options are specified" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:error, validation_errors} = Spandex.update_span(@base_opts ++ [type: "not an atom"]) @@ -168,9 +168,9 @@ defmodule Spandex.Test.SpandexTest do describe "Spandex.update_span/2" do test "with false as the second argument, acts like update_span/1" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{} = root_span = Spandex.current_span(@base_opts) - assert {:ok, %Span{} = span} = Spandex.start_span("span_name", opts) + assert {:ok, %Span{} = _span} = Spandex.start_span("span_name", opts) updated_opts = Keyword.put(@base_opts, :sql_query, query: "SELECT * FROM users;") assert {:ok, %Span{} = span} = Spandex.update_span(updated_opts) @@ -184,7 +184,7 @@ defmodule Spandex.Test.SpandexTest do test "with true as the second argument, acts like update_top_span/1" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{id: root_span_id} = Spandex.current_span(@base_opts) assert {:ok, %Span{id: span_id}} = Spandex.start_span("span_name", opts) @@ -201,7 +201,7 @@ defmodule Spandex.Test.SpandexTest do describe "Spandex.update_top_span/1" do test "modifies the root span in the trace" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{id: root_span_id} = Spandex.current_span(@base_opts) assert {:ok, %Span{id: span_id}} = Spandex.start_span("span_name", opts) @@ -225,7 +225,7 @@ defmodule Spandex.Test.SpandexTest do test "returns an error if invalid options are specified" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:error, validation_errors} = Spandex.update_top_span(@base_opts ++ [type: "not an atom"]) @@ -260,7 +260,7 @@ defmodule Spandex.Test.SpandexTest do test "returns an error if invalid options are specified" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:error, validation_errors} = Spandex.update_all_spans(@base_opts ++ [type: "not an atom"]) @@ -271,7 +271,7 @@ defmodule Spandex.Test.SpandexTest do describe "Spandex.finish_trace/1" do test "sends all spans to the Adapter's default sender by default" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{id: root_span_id} = Spandex.current_span(@base_opts) assert {:ok, %Span{id: span_id}} = Spandex.start_span("span_name", opts) @@ -287,7 +287,7 @@ defmodule Spandex.Test.SpandexTest do test "sends spans to an overridden sender" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert %Span{id: root_span_id} = Spandex.current_span(@base_opts) assert {:ok, %Span{id: span_id}} = Spandex.start_span("span_name", opts) @@ -303,9 +303,9 @@ defmodule Spandex.Test.SpandexTest do test "ensures all spans have a completion time" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) - assert %Span{id: root_span_id} = Spandex.current_span(@base_opts) - assert {:ok, %Span{id: span_id}} = Spandex.start_span("span_name", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) + assert %Span{id: _root_span_id} = Spandex.current_span(@base_opts) + assert {:ok, %Span{id: _span_id}} = Spandex.start_span("span_name", opts) assert {:ok, _} = Spandex.finish_trace(@base_opts) spans = Util.sent_spans() @@ -346,9 +346,9 @@ defmodule Spandex.Test.SpandexTest do test "does not return an error if invalid update options are supplied" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) - assert {:ok, %Trace{id: trace_id}} = Spandex.finish_trace(@base_opts ++ [type: "not an atom"]) + assert {:ok, %Trace{id: _trace_id}} = Spandex.finish_trace(@base_opts ++ [type: "not an atom"]) end end @@ -406,7 +406,7 @@ defmodule Spandex.Test.SpandexTest do test "ignores any span update failures" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:ok, %Span{}} = Spandex.finish_span(@base_opts ++ [type: "not an atom"]) end @@ -440,7 +440,7 @@ defmodule Spandex.Test.SpandexTest do test "returns an error if invalid options are specified" do opts = @base_opts ++ @span_opts - assert {:ok, %Trace{id: trace_id}} = Spandex.start_trace("root_span", opts) + assert {:ok, %Trace{id: _trace_id}} = Spandex.start_trace("root_span", opts) assert {:error, validation_errors} = Spandex.span_error( diff --git a/test/support/adapter.ex b/test/support/adapter.ex index 4cac3b3..d003461 100644 --- a/test/support/adapter.ex +++ b/test/support/adapter.ex @@ -98,11 +98,6 @@ defmodule Spandex.TestAdapter do |> List.first() end - defp get_header(headers, key) do - for {^key, value} <- headers, do: value - end - - @spec get_first_header(conn :: Plug.Conn.t(), header_name :: binary) :: binary | nil defp get_first_header(conn, header_name) do conn |> Plug.Conn.get_req_header(header_name) @@ -110,6 +105,10 @@ defmodule Spandex.TestAdapter do |> parse_header() end + defp get_header(headers, key) do + for {^key, value} <- headers, do: value + end + defp parse_header(header) when is_bitstring(header) do case Integer.parse(header) do {int, _} -> int