-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dashboard #571
Conversation
lib/membrane/core/observer.ex
Outdated
# observer if enabled by setting `unsafely_name_processes_for_observer: :components` | ||
# in config.exs. | ||
defp setup_process_local_observability(config, opts) do | ||
utility_name = Map.get(opts, :utility_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utility_name = Map.get(opts, :utility_name) | |
utility_name = Map.get(opts, :utility_name, "") |
lib/membrane/core/observer.ex
Outdated
|
||
removed_links = | ||
Enum.map(removed_links, fn link -> | ||
link |> Map.take([:from, :to, :output, :input]) |> Map.put(:entity, :link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but link.entity == :link
because of line 429
lib/membrane/core/observer.ex
Outdated
|
||
@impl true | ||
def handle_info({:graph, graph_update}, state) do | ||
{action, graph_entries, graph_updates, state} = handle_graph_update(graph_update, state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of updating value of state.graph
sometimes in handle_graph_update
and sometimes in handle_info
, do it in only one place (IMO handle_graph_update
is a good idea)
lib/membrane/core/observer.ex
Outdated
{unquote(metric), unquote(opts)[:component_path] || ComponentPath.get(), | ||
unquote(opts)[:pad]} | ||
|
||
[{_key, value} | _default] = :ets.lookup(ets, key) ++ [{nil, unquote(init)}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting metric value from ETS is slow, since we start ETS only with write_concurrency: true
flag. Getting last value of metric
from process dictionary would be better
lib/membrane/core/observer.ex
Outdated
register_name_for_observer( | ||
:"##{unique_prefix}#{name_str}#{component_type_suffix}#{utility_name}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO creating a new atom each time we spawn a component, is not a good idea. Where do we use this atom again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if in some cases it is necessary, let's create it only when it will be used by register_name_for_observer/1
e8effb0
to
e79772f
Compare
@@ -92,7 +92,7 @@ defmodule Membrane.Core.Bin do | |||
log_metadata: options.log_metadata | |||
} | |||
|
|||
Membrane.Core.Observability.setup(observability_config) | |||
Membrane.Core.Stalker.register_component(options.stalker, observability_config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name has exceeded all my expectations xD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still open to better propositions :D
lib/membrane/core/child/pad_model.ex
Outdated
total_buffers_metric: :atomics.atomics_ref(), | ||
demand_metric: :atomics.atomics_ref() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be better to have a "single reference" to some "metrics struct" that would encapsulate these two references?
@@ -46,7 +47,8 @@ defmodule Membrane.Core.Element.InputQueue do | |||
:atomic_demand, | |||
:inbound_metric, | |||
:outbound_metric, | |||
:linked_output_ref | |||
:pad_ref, | |||
:size_metric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we have inbound_metric
and outbound_metric
which describe the units used by particular pads, and size_metric
which is used by our metrics mechanism.. Even though they are not connected, they are named similarly. I believe we need to think about some better namespacing in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left some two small things to consider, but generally: LGTM 🥇
lib/membrane/core/child/pad_model.ex
Outdated
@@ -44,8 +44,7 @@ defmodule Membrane.Core.Child.PadModel do | |||
auto_demand_size: pos_integer() | nil, | |||
associated_pads: [Pad.ref()] | nil, | |||
sticky_events: [Membrane.Event.t()], | |||
total_buffers_metric: :atomics.atomics_ref(), | |||
demand_metric: :atomics.atomics_ref() | |||
metrics: %{atom => :atomics.atomics_ref()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be better to have stalker_metrics
here?
@@ -37,7 +37,8 @@ defmodule Membrane.Core.Element.InputQueue do | |||
inbound_metric: module(), | |||
outbound_metric: module(), | |||
pad_ref: Pad.ref(), | |||
atomic_demand: AtomicDemand.t() | |||
atomic_demand: AtomicDemand.t(), | |||
stalker_metrics: map() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[NIT] How about:
stalker_metrics: map() | |
stalker_metrics: %{atom() => any()} | |
```? |
Co-authored-by: Łukasz Kita <[email protected]>
Adds functionality needed for https://github.com/membraneframework/membrane_kino_dashboard
TODO: