[#74] generating the new Doc

This commit is contained in:
Felipe Ripoll 2018-08-22 11:49:21 -06:00
parent 6162441250
commit f0dcc03cac
20 changed files with 90 additions and 47 deletions

View File

@ -16,15 +16,7 @@ jobs:
- run: mix deps.get
- run: mix test
- run: mix credo
- restore_cache:
keys:
- dialyzer-PLT-cache-{{ checksum "mix.exs" }}
- dialyzer-PLT-cache
- run: mix dialyzer
- save_cache:
key: dialyzer-PLT-cache-{{ checksum "mix.exs" }}
paths:
- _build
- run: env MIX_ENV=test mix coveralls.circle
- run: env MIX_ENV=test mix coveralls.json
- run: bash <(curl -s https://codecov.io/bash)

View File

@ -4,7 +4,7 @@ fonts/icomoon.eot
fonts/icomoon.svg
fonts/icomoon.ttf
fonts/icomoon.woff
dist/sidebar_items-303975f305.js
dist/sidebar_items-75149ca71e.js
api-reference.html
initial_architecture.html
starting_guide.html

View File

@ -8,7 +8,7 @@
<title>404 poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Application poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Entity.NameConvention poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Format.POAProtocol.Data.Format poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Collector poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>
@ -129,13 +129,15 @@ and the Transfers related with it. A <code class="inline">Transfer</code> is a P
Implementing A Collector Plugin
</h2>
<p>In order to implement your Collector Plugin you must implement 3 functions.</p>
<p>In order to implement your Collector Plugin you must implement 4 functions.</p>
<ul>
<li><code class="inline">init_collector/1</code>: Called only once when the process starts
</li>
<li><code class="inline">collect/1</code>: This function is called periodically after <code class="inline">frequency</code> milliseconds. It is responsible
of retrieving the metrics
</li>
<li><code class="inline">metric_type/0</code>: This function must return the metric type in <code class="inline">string</code> format (i.e “ethereum_metric”)
</li>
<li><code class="inline">terminate/1</code>: Called just before stopping the process
</li>
</ul>
@ -152,6 +154,10 @@ of retrieving the metrics
{:transfer, &quot;data retrieved&quot;, :no_state}
end
def metric_type do
&quot;my_metrics_type&quot;
end
def terminate(_state) do
:ok
end
@ -205,6 +211,16 @@ end</code></pre>
metrics we want to send to the transfer</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#c:metric_type/0">metric_type()</a>
</div>
<div class="summary-synopsis"><p>This callback must return the metric type in <code class="inline">string</code> format. For example, if your collector is gathering metrics about
Ethereum you can use “ethereum_metric” here</p>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
@ -245,7 +261,7 @@ end</code></pre>
</a>
<span class="signature">collect(state)</span>
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L101" class="view-source" rel="help" title="View Source">
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L106" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
@ -278,7 +294,7 @@ end</code></pre>
</a>
<span class="signature">init_collector(args)</span>
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L92" class="view-source" rel="help" title="View Source">
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L97" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
@ -304,6 +320,36 @@ end</code></pre>
</section>
</div>
<div class="detail" id="c:metric_type/0">
<div class="detail-header">
<a href="#c:metric_type/0" class="detail-link" title="Link to this callback">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this callback</span>
</a>
<span class="signature">metric_type()</span>
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L113" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>
<div class="specs">
<pre>metric_type() :: <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()</pre>
</div>
</div>
<section class="docstring">
<p>This callback must return the metric type in <code class="inline">string</code> format. For example, if your collector is gathering metrics about
Ethereum you can use “ethereum_metric” here.</p>
</section>
</div>
<div class="detail" id="c:terminate/1">
@ -314,7 +360,7 @@ end</code></pre>
</a>
<span class="signature">terminate(state)</span>
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L107" class="view-source" rel="help" title="View Source">
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/collector.ex#L118" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
<span class="sr-only">View Source</span>
</a>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Collectors.Eth.Information poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Collectors.Eth.LatestBlock poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Collectors.Eth.Pending poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Collectors.Eth.Stats poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Transfer poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>
@ -115,7 +115,7 @@ process per each one of them. That configuration is referenced by :transfers key
<ul>
<li><code class="inline">init_transfer/1</code>: Called only once when the process starts
</li>
<li><code class="inline">data_received/2</code>: This function is called every time a Collector sends metrics to the Transfer
<li><code class="inline">data_received/4</code>: This function is called every time a Collector sends metrics to the Transfer
</li>
<li><code class="inline">handle_message/1</code>: This is called when the transfer process receives an Erlang message
</li>
@ -130,7 +130,7 @@ process per each one of them. That configuration is referenced by :transfers key
{:ok, :no_state}
end
def data_received(label, data, state) do
def data_received(label, metric_type, data, state) do
IO.puts &quot;Received data from the collector referenced by label&quot;
{:ok, :no_state}
end
@ -168,7 +168,7 @@ end</code></pre>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#c:data_received/3">data_received(label, data, state)</a>
<a href="#c:data_received/4">data_received(label, metric_type, data, state)</a>
</div>
<div class="summary-synopsis"><p>In this callback is called when a Collector sends data to this Transfer</p>
@ -225,15 +225,15 @@ end</code></pre>
</a>
Callbacks
</h1>
<div class="detail" id="c:data_received/3">
<div class="detail" id="c:data_received/4">
<div class="detail-header">
<a href="#c:data_received/3" class="detail-link" title="Link to this callback">
<a href="#c:data_received/4" class="detail-link" title="Link to this callback">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this callback</span>
</a>
<span class="signature">data_received(label, data, state)</span>
<span class="signature">data_received(label, metric_type, data, state)</span>
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/transfer.ex#L84" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
@ -244,15 +244,20 @@ end</code></pre>
<div class="specs">
<pre>data_received(label :: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">atom</a>(), data :: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>(), state :: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>()) :: {:ok, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>()}</pre>
<pre>data_received(
label :: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">atom</a>(),
metric_type :: <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(),
data :: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>(),
state :: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>()
) :: {:ok, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">any</a>()}</pre>
</div>
</div>
<section class="docstring">
<p> In this callback is called when a Collector sends data to this Transfer.</p>
<p> The data received is in <code class="inline">{label, data}</code> format where <code class="inline">label</code> identifies the Collector and the
data is the real data received.</p>
<p> Regarding the parameters, <code class="inline">label</code> identifies the Collector, <code class="inline">metric_type</code> is the metric type in String format, it is used in order
to know which kind of data we are sending, the <code class="inline">data</code> is the real data received, and the <code class="inline">state</code> is the Collectors state</p>
<p> It must return <code class="inline">{:ok, state}</code>.</p>
</section>

View File

@ -8,7 +8,7 @@
<title>POAAgent.Plugins.Transfers.WebSocket.Primus poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>
@ -99,7 +99,7 @@
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#data_received/3">data_received(label, data, state)</a>
<a href="#data_received/4">data_received(label, metric_type, data, state)</a>
</div>
<div class="summary-synopsis"><p>In this callback is called when a Collector sends data to this Transfer</p>
@ -156,15 +156,15 @@
</a>
Functions
</h1>
<div class="detail" id="data_received/3">
<div class="detail" id="data_received/4">
<div class="detail-header">
<a href="#data_received/3" class="detail-link" title="Link to this function">
<a href="#data_received/4" class="detail-link" title="Link to this function">
<span class="icon-link" aria-hidden="true"></span>
<span class="sr-only">Link to this function</span>
</a>
<span class="signature">data_received(label, data, state)</span>
<span class="signature">data_received(label, metric_type, data, state)</span>
<a href="https://github.com/poanetwork/poa-netstats-agent/blob/v0.1.0/lib/poa_agent/plugins/transfers/web_socket/primus.ex#L82" class="view-source" rel="help" title="View Source">
<span class="icon-code" aria-hidden="true"></span>
@ -176,10 +176,10 @@
</div>
<section class="docstring">
<p> In this callback is called when a Collector sends data to this Transfer.</p>
<p> The data received is in <code class="inline">{label, data}</code> format where <code class="inline">label</code> identifies the Collector and the
data is the real data received.</p>
<p> Regarding the parameters, <code class="inline">label</code> identifies the Collector, <code class="inline">metric_type</code> is the metric type in String format, it is used in order
to know which kind of data we are sending, the <code class="inline">data</code> is the real data received, and the <code class="inline">state</code> is the Collectors state</p>
<p> It must return <code class="inline">{:ok, state}</code>.</p>
<p>Callback implementation for <a href="POAAgent.Plugins.Transfer.html#c:data_received/3"><code class="inline">POAAgent.Plugins.Transfer.data_received/3</code></a>.</p>
<p>Callback implementation for <a href="POAAgent.Plugins.Transfer.html#c:data_received/4"><code class="inline">POAAgent.Plugins.Transfer.data_received/4</code></a>.</p>
</section>
</div>

View File

@ -8,7 +8,7 @@
<title>POAAgent poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>API Reference poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -1 +1 @@
sidebarNodes={"extras":[{"id":"api-reference","title":"API Reference","group":"","headers":[{"id":"Modules","anchor":"modules"}]},{"id":"initial_architecture","title":"Initial Architecture","group":"","headers":[{"id":"Network Agent Architecture","anchor":"network-agent-architecture"},{"id":"Network Server Architecture","anchor":"network-server-architecture"}]},{"id":"starting_guide","title":"Getting Started","group":"","headers":[{"id":"Setting up","anchor":"setting-up"},{"id":"Connecting to POA Warehouse","anchor":"connecting-to-poa-warehouse"}]}],"exceptions":[],"modules":[{"id":"POAAgent","title":"POAAgent","group":""},{"id":"POAAgent.Application","title":"POAAgent.Application","group":"","functions":[{"id":"start/2","anchor":"start/2"}]},{"id":"POAAgent.Entity.NameConvention","title":"POAAgent.Entity.NameConvention","group":"","functions":[{"id":"from_elixir_to_node/1","anchor":"from_elixir_to_node/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"POAAgent.Format.POAProtocol.Data.Format","title":"POAAgent.Format.POAProtocol.Data.Format","group":"","functions":[{"id":"to_data/1","anchor":"to_data/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"POAAgent.Plugins.Transfers.WebSocket.Primus","title":"POAAgent.Plugins.Transfers.WebSocket.Primus","group":"","functions":[{"id":"data_received/3","anchor":"data_received/3"},{"id":"handle_message/2","anchor":"handle_message/2"},{"id":"init_transfer/1","anchor":"init_transfer/1"},{"id":"terminate/1","anchor":"terminate/1"}]},{"id":"POAAgent.Plugins.Collector","title":"POAAgent.Plugins.Collector","group":"Plugins","callbacks":[{"id":"collect/1","anchor":"c:collect/1"},{"id":"init_collector/1","anchor":"c:init_collector/1"},{"id":"terminate/1","anchor":"c:terminate/1"}]},{"id":"POAAgent.Plugins.Transfer","title":"POAAgent.Plugins.Transfer","group":"Plugins","callbacks":[{"id":"data_received/3","anchor":"c:data_received/3"},{"id":"handle_message/2","anchor":"c:handle_message/2"},{"id":"init_transfer/1","anchor":"c:init_transfer/1"},{"id":"terminate/1","anchor":"c:terminate/1"}]},{"id":"POAAgent.Plugins.Collectors.Eth.Information","title":"POAAgent.Plugins.Collectors.Eth.Information","group":"Ethereum Plugins"},{"id":"POAAgent.Plugins.Collectors.Eth.LatestBlock","title":"POAAgent.Plugins.Collectors.Eth.LatestBlock","group":"Ethereum Plugins"},{"id":"POAAgent.Plugins.Collectors.Eth.Pending","title":"POAAgent.Plugins.Collectors.Eth.Pending","group":"Ethereum Plugins"},{"id":"POAAgent.Plugins.Collectors.Eth.Stats","title":"POAAgent.Plugins.Collectors.Eth.Stats","group":"Ethereum Plugins"}],"tasks":[]}
sidebarNodes={"extras":[{"id":"api-reference","title":"API Reference","group":"","headers":[{"id":"Modules","anchor":"modules"}]},{"id":"initial_architecture","title":"Initial Architecture","group":"","headers":[{"id":"Network Agent Architecture","anchor":"network-agent-architecture"},{"id":"Network Server Architecture","anchor":"network-server-architecture"}]},{"id":"starting_guide","title":"Getting Started","group":"","headers":[{"id":"Setting up","anchor":"setting-up"},{"id":"Connecting to POA Warehouse","anchor":"connecting-to-poa-warehouse"}]}],"exceptions":[],"modules":[{"id":"POAAgent","title":"POAAgent","group":""},{"id":"POAAgent.Application","title":"POAAgent.Application","group":"","functions":[{"id":"start/2","anchor":"start/2"}]},{"id":"POAAgent.Entity.NameConvention","title":"POAAgent.Entity.NameConvention","group":"","functions":[{"id":"from_elixir_to_node/1","anchor":"from_elixir_to_node/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"POAAgent.Format.POAProtocol.Data.Format","title":"POAAgent.Format.POAProtocol.Data.Format","group":"","functions":[{"id":"to_data/1","anchor":"to_data/1"}],"types":[{"id":"t/0","anchor":"t:t/0"}]},{"id":"POAAgent.Plugins.Transfers.WebSocket.Primus","title":"POAAgent.Plugins.Transfers.WebSocket.Primus","group":"","functions":[{"id":"data_received/4","anchor":"data_received/4"},{"id":"handle_message/2","anchor":"handle_message/2"},{"id":"init_transfer/1","anchor":"init_transfer/1"},{"id":"terminate/1","anchor":"terminate/1"}]},{"id":"POAAgent.Plugins.Collector","title":"POAAgent.Plugins.Collector","group":"Plugins","callbacks":[{"id":"collect/1","anchor":"c:collect/1"},{"id":"init_collector/1","anchor":"c:init_collector/1"},{"id":"metric_type/0","anchor":"c:metric_type/0"},{"id":"terminate/1","anchor":"c:terminate/1"}]},{"id":"POAAgent.Plugins.Transfer","title":"POAAgent.Plugins.Transfer","group":"Plugins","callbacks":[{"id":"data_received/4","anchor":"c:data_received/4"},{"id":"handle_message/2","anchor":"c:handle_message/2"},{"id":"init_transfer/1","anchor":"c:init_transfer/1"},{"id":"terminate/1","anchor":"c:terminate/1"}]},{"id":"POAAgent.Plugins.Collectors.Eth.Information","title":"POAAgent.Plugins.Collectors.Eth.Information","group":"Ethereum Plugins"},{"id":"POAAgent.Plugins.Collectors.Eth.LatestBlock","title":"POAAgent.Plugins.Collectors.Eth.LatestBlock","group":"Ethereum Plugins"},{"id":"POAAgent.Plugins.Collectors.Eth.Pending","title":"POAAgent.Plugins.Collectors.Eth.Pending","group":"Ethereum Plugins"},{"id":"POAAgent.Plugins.Collectors.Eth.Stats","title":"POAAgent.Plugins.Collectors.Eth.Stats","group":"Ethereum Plugins"}],"tasks":[]}

View File

@ -8,7 +8,7 @@
<title>Initial Architecture poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>Search poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -8,7 +8,7 @@
<title>Getting Started poa_agent v0.1.0</title>
<link rel="stylesheet" href="dist/app-480ffdc169.css" />
<script src="dist/sidebar_items-303975f305.js"></script>
<script src="dist/sidebar_items-75149ca71e.js"></script>

View File

@ -80,7 +80,7 @@ defmodule POAAgent.Plugins.Transfers.HTTP.REST do
latency
|> Latency.new
|> send_metric("networking_metric", state)
|> send_metric("networking_metrics", state)
end
defp send_metric(metric, metric_type, state) do