Skip to content

Commit

Permalink
Release 1.3.0 (#12)
Browse files Browse the repository at this point in the history
* Release 1.3.0

* Configure GitHub Actions

* Remove commented out lines

* Add missing comma

* Add missing comma

* Exclude invalid OTP-Elixir pairs

* Add comment to exclude

* Fix testing matrix

* Use actions/cache@v3

* Update all deps except Appsignal

* Update Appsignal and fix tests

* Remove unnecessary deps fetching when formatting

* Replace CircleCI shield with GitHub build shield
  • Loading branch information
kamilkowalski authored Nov 27, 2022
1 parent 9e66e9a commit 4fa7917
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 33 deletions.
13 changes: 0 additions & 13 deletions .circleci/config.yml

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Test

on:
pull_request:
branches:
- "main"
push:
branches:
- "main"

jobs:
format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "25.1.2"
elixir-version: "1.14.2"
- run: mix format --check-formatted
test:
name: Test on Elixir ${{ matrix.elixir }} (OTP ${{ matrix.otp }})
runs-on: ubuntu-latest
strategy:
matrix:
otp: ["23.3.4.18", "24.3.4.6"]
elixir: ["1.12.3", "1.13.4", "1.14.2"]
include:
# Only Elixir 1.14 supports OTP 25
- otp: "25.1.2"
elixir: "1.14.2"
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/cache@v3
name: Cache dependencies
with:
path: |
deps
key: deps-${{ hashFiles('mix.lock') }}
restore-keys: |
deps-${{ hashFiles('mix.lock') }}
deps-
- run: mix deps.get
- uses: actions/cache@v3
name: Cache build
with:
path: |
_build
key: build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
restore-keys: |
build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
- run: mix test

dialyze:
name: Dialyze on Elixir ${{ matrix.elixir }} (OTP ${{ matrix.otp }})
runs-on: ubuntu-latest
strategy:
matrix:
otp: ["23.3.4.18", "24.3.4.6"]
elixir: ["1.12.3", "1.13.4", "1.14.2"]
include:
# Only Elixir 1.14 supports OTP 25
- otp: "25.1.2"
elixir: "1.14.2"
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/cache@v3
name: Cache dependencies
with:
path: |
deps
key: deps-${{ hashFiles('mix.lock') }}
restore-keys: |
deps-${{ hashFiles('mix.lock') }}
deps-
- run: mix deps.get
- uses: actions/cache@v3
name: Cache build
with:
path: |
_build
key: build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
restore-keys: |
build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
- uses: actions/cache@v3
name: Restore PLT cache
id: plt_cache
with:
path: |
priv/plts
key: plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
restore-keys: |
plt-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- name: Run dialyzer
run: mix dialyzer --format github
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore Dialyzer's PLT files
/priv/plts/*.plt
/priv/plts/*.plt.hash

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.0] - 2022-11-26

### Added

- Support calculating metrics using both `measurements` and `metadata`, as introduced in `telemetry_metrics` [v0.6.0](https://github.com/beam-telemetry/telemetry_metrics/blob/main/CHANGELOG.md#060), by [@quinlanjager](https://github.com/quinlanjager).

## [1.2.1] - 2021-12-06

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TelemetryMetricsAppsignal

[![CircleCI](https://circleci.com/gh/surgeventures/telemetry_metrics_appsignal.svg?style=svg)](https://circleci.com/gh/surgeventures/telemetry_metrics_appsignal)
[![Hex pm](http://img.shields.io/hexpm/v/telemetry_metrics_appsignal.svg?style=flat)](https://hex.pm/packages/telemetry_metrics_appsignal)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/surgeventures/telemetry_metrics_appsignal/Test/main)](https://github.com/surgeventures/telemetry_metrics_appsignal/actions/workflows/test.yml?query=branch%3Amain)
[![Hex pm](http://img.shields.io/hexpm/v/telemetry_metrics_appsignal)](https://hex.pm/packages/telemetry_metrics_appsignal)

A `Telemetry.Metrics` reporter that pushes metrics to AppSignal. Requires [the AppSignal library](https://hexdocs.pm/appsignal) to be installed and configured.

Expand Down
8 changes: 6 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ defmodule TelemetryMetricsAppsignal.MixProject do
def project do
[
app: :telemetry_metrics_appsignal,
version: "1.2.1",
version: "1.3.0",
elixir: "~> 1.10",
elixirc_paths: elixirc_paths(Mix.env()),
source_url: "https://github.com/surgeventures/telemetry_metrics_appsignal",
start_permanent: Mix.env() == :prod,
deps: deps(),
description: description(),
package: package(),
docs: docs()
docs: docs(),
dialyzer: [
plt_file: {:no_warn, "priv/plts/dialyzer.plt"}
]
]
end

Expand All @@ -28,6 +31,7 @@ defmodule TelemetryMetricsAppsignal.MixProject do
defp deps do
[
{:appsignal, "~> 1.12 or ~> 2.0"},
{:dialyxir, "~> 1.0", only: :dev, runtime: false},
{:ex_doc, "~> 0.21", only: :dev, runtime: false},
{:hammox, "~> 0.2", only: :test},
{:jason, "~> 1.1", optional: true},
Expand Down
26 changes: 14 additions & 12 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
%{
"appsignal": {:hex, :appsignal, "2.2.2", "c71c3dfc45c6fdc03377353d46ba530207e8b8b33155bfdfcabd8fa252ac3b4c", [:make, :mix], [{:decorator, "~> 1.2.3 or ~> 1.3", [hex: :decorator, repo: "hexpm", optional: false]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, ">= 1.3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "223b0b48c1266211068936bc16b38d14fdf457e6b586fc00971175a2e0edc37f"},
"certifi": {:hex, :certifi, "2.8.0", "d4fb0a6bb20b7c9c3643e22507e42f356ac090a1dcea9ab99e27e0376d695eba", [:rebar3], [], "hexpm", "6ac7efc1c6f8600b08d625292d4bbf584e14847ce1b6b5c44d983d273e1097ea"},
"appsignal": {:hex, :appsignal, "2.4.1", "5df972d3d462ae18611c2213b6505d191a076b3b5310f5fcfb1d65b6cdeed662", [:make, :mix], [{:decorator, "~> 1.2.3 or ~> 1.3", [hex: :decorator, repo: "hexpm", optional: false]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, ">= 1.3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "792fa2afc17d637726b0a7b6fbfbcd864bbb64a405cca2ae266ed4ea7f268140"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"decorator": {:hex, :decorator, "1.4.0", "a57ac32c823ea7e4e67f5af56412d12b33274661bb7640ec7fc882f8d23ac419", [:mix], [], "hexpm", "0a07cedd9083da875c7418dea95b78361197cf2bf3211d743f6f7ce39656597f"},
"dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"},
"earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"},
"earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"},
"ex_doc": {:hex, :ex_doc, "0.25.3", "3edf6a0d70a39d2eafde030b8895501b1c93692effcbd21347296c18e47618ce", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "9ebebc2169ec732a38e9e779fd0418c9189b3ca93f4a676c961be6c1527913f5"},
"hackney": {:hex, :hackney, "1.18.0", "c4443d960bb9fba6d01161d01cd81173089686717d9490e5d3606644c48d121f", [:rebar3], [{:certifi, "~>2.8.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "9afcda620704d720db8c6a3123e9848d09c87586dc1c10479c42627b905b5c5e"},
"hammox": {:hex, :hammox, "0.5.0", "e621c7832a2226cd5ef4b20d16adc825d12735fd40c43e01527995a180823ca5", [:mix], [{:mox, "~> 1.0", [hex: :mox, repo: "hexpm", optional: false]}, {:ordinal, "~> 0.1", [hex: :ordinal, repo: "hexpm", optional: false]}], "hexpm", "15bf108989b894e87ef6778a2950025399bc8d69f344f319247b22531e32de2f"},
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"},
"hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},
"hammox": {:hex, :hammox, "0.7.0", "a49dc95e0a78e1c38db11c2b6eadff38f25418ef92ecf408bd90d95d459f35a2", [:mix], [{:mox, "~> 1.0", [hex: :mox, repo: "hexpm", optional: false]}, {:ordinal, "~> 0.1", [hex: :ordinal, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5e228c4587f23543f90c11394957878178c489fad46da421c37ca696e37dd91b"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"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.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"},
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"mox": {:hex, :mox, "1.0.0", "4b3c7005173f47ff30641ba044eb0fe67287743eec9bd9545e37f3002b0a9f8b", [:mix], [], "hexpm", "201b0a20b7abdaaab083e9cf97884950f8a30a1350a1da403b3145e213c6f4df"},
"nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"},
"mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
"ordinal": {:hex, :ordinal, "0.2.0", "d3eda0cb04ee1f0ca0aae37bf2cf56c28adce345fe56a75659031b6068275191", [:mix], [], "hexpm", "defca8f10dee9f03a090ed929a595303252700a9a73096b6f2f8d88341690d65"},
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
"telemetry": {:hex, :telemetry, "1.0.0", "0f453a102cdf13d506b7c0ab158324c337c41f1cc7548f0bc0e130bbf0ae9452", [:rebar3], [], "hexpm", "73bc09fa59b4a0284efb4624335583c528e07ec9ae76aca96ea0673850aec57a"},
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"},
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
}
17 changes: 13 additions & 4 deletions test/telemetry_metrics_appsignal_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ defmodule TelemetryMetricsAppsignalTest do

test "not providing metrics" do
start_reporter([])
attached_handlers = :telemetry.list_handlers([])
attached_handlers = fetch_attached_handlers()
actual_event_metrics = fetch_event_metrics(attached_handlers)

assert actual_event_metrics == %{}

stop_supervised!(TelemetryMetricsAppsignal)

attached_handlers = :telemetry.list_handlers([])
attached_handlers = fetch_attached_handlers()

assert attached_handlers == []
end
Expand All @@ -45,7 +45,7 @@ defmodule TelemetryMetricsAppsignalTest do

start_reporter(metrics: metrics)

attached_handlers = :telemetry.list_handlers([])
attached_handlers = fetch_attached_handlers()

event_metrics = %{
[:web, :request] => [Counter, Distribution],
Expand All @@ -58,7 +58,7 @@ defmodule TelemetryMetricsAppsignalTest do
assert actual_event_metrics == event_metrics

stop_supervised!(TelemetryMetricsAppsignal)
attached_handlers = :telemetry.list_handlers([])
attached_handlers = fetch_attached_handlers()

assert attached_handlers == []
end
Expand Down Expand Up @@ -280,6 +280,15 @@ defmodule TelemetryMetricsAppsignalTest do
Map.put_new(metadata, :value, "value")
end

defp fetch_attached_handlers do
[]
|> :telemetry.list_handlers()
|> Enum.filter(fn
%{id: {TelemetryMetricsAppsignal, _, _}} -> true
_ -> false
end)
end

defp fetch_event_metrics(attached_handlers) do
Enum.reduce(attached_handlers, %{}, fn handler, metrics_acc ->
handler_metrics = handler.config[:metrics]
Expand Down

0 comments on commit 4fa7917

Please sign in to comment.