Skip to content

Commit

Permalink
Show missing metric registry fields. Add popover texts
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanIvanoff committed Dec 2, 2024
1 parent 51db0b3 commit 8303282
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ defmodule SanbaseWeb.AvailableMetricsDescription do
"""
end

def get_popover_text(%{key: "Human Readable Name"} = assigns) do
~H"""
<pre>
The name of the metric formatted in a way that is suitable for showing
in Web UI and in texts shown to end clients. The name is capitalized, underscores
are replaced with spaces and other formatting is applied.
Example: The human readable name of 'price_usd' is 'USD Price'
</pre>
"""
end

def get_popover_text(%{key: "Clickhouse Table"} = assigns) do
~H"""
<pre>
Expand Down Expand Up @@ -378,4 +389,35 @@ defmodule SanbaseWeb.AvailableMetricsDescription do
</pre>
"""
end

def get_popover_text(%{key: "Verified Status"} = assigns) do
~H"""
<pre>
After a change request is approved and its changes are applied to the databse
record, the metric is moved into a Unverified state. Someone will need to manually
verify the metric via the UI (after testing the changes).
Only verified metrics can be deployed from stage to prod.
</pre>
"""
end

def get_popover_text(%{key: "Exposed Environments"} = assigns) do
~H"""
<pre>
One of: none, all, stage, prod.
Controls on which deployment environment the metric is visible.
</pre>
"""
end

def get_popover_text(%{key: "Sync Status"} = assigns) do
~H"""
<pre>
Controls the deployment process of metrics. When a change request is approved
and applied, the metric is moved to 'not_synced' state indicating that the change
is not synced with the other environment.
Only metrics in not_synced state are deployed from stage to prod.
</pre>
"""
end
end
28 changes: 28 additions & 0 deletions lib/sanbase_web/live/metric_registry/metric_registry_show_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ defmodule SanbaseWeb.MetricRegistryShowLive do
popover_target: "popover-internal-name",
popover_target_text: get_popover_text(%{key: "Internal Name"})
},
%{
key: "Human Readable Name",
value: metric_registry.human_readable_name,
popover_target: "popover-human-readable-name",
popover_target_text: get_popover_text(%{key: "Human Readable Name"})
},
%{
key: "Verified Status",
value: to_verified_status(metric_registry.is_verified),
popover_target: "popover-verified-status",
popover_target_text: get_popover_text(%{key: "Verified Status"})
},
%{
key: "Sync Status",
value: metric_registry.sync_status,
popover_target: "popover-sync-status",
popover_target_text: get_popover_text(%{key: "Sync Status"})
},
%{
key: "Aliases",
value: metric_registry.aliases |> Enum.map(& &1.name) |> Enum.join(", "),
Expand All @@ -104,6 +122,12 @@ defmodule SanbaseWeb.MetricRegistryShowLive do
popover_target: "popover-clickhouse-table",
popover_target_text: get_popover_text(%{key: "Clickhouse Table"})
},
%{
key: "Exposed Environments",
value: metric_registry.exposed_environments,
popover_target: "popover-exposed-environments",
popover_target_text: get_popover_text(%{key: "Exposed Environments"})
},
%{
key: "Min Interval",
value: metric_registry.min_interval,
Expand Down Expand Up @@ -220,4 +244,8 @@ defmodule SanbaseWeb.MetricRegistryShowLive do
}
]
end

defp to_verified_status(is_verified) do
if is_verified, do: "VERIFIED", else: "UNVERIFIED"
end
end

0 comments on commit 8303282

Please sign in to comment.