PromEx.DashboardRenderer (PromEx v1.1.1) View Source
This module is used to read dashboard definitions, render EEx dashboards, and ensure that requested files actually exist
Link to this section Summary
Functions
Read the contents of a dashboard file entry. If an EEx version of the file exists,
read that, else fallback to the provided file name. For example, if the requested
dashboard file is ecto.json
, if ecto.json.eex
exists, then that will be returned.
This is more so for convenience so that you don't need to write out .eex
everywhere
given that all PromEx 1st party dashboards are EEx templates.
This function will decode the JSON dashboard using Jason
. If any errors occur during the decoding process,
the struct will be marked as having invalid JSON.
This function will merge in the provided assigns to the struct's assigns. These assigns will
then be used during the render_dashboard/1
call to render any EEx template statements.
Renders the dashboard. If it is an EEx file then the PromEx module assigns are passed. Else if it is a raw json file then it is passed through untouched.
Link to this section Types
Specs
t() :: %PromEx.DashboardRenderer{ assigns: keyword() | nil, decoded_dashboard: map() | nil, error: tuple() | nil, file_contents: String.t(), file_type: :eex | :json | nil, full_path: term(), otp_app: term(), relative_path: String.t(), rendered_file: String.t() | nil, valid_file?: boolean(), valid_json?: boolean() | nil }
Link to this section Functions
Specs
Read the contents of a dashboard file entry. If an EEx version of the file exists,
read that, else fallback to the provided file name. For example, if the requested
dashboard file is ecto.json
, if ecto.json.eex
exists, then that will be returned.
This is more so for convenience so that you don't need to write out .eex
everywhere
given that all PromEx 1st party dashboards are EEx templates.
Specs
This function will decode the JSON dashboard using Jason
. If any errors occur during the decoding process,
the struct will be marked as having invalid JSON.
Specs
This function will merge in the provided assigns to the struct's assigns. These assigns will
then be used during the render_dashboard/1
call to render any EEx template statements.
Specs
Renders the dashboard. If it is an EEx file then the PromEx module assigns are passed. Else if it is a raw json file then it is passed through untouched.