Fix CI errors, update GHA deps, update versions (#125)

* Fix CI errors, update GHA deps, update versions

* output syntax

* remove OTP 22 tests

* set concurrency to cancel in progress

* whitespace

* incompatible vsns and failed test

* Try pulling excludes out

* Escaping

* Just drop < 1.13 until this can move to workflows

* quote
This commit is contained in:
Bryan Naegele 2022-11-15 16:22:28 -07:00 committed by GitHub
parent a71bf882cc
commit 0e6a776ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 121 additions and 94 deletions

View File

@ -1,3 +0,0 @@
[
inputs: ["{mix,.formatter}.exs", "{examples,instrumentation,propagators,test}/**/*.{ex,exs}"]
]

View File

@ -1,18 +1,29 @@
{ {
"otp_version": [ "otp_version": [
"24.2", "25.1.2",
"23.3.4.10", "24.3.4.6",
"22.3.4.24" "23.3.4.18"
], ],
"elixir_version": [ "elixir_version": [
"1.13.1", "1.14.2",
"1.13.4",
"1.12.3", "1.12.3",
"1.11.4" "1.11.4"
], ],
"rebar3_version": [ "rebar3_version": [
"3.16.1" "3.20"
], ],
"os": [ "os": [
"ubuntu-18.04" "ubuntu-20.04"
],
"exclude": [
{
"elixir_version": "1.11.4",
"erlang_version": "25.1.2"
},
{
"elixir_version": "1.12.3",
"erlang_version": "25.1.2"
}
] ]
} }

View File

@ -1,13 +1,13 @@
{ {
"otp_version": [ "otp_version": [
"24.2", "25.1.2",
"23.3.4.10", "24.3.4.6",
"22.3.4.24" "23.3.4.10"
], ],
"rebar3_version": [ "rebar3_version": [
"3.16.1" "3.20"
], ],
"os": [ "os": [
"ubuntu-18.04" "ubuntu-20.04"
] ]
} }

View File

@ -5,22 +5,28 @@ on:
branches: branches:
- 'main' - 'main'
types: [opened, reopened, synchronize, labeled] types: [opened, reopened, synchronize, labeled]
push: push:
branches: branches:
- 'main' - 'main'
concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs: jobs:
test-matrix: test-matrix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }} matrix: ${{ steps.set-matrix.outputs.matrix }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Read file - name: Read file
id: set-matrix id: set-matrix
run: | run: |
matrixStringifiedObject="{\"otp_version\":[\"24.2\",\"23.3.4.10\",\"22.3.4.24\"],\"elixir_version\":[\"1.13.1\",\"1.12.3\",\"1.11.4\"],\"rebar3_version\":[\"3.16.1\"],\"os\":[\"ubuntu-18.04\"]}" matrixStringifiedObject="{\"otp_version\":[\"25.1.2\",\"24.3.4.6\",\"23.3.4.18\"],\"elixir_version\":[\"1.14.2\",\"1.13.4\"],\"rebar3_version\":[\"3.20\"],\"os\":[\"ubuntu-20.04\"]}"
echo "::set-output name=matrix::$matrixStringifiedObject" echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
echo "matrix_exclude="
opentelemetry-ecto: opentelemetry-ecto:
needs: [test-matrix] needs: [test-matrix]
if: (contains(github.event.pull_request.labels.*.name, 'elixir') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_ecto')) if: (contains(github.event.pull_request.labels.*.name, 'elixir') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_ecto'))
@ -29,7 +35,7 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Ecto test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Ecto test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
@ -45,14 +51,14 @@ jobs:
POSTGRES_DB: opentelemetry_ecto_test POSTGRES_DB: opentelemetry_ecto_test
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -76,20 +82,20 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Phoenix test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Phoenix test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -113,7 +119,7 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Redix test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Redix test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
@ -123,14 +129,14 @@ jobs:
image: redis:alpine image: redis:alpine
ports: ['6379:6379'] ports: ['6379:6379']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -154,20 +160,20 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Finch test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Finch test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -191,20 +197,20 @@ jobs:
defaults: defaults:
run: run:
working-directory: utilities/${{ env.app }} working-directory: utilities/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Telemetry test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Telemetry test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -228,7 +234,7 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Oban test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Oban test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
@ -243,14 +249,14 @@ jobs:
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
POSTGRES_DB: opentelemetry_oban_test POSTGRES_DB: opentelemetry_oban_test
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -274,20 +280,20 @@ jobs:
defaults: defaults:
run: run:
working-directory: propagators/${{ env.app }} working-directory: propagators/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Process Propagator test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Process Propagator test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps
@ -311,20 +317,20 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Tesla test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Tesla test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }} elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/deps ~/deps

