From a1e4e139772373d92daa68262768de3f736f722c Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel Pinho Date: Fri, 19 Dec 2025 07:43:10 +1300 Subject: [PATCH 1/2] feat: use custom peep partitions --- lib/realtime/metrics_cleaner.ex | 2 +- lib/realtime/monitoring/prom_ex.ex | 2 +- mix.exs | 4 ++-- mix.lock | 2 +- test/realtime/monitoring/prometheus_test.exs | 16 ++++++++-------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/realtime/metrics_cleaner.ex b/lib/realtime/metrics_cleaner.ex index c81205e8e..20fd586d6 100644 --- a/lib/realtime/metrics_cleaner.ex +++ b/lib/realtime/metrics_cleaner.ex @@ -38,7 +38,7 @@ defmodule Realtime.MetricsCleaner do defp loop_and_cleanup_metrics_table do tenant_ids = Realtime.Tenants.Connect.list_tenants() |> MapSet.new() - {_, tid} = Peep.Persistent.storage(Realtime.PromEx.Metrics) + {_, {tid, _}} = Peep.Persistent.storage(Realtime.PromEx.Metrics) tid |> :ets.select(@peep_filter_spec) diff --git a/lib/realtime/monitoring/prom_ex.ex b/lib/realtime/monitoring/prom_ex.ex index b3a970d7d..f04d5ef01 100644 --- a/lib/realtime/monitoring/prom_ex.ex +++ b/lib/realtime/monitoring/prom_ex.ex @@ -82,7 +82,7 @@ defmodule Realtime.PromEx do name: name, metrics: metrics, global_tags: Application.get_env(:realtime, :metrics_tags, %{}), - storage: :default + storage: {:default, 4} ) end end diff --git a/mix.exs b/mix.exs index a05a85bb9..50dfb0b53 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do def project do [ app: :realtime, - version: "2.68.7", + version: "2.69.0", elixir: "~> 1.18", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, @@ -74,7 +74,7 @@ defmodule Realtime.MixProject do {:libcluster_postgres, "~> 0.2"}, {:uuid, "~> 1.1"}, {:prom_ex, "~> 1.10"}, - {:peep, "~> 4.0", override: true}, + {:peep, git: "https://github.com/supabase/peep.git", branch: "feat/partitions-ets", override: true}, {:joken, "~> 2.5.0"}, {:ex_json_schema, "~> 0.7"}, {:recon, "~> 2.5"}, diff --git a/mix.lock b/mix.lock index 4bea2e730..df8e18f95 100644 --- a/mix.lock +++ b/mix.lock @@ -66,7 +66,7 @@ "opentelemetry_semantic_conventions": {:hex, :opentelemetry_semantic_conventions, "1.27.0", "acd0194a94a1e57d63da982ee9f4a9f88834ae0b31b0bd850815fe9be4bbb45f", [:mix, :rebar3], [], "hexpm", "9681ccaa24fd3d810b4461581717661fd85ff7019b082c2dff89c7d5b1fc2864"}, "opentelemetry_telemetry": {:hex, :opentelemetry_telemetry, "1.1.2", "410ab4d76b0921f42dbccbe5a7c831b8125282850be649ee1f70050d3961118a", [:mix, :rebar3], [{:opentelemetry_api, "~> 1.3", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "641ab469deb181957ac6d59bce6e1321d5fe2a56df444fc9c19afcad623ab253"}, "otel_http": {:hex, :otel_http, "0.2.0", "b17385986c7f1b862f5d577f72614ecaa29de40392b7618869999326b9a61d8a", [:rebar3], [], "hexpm", "f2beadf922c8cfeb0965488dd736c95cc6ea8b9efce89466b3904d317d7cc717"}, - "peep": {:hex, :peep, "4.2.1", "dbb17e880acbe8e43cdc29b15576d736b613d412c94f9abae4a7a77d89aba98e", [:mix], [{:nimble_options, "~> 1.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:plug, "~> 1.16", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "2f966ac06c6a02bb3721e79a5f68fa769070eea60d44d210529c42d54623e97e"}, + "peep": {:git, "https://github.com/supabase/peep.git", "b9e3508fe692375bc957e9fc06ed2b425dbc08d7", [branch: "feat/partitions-ets"]}, "phoenix": {:git, "https://github.com/supabase/phoenix.git", "7b884cc0cc1a49ad2bc272acda2e622b3e11c139", [branch: "feat/presence-custom-dispatcher-1.7.19"]}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.3", "86e9878f833829c3f66da03d75254c155d91d72a201eb56ae83482328dc7ca93", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d36c401206f3011fefd63d04e8ef626ec8791975d9d107f9a0817d426f61ac07"}, "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"}, diff --git a/test/realtime/monitoring/prometheus_test.exs b/test/realtime/monitoring/prometheus_test.exs index c09a3b2bb..ca7563ce0 100644 --- a/test/realtime/monitoring/prometheus_test.exs +++ b/test/realtime/monitoring/prometheus_test.exs @@ -28,10 +28,10 @@ defmodule Realtime.Monitoring.PrometheusTest do :ok end - @impls [:default, :striped] + @impls [:default, {:default, 4}, :striped] for impl <- @impls do - test "#{impl} - counter formatting" do + test "#{inspect(impl)} - counter formatting" do counter = Metrics.counter("prometheus.test.counter", description: "a counter") name = StorageCounter.fresh_id() @@ -54,7 +54,7 @@ defmodule Realtime.Monitoring.PrometheusTest do assert export(name) == lines_to_string(expected) end - describe "#{impl} - sum" do + describe "#{inspect(impl)} - sum" do test "sum formatting" do name = StorageCounter.fresh_id() sum = Metrics.sum("prometheus.test.sum", description: "a sum") @@ -109,7 +109,7 @@ defmodule Realtime.Monitoring.PrometheusTest do end end - describe "#{impl} - last_value" do + describe "#{inspect(impl)} - last_value" do test "formatting" do name = StorageCounter.fresh_id() last_value = Metrics.last_value("prometheus.test.gauge", description: "a last_value") @@ -162,7 +162,7 @@ defmodule Realtime.Monitoring.PrometheusTest do end end - test "#{impl} - dist formatting" do + test "#{inspect(impl)} - dist formatting" do name = StorageCounter.fresh_id() dist = @@ -281,7 +281,7 @@ defmodule Realtime.Monitoring.PrometheusTest do assert export(name) == lines_to_string(expected) end - test "#{impl} - dist formatting pow10" do + test "#{inspect(impl)} - dist formatting pow10" do name = StorageCounter.fresh_id() dist = @@ -354,7 +354,7 @@ defmodule Realtime.Monitoring.PrometheusTest do assert export(name) == lines_to_string(expected) end - test "#{impl} - regression: label escaping" do + test "#{inspect(impl)} - regression: label escaping" do name = StorageCounter.fresh_id() counter = @@ -388,7 +388,7 @@ defmodule Realtime.Monitoring.PrometheusTest do assert export(name) == lines_to_string(expected) end - test "#{impl} - regression: handle structs without String.Chars" do + test "#{inspect(impl)} - regression: handle structs without String.Chars" do name = StorageCounter.fresh_id() counter = From d9e845b2dd1e39ea0b0725ba3f4657e7d94c4ae7 Mon Sep 17 00:00:00 2001 From: Eduardo Gurgel Pinho Date: Fri, 19 Dec 2025 09:09:10 +1300 Subject: [PATCH 2/2] fix: update peep branch to fix typespecs --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index df8e18f95..b106e9cd7 100644 --- a/mix.lock +++ b/mix.lock @@ -66,7 +66,7 @@ "opentelemetry_semantic_conventions": {:hex, :opentelemetry_semantic_conventions, "1.27.0", "acd0194a94a1e57d63da982ee9f4a9f88834ae0b31b0bd850815fe9be4bbb45f", [:mix, :rebar3], [], "hexpm", "9681ccaa24fd3d810b4461581717661fd85ff7019b082c2dff89c7d5b1fc2864"}, "opentelemetry_telemetry": {:hex, :opentelemetry_telemetry, "1.1.2", "410ab4d76b0921f42dbccbe5a7c831b8125282850be649ee1f70050d3961118a", [:mix, :rebar3], [{:opentelemetry_api, "~> 1.3", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "641ab469deb181957ac6d59bce6e1321d5fe2a56df444fc9c19afcad623ab253"}, "otel_http": {:hex, :otel_http, "0.2.0", "b17385986c7f1b862f5d577f72614ecaa29de40392b7618869999326b9a61d8a", [:rebar3], [], "hexpm", "f2beadf922c8cfeb0965488dd736c95cc6ea8b9efce89466b3904d317d7cc717"}, - "peep": {:git, "https://github.com/supabase/peep.git", "b9e3508fe692375bc957e9fc06ed2b425dbc08d7", [branch: "feat/partitions-ets"]}, + "peep": {:git, "https://github.com/supabase/peep.git", "3ba8f8f77f4c8dae734f9d8f603c24c1046502da", [branch: "feat/partitions-ets"]}, "phoenix": {:git, "https://github.com/supabase/phoenix.git", "7b884cc0cc1a49ad2bc272acda2e622b3e11c139", [branch: "feat/presence-custom-dispatcher-1.7.19"]}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.3", "86e9878f833829c3f66da03d75254c155d91d72a201eb56ae83482328dc7ca93", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d36c401206f3011fefd63d04e8ef626ec8791975d9d107f9a0817d426f61ac07"}, "phoenix_html": {:hex, :phoenix_html, "3.3.4", "42a09fc443bbc1da37e372a5c8e6755d046f22b9b11343bf885067357da21cb3", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0249d3abec3714aff3415e7ee3d9786cb325be3151e6c4b3021502c585bf53fb"},