EventBus.Metrics
Metrics library and metrics RESTFul endpoints for event_bus
Installation
The package can be installed by adding event_bus_metrics
to your list of dependencies in mix.exs
:
def deps do
[
{:event_bus_metrics, "~> 0.2"}
]
end
Update your config.exs
config :event_bus_metrics,
cross_origin: {:system, "EB_CROSS_ORIGIN", "off"},
http_server: {:system, "EB_HTTP_SERVER", "off"},
http_server_port: {:system, "PORT", "4000"},
# Server-Sent-Events Tickers:
notify_subscriber_metrics_in_ms: {:system, "EB_SUBSCRIBER_M_IN_MS", 250},
notify_topic_metrics_in_ms: {:system, "EB_TOPIC_M_IN_MS", 1000},
notify_topics_metrics_in_ms: {:system, "EB_TOPICS_M_IN_MS", 250}
Endpoints
In your router.ex
, forward an unused path to EventBus.Metrics.Web.Router
like below:
forward "/event_bus", to: EventBus.Metrics.Web.Router
UI
HTTP Path for UI: /event_bus/ui/
To open and use the UI open the https://{your_host_name}/event_bus/ui/
and put https://{your_host_name}/event_bus
to endpoint url on the openned page.
Topics
GET /event_bus/topics
# All topic metrics
GET /event_bus/topics/:topic_name
# Specific topic metrics
GET /event_bus/topics/:topic_name/events
# Topic event metrics (only unprocessed events)
GET /event_bus/topics/:topic_name/events/:event_id
# Event details (only unprocessed events)
Subscribers
GET /event_bus/subscribers
# All subscriber metrics
Server-Sent-Events (stream live metrics)
GET /event_bus/sse
# Streaming endpoint for metrics
Documentation
The module docs can be found at https://hexdocs.pm/event_bus_metrics.
License
GNU General Public License v3.0
Copyright (c) 2018 Mustafa Turan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.