Skip to content

Commit 18751ed

Browse files
committed
Adding initial proposal for the Metric Configuration
1 parent eb99f08 commit 18751ed

File tree

6 files changed

+3133
-17
lines changed

6 files changed

+3133
-17
lines changed

guides/installation.md

+76-17
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,6 @@ After you've verified that the dashboard is loading you'll probably want to rest
5454
dashboard via authentication, either with a [custom resolver's][ac] access controls or [Basic
5555
Auth][ba].
5656

57-
### Retention period for metrics
58-
59-
The Observer Web can monitor Beam VM metrics by default, using ETS tables to store the data.
60-
However, this means that the data is not persisted across restarts. The retention period
61-
for this data can be configured.
62-
63-
By default, without a retention time set, the metrics will only show data received during the
64-
current session. If you'd like to persist this data for a longer period, you can configure
65-
a retention time.
66-
67-
To configure the retention period, use the following optional setting:
68-
69-
```elixir
70-
config :observer_web, ObserverWeb.Telemetry,
71-
data_retention_period: :timer.minutes(5)
72-
```
73-
7457
### Embedding Observer Web in your app page
7558

7659
In some cases, you may prefer to run the Observer in the same page as your app rather than in
@@ -139,6 +122,81 @@ path `/observer"`. However, using the iframe approach allows you to display
139122
your application's information alongside the Observer in your main page,
140123
providing a more integrated monitoring experience.
141124

125+
### Metrics
126+
127+
#### Retention period for metrics
128+
129+
Observer Web can monitor Beam VM metrics (along with many others) and uses ETS
130+
tables to store the data and there is a possibility of configuration for the retention
131+
period while the application is running.
132+
133+
By default, without a retention time set, the metrics will only show data received during the
134+
current session. If you'd like to persist this data for a longer period, you can configure
135+
a retention time.
136+
137+
To configure the retention period, use the following optional setting:
138+
139+
```elixir
140+
config :observer_web, ObserverWeb.Telemetry,
141+
data_retention_period: :timer.minutes(30)
142+
```
143+
144+
> #### Persistence Across Restarts {: .attention}
145+
>
146+
> Please note that data is not persisted across application restarts. For persistent
147+
> storage, refer to the Configuration section to set up a Central Hub application,
148+
> which can aggregate and retain metrics.
149+
150+
#### Configuration
151+
152+
Observer Web can operate in two distinct metrics configurations: `Standalone` and `Metric Hub`.
153+
These configurations determine how metrics are collected, stored, and managed.
154+
155+
#### Standalone Configuration (default)
156+
157+
In this mode, all applications with Observer Web installed operate independently. Each
158+
application receives and stores its own metrics within its ETS tables. The image below
159+
illustrates this configuration:
160+
161+
![Standalone Mode](./static/standalone.png)
162+
163+
__**NOTE: No additional configuration is required for this mode**__
164+
165+
#### Metric Hub Configuration
166+
167+
In this mode, one application is designated as the central hub to store all metrics,
168+
while the remaining applications broadcast their data to this designated hub. This
169+
configuration is ideal for scenarios where you have a dedicated application for monitoring
170+
or deployment, such as [DeployEx][dye]. Additionally, this setup ensures that metrics
171+
are retained even if any of the monitored applications restart.
172+
173+
![Metric Hub Mode](./static/metric_hub.png)
174+
175+
To configure applications to broadcast their metrics, use the following setting:
176+
177+
```elixir
178+
config :observer_web, ObserverWeb.Telemetry,
179+
mode: :broadcast
180+
```
181+
182+
> #### Disable Endpoint for Broadcast applications {: .attention}
183+
>
184+
> In this mode, since there is a centralized application dedicated to capturing metrics,
185+
> we recommend disabling the `/observer` endpoint on all applications configured in
186+
> **broadcast** mode. Only the **central observer (hub)** should expose the `/observer` endpoint
187+
> to avoid redundancy and ensure efficient metric collection.
188+
189+
To designate an application as the **central observer (hub)**, use the following setting:
190+
191+
```elixir
192+
config :observer_web, ObserverWeb.Telemetry,
193+
mode: :observer,
194+
data_retention_period: :timer.minutes(30)
195+
```
196+
197+
The application in `observer mode` will also retain its own metrics in addition to
198+
aggregating metrics from other applications.
199+
142200
### Usage with Web and Clustering
143201

144202
The Observer Web provides observer ability for the local application as well as any other that is
@@ -158,3 +216,4 @@ via OTP distribution!
158216
[ac]: Observer.Web.Resolver.html#c:resolve_access/1
159217
[ba]: https://hexdocs.pm/basic_auth/readme.html
160218
[oi]: installation.html
219+
[dye]: https://github.com/thiagoesteves/deployex

guides/overview.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and Beam VM statistics.
88
Powered by [Phoenix LiveView][liv], it is distributed, lightweight, and fully real-time. This
99
library is part of the [DeployEx][dye] project.
1010

11+
![Observer Dashboard](./static/dashboard.png)
12+
1113
[dye]: https://github.com/thiagoesteves/deployex
1214
[edb]: https://www.erlang.org/doc/apps/runtime_tools/dbg.html
1315
[liv]: https://github.com/phoenixframework/phoenix_live_view

guides/static/metric_hub.png

77.8 KB
Loading

guides/static/standalone.png

64 KB
Loading

0 commit comments

Comments
 (0)