View File

@ -5,22 +5,27 @@ on:
branches: branches:
- 'main' - 'main'
types: [opened, reopened, synchronize, labeled] types: [opened, reopened, synchronize, labeled]
push: push:
branches: branches:
- 'main' - 'main'
concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs: jobs:
test-matrix: test-matrix:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }} matrix: ${{ steps.set-matrix.outputs.matrix }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Read file - name: Read file
id: set-matrix id: set-matrix
run: | run: |
matrixStringifiedObject="{\"otp_version\":[\"24.2\",\"23.3.4.10\",\"22.3.4.24\"],\"rebar3_version\":[\"3.16.1\"],\"os\":[\"ubuntu-18.04\"]}" matrixStringifiedObject="{\"otp_version\":[\"25.1.2\",\"24.3.4.6\",\"23.3.4.10\"],\"rebar3_version\":[\"3.20\"],\"os\":[\"ubuntu-20.04\"]}"
echo "::set-output name=matrix::$matrixStringifiedObject" echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
opentelemetry-cowboy: opentelemetry-cowboy:
needs: [test-matrix] needs: [test-matrix]
if: (contains(github.event.pull_request.labels.*.name, 'erlang') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_cowboy')) if: (contains(github.event.pull_request.labels.*.name, 'erlang') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_cowboy'))
@ -29,19 +34,19 @@ jobs:
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Cowboy test on OTP ${{ matrix.otp_version }} with Rebar3 ${{ matrix.rebar3_version }} name: Opentelemetry Cowboy test on OTP ${{ matrix.otp_version }} with Rebar3 ${{ matrix.rebar3_version }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/_build ~/_build
@ -60,19 +65,19 @@ jobs:
defaults: defaults:
run: run:
working-directory: utilities/${{ env.app }} working-directory: utilities/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry Telemetry test on OTP ${{ matrix.otp_version }} with Rebar3 ${{ matrix.rebar3_version }} name: Opentelemetry Telemetry test on OTP ${{ matrix.otp_version }} with Rebar3 ${{ matrix.rebar3_version }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/_build ~/_build
@ -91,19 +96,19 @@ jobs:
defaults: defaults:
run: run:
working-directory: utilities/${{ env.app }} working-directory: utilities/${{ env.app }}
runs-on: ubuntu-18.04 runs-on: ubuntu-20.04
name: Opentelemetry AWS X-Ray test on OTP ${{ matrix.otp_version }} with Rebar3 ${{ matrix.rebar3_version }} name: Opentelemetry AWS X-Ray test on OTP ${{ matrix.otp_version }} with Rebar3 ${{ matrix.rebar3_version }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1
with: with:
otp-version: ${{ matrix.otp_version }} otp-version: ${{ matrix.otp_version }}
rebar3-version: ${{ matrix.rebar3_version }} rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/_build ~/_build

View File

@ -54,7 +54,7 @@ defmodule OpentelemetryFinch do
"net.peer.port": meta.request.port, "net.peer.port": meta.request.port,
"http.target": meta.request.path, "http.target": meta.request.path,
"http.method": meta.request.method, "http.method": meta.request.method,
"http.status_code": status, "http.status_code": status
} }
s = s =
@ -65,7 +65,10 @@ defmodule OpentelemetryFinch do
}) })
if meta.result |> elem(0) == :error do if meta.result |> elem(0) == :error do
OpenTelemetry.Span.set_status(s, OpenTelemetry.status(:error, format_error(meta.result |> elem(1)))) OpenTelemetry.Span.set_status(
s,
OpenTelemetry.status(:error, format_error(meta.result |> elem(1)))
)
end end
OpenTelemetry.Span.end_span(s) OpenTelemetry.Span.end_span(s)

