Add telemetry for Markdown rendering
This commit is contained in:
@@ -14,9 +14,18 @@ defmodule MusicLibraryWeb.Markdown do
|
|||||||
"""
|
"""
|
||||||
@spec to_html(String.t() | nil) :: String.t()
|
@spec to_html(String.t() | nil) :: String.t()
|
||||||
def to_html(markdown_text) when is_binary(markdown_text) do
|
def to_html(markdown_text) when is_binary(markdown_text) do
|
||||||
markdown_text
|
:telemetry.span(
|
||||||
|> process_double_bracket_links()
|
[:markdown, :to_html],
|
||||||
|> Earmark.as_html!(%Earmark.Options{gfm: true})
|
%{},
|
||||||
|
fn ->
|
||||||
|
result =
|
||||||
|
markdown_text
|
||||||
|
|> process_double_bracket_links()
|
||||||
|
|> Earmark.as_html!(%Earmark.Options{gfm: true})
|
||||||
|
|
||||||
|
{result, %{}}
|
||||||
|
end
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_html(nil), do: ""
|
def to_html(nil), do: ""
|
||||||
|
|||||||
@@ -151,6 +151,12 @@ defmodule MusicLibraryWeb.Telemetry do
|
|||||||
reporter_options: [nav: "LiveView"]
|
reporter_options: [nav: "LiveView"]
|
||||||
),
|
),
|
||||||
|
|
||||||
|
# Markdown Processing Metrics
|
||||||
|
summary("markdown.to_html.stop.duration",
|
||||||
|
unit: {:native, :millisecond},
|
||||||
|
reporter_options: [nav: "Markdown"]
|
||||||
|
),
|
||||||
|
|
||||||
# VM Metrics
|
# VM Metrics
|
||||||
summary("vm.memory.total", unit: {:byte, :megabyte}),
|
summary("vm.memory.total", unit: {:byte, :megabyte}),
|
||||||
summary("vm.total_run_queue_lengths.total"),
|
summary("vm.total_run_queue_lengths.total"),
|
||||||
|
|||||||
Reference in New Issue
Block a user