Skip to content

Commit

Permalink
Making peep a nonoptional dep
Browse files Browse the repository at this point in the history
  • Loading branch information
akoutmos committed Aug 10, 2024
1 parent 6569b26 commit 541f37b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
3 changes: 1 addition & 2 deletions lib/prom_ex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ defmodule PromEx do
1. [TelemetryMetricsPrometheus.Core](https://github.com/beam-telemetry/telemetry_metrics_prometheus_core) - This is the
default adapter and is included with PromEx.
2. [Peep](https://github.com/rkallos/peep) - In order to use Peep as your storage adapter, you need to add `:peep`
to your list of dependencies like so: `{:peep, "~> 3.2"}`. After running `mix deps.get` you will need to add the following
2. [Peep](https://github.com/rkallos/peep) - In order to use Peep as your storage adapter, you will need to add the following
to your `config.exs` file:
```elixir
Expand Down
40 changes: 19 additions & 21 deletions lib/prom_ex/storage/peep.ex
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
if Code.ensure_loaded?(Peep) do
defmodule PromEx.Storage.Peep do
@moduledoc """
This store uses [Peep](https://github.com/rkallos/peep) as the storage
mechanism for metrics.
"""
defmodule PromEx.Storage.Peep do
@moduledoc """
This store uses [Peep](https://github.com/rkallos/peep) as the storage
mechanism for metrics.
"""

@behaviour PromEx.Storage
@behaviour PromEx.Storage

@impl true
def scrape(name) do
Peep.get_all_metrics(name)
|> Peep.Prometheus.export()
|> IO.iodata_to_binary()
end
@impl true
def scrape(name) do
Peep.get_all_metrics(name)
|> Peep.Prometheus.export()
|> IO.iodata_to_binary()
end

@impl true
def child_spec(name, metrics) do
opts = [
name: name,
metrics: metrics
]
@impl true
def child_spec(name, metrics) do
opts = [
name: name,
metrics: metrics
]

Peep.child_spec(opts)
end
Peep.child_spec(opts)
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ defmodule PromEx.MixProject do
{:telemetry_poller, "~> 1.1"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_metrics_prometheus_core, "~> 1.2"},
{:peep, "~> 2.0 or ~> 3.0", optional: true},
{:peep, "~> 3.0"},
{:plug_cowboy, ">= 2.6.0"},
{:octo_fetch, "~> 0.4"},

Expand Down

0 comments on commit 541f37b

Please sign in to comment.