Skip to content

Commit

Permalink
Release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
philss committed Aug 30, 2021
1 parent c689d09 commit 98c1c76
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 22 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2021-08-30

### Added

- Initial release of Broadway Dashboard.

[Unreleased]: https://github.com/dashbitco/broadway_dashboard/compare/v0.1.0...HEAD
[0.0.1]: https://github.com/dashbitco/broadway_dashboard/releases/tag/v0.1.0
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ See [Distribution](#distribution) for details.

![Broadway Dashboard](https://raw.githubusercontent.com/dashbitco/broadway_dashboard/4da2a5f388a7579d41b63803652796c106b74785/priv/static/broadway-dashboard-01.gif)

## Integration with Phoenix Live Dashboard
## Integration with Phoenix LiveDashboard

You can add this page to your Phoenix Live Dashboard by adding as a page in
You can add this page to your Phoenix LiveDashboard by adding as a page in
the `live_dashboard` macro at your router file.

```elixir
Expand Down Expand Up @@ -49,7 +49,7 @@ your dashboard. This is possible because we "copy" the essential parts of this
tool to the remote node when it's not running `BroadwayDashboard`. We stop the tracking
once the node that started it is disconnected.

<!-- MDOC -->
<!-- MDOC !-->

## Installation

Expand Down
2 changes: 0 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ config :phoenix, :stacktrace_depth, 20

config :logger, level: :warn
config :logger, :console, format: "[$level] $message\n"

import_config "#{Mix.env()}.exs"
1 change: 0 additions & 1 deletion config/dev.exs

This file was deleted.

1 change: 0 additions & 1 deletion config/test.exs

This file was deleted.

8 changes: 5 additions & 3 deletions lib/broadway_dashboard.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ defmodule BroadwayDashboard do

# We check the Broadway version installed on remote nodes.
# This should match mix.exs.
@minimum_broadway_version "0.7.0-dev"
@minimum_broadway_version "1.0.0"

# TODO: update link
@disabled_link "https://hexdocs.pm/broadway_dashboard"
@page_title "Broadway pipelines"

Expand Down Expand Up @@ -120,7 +119,7 @@ defmodule BroadwayDashboard do
ArgumentError -> nil
end

def check_socket_connection(socket) do
defp check_socket_connection(socket) do
if connected?(socket) do
:ok
else
Expand Down Expand Up @@ -220,6 +219,9 @@ defmodule BroadwayDashboard do
:cannot_list_running_pipelines ->
"Could not list running pipelines at remote node. Please try again later."

:not_able_to_start_remotely ->
"Could not start the metrics server remotely. Please try again later."

{:badrpc, _} ->
"Could not send request to node. Try again later."
end
Expand Down
9 changes: 6 additions & 3 deletions lib/broadway_dashboard/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ defmodule BroadwayDashboard.Metrics do
if Process.whereis(name) do
{:ok, name}
else
with {:ok, _} <- start(pipeline: pipeline, name: name) do
with {:ok, _pid} <- start(pipeline: pipeline, name: name) do
{:ok, name}
end
end
Expand All @@ -59,13 +59,16 @@ defmodule BroadwayDashboard.Metrics do

nil ->
with :ok <- Teleporter.teleport_metrics_code(target_node),
pid when is_pid(pid) <-
{:ok, _pid} <-
:rpc.call(target_node, __MODULE__, :start, [
[pipeline: pipeline, name: name]
]) do
{:ok, {name, target_node}}
else
_ ->
{:error, {:already_started, _pid}} ->
{:ok, {name, target_node}}

_error ->
{:error, :not_able_to_start_remotely}
end

Expand Down
25 changes: 20 additions & 5 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule BroadwayDashboard.MixProject do
use Mix.Project

@version "0.1.0"
@description "A Phoenix LiveDashboard page for inspecting your Broadway pipelines"

def project do
[
Expand All @@ -10,29 +11,30 @@ defmodule BroadwayDashboard.MixProject do
elixir: "~> 1.11",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
name: "BroadwayDashboard",
description: @description,
package: package(),
aliases: aliases(),
docs: docs(),
deps: deps()
]
end

# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
mod: {BroadwayDashboard.Application, []}
]
end

# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:broadway, "~> 1.0"},
{:phoenix_live_dashboard, "~> 0.5.0"},
{:broadway, github: "dashbitco/broadway"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:plug_cowboy, "~> 2.0", only: :dev},
{:jason, "~> 1.0", only: [:dev, :test, :docs]},
{:ex_doc, "~> 0.24.2", only: [:dev, :docs], runtime: false},
{:ex_doc, "~> 0.24", only: [:docs], runtime: false},
{:stream_data, "~> 0.5", only: [:dev, :test]},
{:floki, "~> 0.27.0", only: :test}
]
Expand All @@ -42,10 +44,23 @@ defmodule BroadwayDashboard.MixProject do
[
main: "BroadwayDashboard",
source_ref: "v#{@version}",
source_url: "https://github.com/dashbitco/broadway_dashboard"
source_url: "https://github.com/dashbitco/broadway_dashboard",
homepage_url: "https://elixir-broadway.org"
]
end

defp package do
%{
maintainers: ["Philip Sampaio"],
licenses: ["Apache-2.0"],
links: %{
"GitHub" => "https://github.com/dashbitco/broadway_dashboard",
"Broadway website" => "https://elixir-broadway.org"
},
files: ~w(lib CHANGELOG.md LICENSE mix.exs README.md)
}
end

defp aliases do
[dev: "run --no-halt dev.exs"]
end
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
%{
"broadway": {:git, "https://github.com/dashbitco/broadway.git", "3d7191256c4c1279f5f90f2b331015290633f4aa", []},
"broadway": {:hex, :broadway, "1.0.0", "da99ca10aa221a9616ccff8cb8124510b7e063112d4593c3bae50448b37bbc90", [:mix], [{:gen_stage, "~> 1.0", [hex: :gen_stage, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.3.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b86ebd492f687edc9ad44d0f9e359da70f305b6d090e92a06551cef71ec41324"},
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"},
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
"earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"},
"ex_doc": {:hex, :ex_doc, "0.24.2", "e4c26603830c1a2286dae45f4412a4d1980e1e89dc779fcd0181ed1d5a05c8d9", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "e134e1d9e821b8d9e4244687fb2ace58d479b67b282de5158333b0d57c6fb7da"},
"ex_doc": {:hex, :ex_doc, "0.25.1", "4b736fa38dc76488a937e5ef2944f5474f3eff921de771b25371345a8dc810bc", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3200b0a69ddb2028365281fbef3753ea9e728683863d8cdaa96580925c891f67"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"floki": {:hex, :floki, "0.27.0", "6b29a14283f1e2e8fad824bc930eaa9477c462022075df6bea8f0ad811c13599", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "583b8c13697c37179f1f82443bcc7ad2f76fbc0bf4c186606eebd658f7f2631b"},
"gen_stage": {:hex, :gen_stage, "1.1.1", "78d83b14ca742f4c252770bcdf674d83378ca41579c387c57e2f06d70f596317", [:mix], [], "hexpm", "eb90d2d72609050a66ce42b7d4a69323a60c892a09ead0680d5d8ef16b9a034e"},
Expand Down
4 changes: 3 additions & 1 deletion test/broadway_dashboard_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ defmodule BroadwayDashboardTest do
end

test "renders error if auto discover is enabled but pipeline is registered using via" do
{:ok, _registry} = start_supervised({Registry, keys: :unique, name: MyRegistry})
{:ok, registry} = Registry.start_link(keys: :unique, name: MyRegistry)
name = via_tuple(:broadway)

{:ok, _broadway} =
Expand All @@ -103,6 +103,8 @@ defmodule BroadwayDashboardTest do

rendered = render(live)
assert rendered =~ "There is no pipeline running"

Process.exit(registry, :normal)
end

defp via_tuple(name), do: {:via, Registry, {MyRegistry, name}}
Expand Down
2 changes: 1 addition & 1 deletion test/support/dummy_broadway_app.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is a self contained Broadway application.
# It is used in integration tests for distribution
# testing.
Mix.install([:broadway])
Mix.install(broadway: "~> 1.0")

defmodule MyDummy do
use Broadway
Expand Down

0 comments on commit 98c1c76

Please sign in to comment.