Skip to content

Commit

Permalink
peep
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Feb 27, 2025
1 parent 749bfed commit 5a6dc03
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 13 deletions.
2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ config :sentry,
enable_source_code_context: true,
root_source_code_path: [File.cwd!()]

config :prom_ex, :storage_adapter, Plausible.PromEx.StripedPeep

import_config "#{config_env()}.exs"
25 changes: 25 additions & 0 deletions lib/plausible/prom_ex/striped_peep.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
defmodule Plausible.PromEx.StripedPeep do
@moduledoc """
"Striped" storage based on `PromEx.Storage.Peep`.
"""

@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 child_spec(name, metrics) do
opts = [
name: name,
metrics: metrics,
storage: :striped
]

Peep.child_spec(opts)
end
end
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ defmodule Plausible.MixProject do
{:eqrcode, "~> 0.1.10"},
{:ex_machina, "~> 2.3", only: [:dev, :test, :ce_dev, :ce_test]},
{:excoveralls, "~> 0.10", only: :test},
{:finch, "~> 0.17.0"},
{:finch, "~> 0.19.0"},
{:floki, "~> 0.36"},
{:fun_with_flags, "~> 1.11.0"},
{:fun_with_flags_ui, "~> 1.0"},
Expand Down Expand Up @@ -116,6 +116,7 @@ defmodule Plausible.MixProject do
{:plug_cowboy, "~> 2.3"},
{:postgrex, "~> 0.19.0"},
{:prom_ex, "~> 1.8"},
{:peep, "~> 3.4"},
{:public_suffix, git: "https://github.com/axelson/publicsuffix-elixir"},
{:ref_inspector, "~> 2.0"},
{:referrer_blocklist, git: "https://github.com/plausible/referrer-blocklist.git"},
Expand Down
Loading

0 comments on commit 5a6dc03

Please sign in to comment.