View File

@ -36,19 +36,19 @@ defmodule OpentelemetryFinchTest do
{:ok, _} = Finch.build(:get, endpoint_url(bypass.port)) |> Finch.request(HttpFinch) {:ok, _} = Finch.build(:get, endpoint_url(bypass.port)) |> Finch.request(HttpFinch)
assert_receive {:span, assert_receive {:span,
span( span(
name: "HTTP GET", name: "HTTP GET",
kind: :client, kind: :client,
attributes: attributes attributes: attributes
)} )}
assert %{ assert %{
"net.peer.name": "localhost", "net.peer.name": "localhost",
"http.method": "GET", "http.method": "GET",
"http.target": "/", "http.target": "/",
"http.scheme": :http, "http.scheme": :http,
"http.status_code": 200 "http.status_code": 200
} = :otel_attributes.map(attributes) } = :otel_attributes.map(attributes)
end end
test "records span on requests failed", %{bypass: _} do test "records span on requests failed", %{bypass: _} do
@ -59,20 +59,20 @@ defmodule OpentelemetryFinchTest do
{:error, _} = Finch.build(:get, endpoint_url(3333)) |> Finch.request(HttpFinch) {:error, _} = Finch.build(:get, endpoint_url(3333)) |> Finch.request(HttpFinch)
assert_receive {:span, assert_receive {:span,
span( span(
name: "HTTP GET", name: "HTTP GET",
kind: :client, kind: :client,
status: {:status, :error, "connection refused"}, status: {:status, :error, "connection refused"},
attributes: attributes attributes: attributes
)} )}
assert %{ assert %{
"net.peer.name": "localhost", "net.peer.name": "localhost",
"http.method": "GET", "http.method": "GET",
"http.target": "/", "http.target": "/",
"http.scheme": :http, "http.scheme": :http,
"http.status_code": 0 "http.status_code": 0
} = :otel_attributes.map(attributes) } = :otel_attributes.map(attributes)
end end
defp endpoint_url(port), do: "http://localhost:#{port}/" defp endpoint_url(port), do: "http://localhost:#{port}/"

View File

@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

View File

@ -27,9 +27,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
describe "span name" do describe "span name" do
test "uses generic route name when opentelemetry middleware is configured before path params middleware", test "uses generic route name when opentelemetry middleware is configured before path params middleware",
%{ %{
bypass: bypass bypass: bypass
} do } do
defmodule TestClient do defmodule TestClient do
def get(client) do def get(client) do
params = [id: '3'] params = [id: '3']
@ -61,9 +61,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
end end
test "uses low-cardinality method name when path params middleware is not used", test "uses low-cardinality method name when path params middleware is not used",
%{ %{
bypass: bypass bypass: bypass
} do } do
defmodule TestClient do defmodule TestClient do
def get(client) do def get(client) do
Tesla.get(client, "/users/") Tesla.get(client, "/users/")
@ -92,9 +92,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
end end
test "uses custom span name when passed in middleware opts", test "uses custom span name when passed in middleware opts",
%{ %{
bypass: bypass bypass: bypass
} do } do
defmodule TestClient do defmodule TestClient do
def get(client) do def get(client) do
params = [id: '3'] params = [id: '3']
@ -126,9 +126,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
end end
test "uses custom span name function when passed in middleware opts", test "uses custom span name function when passed in middleware opts",
%{ %{
bypass: bypass bypass: bypass
} do } do
defmodule TestClient do defmodule TestClient do
def get(client) do def get(client) do
params = [id: '3'] params = [id: '3']
@ -139,9 +139,10 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
def client(url) do def client(url) do
middleware = [ middleware = [
{Tesla.Middleware.BaseUrl, url}, {Tesla.Middleware.BaseUrl, url},
{Tesla.Middleware.OpenTelemetry, span_name: fn env -> {Tesla.Middleware.OpenTelemetry,
"#{String.upcase(to_string(env.method))} potato" span_name: fn env ->
end}, "#{String.upcase(to_string(env.method))} potato"
end},
Tesla.Middleware.PathParams Tesla.Middleware.PathParams
] ]