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": [
"24.2",
"23.3.4.10",
"22.3.4.24"
"25.1.2",
"24.3.4.6",
"23.3.4.18"
],
"elixir_version": [
"1.13.1",
"1.14.2",
"1.13.4",
"1.12.3",
"1.11.4"
],
"rebar3_version": [
"3.16.1"
"3.20"
],
"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": [
"24.2",
"23.3.4.10",
"22.3.4.24"
"25.1.2",
"24.3.4.6",
"23.3.4.10"
],
"rebar3_version": [
"3.16.1"
"3.20"
],
"os": [
"ubuntu-18.04"
"ubuntu-20.04"
]
}

View File

@ -5,22 +5,28 @@ on:
branches:
- 'main'
types: [opened, reopened, synchronize, labeled]
push:
branches:
- 'main'
concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Read file
id: set-matrix
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\"]}"
echo "::set-output name=matrix::$matrixStringifiedObject"
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 "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
echo "matrix_exclude="
opentelemetry-ecto:
needs: [test-matrix]
if: (contains(github.event.pull_request.labels.*.name, 'elixir') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_ecto'))
@ -29,7 +35,7 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
@ -45,14 +51,14 @@ jobs:
POSTGRES_DB: opentelemetry_ecto_test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -76,20 +82,20 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -113,7 +119,7 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
@ -123,14 +129,14 @@ jobs:
image: redis:alpine
ports: ['6379:6379']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -154,20 +160,20 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -191,20 +197,20 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -228,7 +234,7 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
@ -243,14 +249,14 @@ jobs:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: opentelemetry_oban_test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -274,20 +280,20 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps
@ -311,20 +317,20 @@ jobs:
defaults:
run:
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 }})
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
rebar3-version: ${{ matrix.rebar3_version }}
- name: Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/deps

View File

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

View File

@ -54,7 +54,7 @@ defmodule OpentelemetryFinch do
"net.peer.port": meta.request.port,
"http.target": meta.request.path,
"http.method": meta.request.method,
"http.status_code": status,
"http.status_code": status
}
s =
@ -65,7 +65,10 @@ defmodule OpentelemetryFinch 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
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)
assert_receive {:span,
span(
name: "HTTP GET",
kind: :client,
attributes: attributes
)}
span(
name: "HTTP GET",
kind: :client,
attributes: attributes
)}
assert %{
"net.peer.name": "localhost",
"http.method": "GET",
"http.target": "/",
"http.scheme": :http,
"http.status_code": 200
} = :otel_attributes.map(attributes)
"net.peer.name": "localhost",
"http.method": "GET",
"http.target": "/",
"http.scheme": :http,
"http.status_code": 200
} = :otel_attributes.map(attributes)
end
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)
assert_receive {:span,
span(
name: "HTTP GET",
kind: :client,
status: {:status, :error, "connection refused"},
attributes: attributes
)}
span(
name: "HTTP GET",
kind: :client,
status: {:status, :error, "connection refused"},
attributes: attributes
)}
assert %{
"net.peer.name": "localhost",
"http.method": "GET",
"http.target": "/",
"http.scheme": :http,
"http.status_code": 0
} = :otel_attributes.map(attributes)
"net.peer.name": "localhost",
"http.method": "GET",
"http.target": "/",
"http.scheme": :http,
"http.status_code": 0
} = :otel_attributes.map(attributes)
end
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
test "uses generic route name when opentelemetry middleware is configured before path params middleware",
%{
bypass: bypass
} do
%{
bypass: bypass
} do
defmodule TestClient do
def get(client) do
params = [id: '3']
@ -61,9 +61,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
end
test "uses low-cardinality method name when path params middleware is not used",
%{
bypass: bypass
} do
%{
bypass: bypass
} do
defmodule TestClient do
def get(client) do
Tesla.get(client, "/users/")
@ -92,9 +92,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
end
test "uses custom span name when passed in middleware opts",
%{
bypass: bypass
} do
%{
bypass: bypass
} do
defmodule TestClient do
def get(client) do
params = [id: '3']
@ -126,9 +126,9 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
end
test "uses custom span name function when passed in middleware opts",
%{
bypass: bypass
} do
%{
bypass: bypass
} do
defmodule TestClient do
def get(client) do
params = [id: '3']
@ -139,9 +139,10 @@ defmodule Tesla.Middleware.OpenTelemetryTest do
def client(url) do
middleware = [
{Tesla.Middleware.BaseUrl, url},
{Tesla.Middleware.OpenTelemetry, span_name: fn env ->
"#{String.upcase(to_string(env.method))} potato"
end},
{Tesla.Middleware.OpenTelemetry,
span_name: fn env ->
"#{String.upcase(to_string(env.method))} potato"
end},
Tesla.Middleware.PathParams
]