Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ jobs:
command: build
# ndi-sdk-sys (behind the ndi features) only supports Linux x86 (no aarch64) so far.
# We already run the tests on x86 Linux with all features above.
args: --target=${{ matrix.target }} --features alpha,binary-set-pixel,binary-sync-pixels,egui,winit,vnc
args: --target=${{ matrix.target }} --features prometheus,alpha,binary-set-pixel,binary-sync-pixels,egui,winit,vnc
# I couldn't get pkg-config to work on macOS and Windows, so we omit the vnc and ndi feature
- if: runner.os == 'macOS' || runner.os == 'Windows'
uses: actions-rs/cargo@v1
with:
command: build
args: --target=${{ matrix.target }} --no-default-features --features alpha,binary-set-pixel,binary-sync-pixels,egui,winit
args: --target=${{ matrix.target }} --no-default-features --features prometheus,alpha,binary-set-pixel,binary-sync-pixels,egui,winit
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- if: runner.os != 'Windows'
name: Build binary (non Windows)
# We don't want to e.g. set "-C target-cpu=native", so that the binary should run everywhere
run: RUSTFLAGS='' cargo build --release --target=${{ matrix.target }} --no-default-features --features egui
run: RUSTFLAGS='' cargo build --release --target=${{ matrix.target }} --no-default-features --features prometheus,egui,winit
- if: runner.os == 'Windows'
name: Build binary (Windows)
# Windows is a joke :)
Expand All @@ -55,7 +55,7 @@ jobs:
# | ~~~~~~~~~~~~
# | The term 'RUSTFLAGS=' is not recognized as a name of a cmdlet, function, script file, or executable program.
# | Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
run: cargo build --release --target=${{ matrix.target }} --no-default-features --features egui
run: cargo build --release --target=${{ matrix.target }} --no-default-features --features prometheus,egui,winit
- name: Rename binary file
run: mv target/${{ matrix.target }}/release/breakwater${{ matrix.file-suffix }} breakwater-${{ matrix.target }}${{ matrix.file-suffix }}
- name: Upload Release binaries
Expand All @@ -68,7 +68,7 @@ jobs:
- if: runner.os == 'Linux'
name: Build binary with VNC support (Linux)
# We don't want to e.g. set "-C target-cpu=native", so that the binary should run everywhere
run: RUSTFLAGS='' cargo build --release --target=${{ matrix.target }} --no-default-features --features egui,vnc
run: RUSTFLAGS='' cargo build --release --target=${{ matrix.target }} --no-default-features --features prometheus,egui,winit,vnc
- if: runner.os == 'Linux'
name: Rename binary file with VNC support
run: mv target/${{ matrix.target }}/release/breakwater${{ matrix.file-suffix }} breakwater-with-vnc-support-${{ matrix.target }}${{ matrix.file-suffix }}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Moved prometheus metric exposition behind the `prometheus` feature.
This allows you to build breakwater on platforms where the `prometheus` [currently](https://github.com/tikv/rust-prometheus/issues/565) fails to compile (e.g. 32 bit targets).

### Changed

- BREAKING: Refactor CLI arguments ([#89]).
Expand Down
22 changes: 16 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ COPY Arial.ttf .
# Also we can always build with vnc server support as the docker image contains all needed dependencies in any case
# While the "native-display" feature compiles successfully, we'd rather not offer the CLI option, as it might cause
# users to think it should work (which it doesn't). So let's not enable that feature
RUN RUSTFLAGS='' cargo build --release --no-default-features --features vnc,binary-set-pixel
RUN RUSTFLAGS='' cargo build --release --no-default-features --features prometheus,vnc,binary-set-pixel

FROM debian:bookworm-slim AS final
RUN apt-get update && \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Breakwater also has some compile-time features for dependency or performance rea
You can get the list of available features by looking at the [Cargo.toml](Cargo.toml).
As of writing the following features are supported:

* `prometheus` (enabled by default): Enables the Prometheus metrics exporter. Can be disabled to support compilation on 32-bit targets.
* `egui` (enabled by default): Enables an advanced customizable graphical frontend on your local system. Please note that this requires a graphical environment.
* `winit` (enabled by default): Enables a minimalist graphical window on your local system. Please note that this requires a graphical environment.
* `ndi` (disabled by default): Enables NDI video streaming. This requires the proprietary NDI SDK to be installed, see below.
Expand Down
7 changes: 5 additions & 2 deletions breakwater/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ memadvise.workspace = true
ndi-sdk-sys = { workspace = true, optional = true }
number_prefix = { workspace = true, optional = true }
page_size.workspace = true
prometheus_exporter.workspace = true
prometheus_exporter = { workspace = true, optional = true }
rusttype = { workspace = true, optional = true }
serde_json.workspace = true
serde.workspace = true
Expand All @@ -52,8 +52,11 @@ rstest.workspace = true
# VNC and NDI require shared libraries to be installed, so we don't enable them by default
# Yes, egui and winit require a graphical environment, but most people getting started with
# breakwater will likely do that on a desktop, servers admins generally know what they are doing (tm).
default = ["egui", "winit"]
default = ["prometheus", "egui", "winit"]

# Enables the Prometheus metrics exporter. Can be disabled to support compilation on 32-bit targets.
# See https://github.com/tikv/rust-prometheus/issues/565
prometheus = ["dep:prometheus_exporter"]
alpha = ["breakwater-parser/alpha"]
binary-set-pixel = ["breakwater-parser/binary-set-pixel"]
binary-sync-pixels = ["breakwater-parser/binary-sync-pixels"]
Expand Down
7 changes: 5 additions & 2 deletions breakwater/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use tokio::sync::{broadcast, mpsc};

use crate::{
cli_args::CliArgs,
prometheus_exporter::PrometheusExporter,
sinks::start_sinks,
statistics::{Statistics, StatisticsEvent, StatisticsInformationEvent, StatisticsSaveMode},
};

mod cli_args;
mod connection_buffer;
#[cfg(feature = "prometheus")]
mod prometheus_exporter;
mod server;
mod sinks;
Expand Down Expand Up @@ -89,14 +89,16 @@ async fn main() -> eyre::Result<()> {
.await
.context("failed to start pixelflut server")?;

let mut prometheus_exporter = PrometheusExporter::new(
#[cfg(feature = "prometheus")]
let mut prometheus_exporter = prometheus_exporter::PrometheusExporter::new(
&args.prometheus_listen_address,
statistics_information_rx.resubscribe(),
)
.context("failed to start prometheus exporter")?;

let server_listener_thread = tokio::spawn(async move { server.start().await });
let statistics_thread = tokio::spawn(async move { statistics.run().await });
#[cfg(feature = "prometheus")]
let prometheus_exporter_thread = tokio::spawn(async move { prometheus_exporter.run().await });

let (sink_tasks, ffmpeg_thread_present) = start_sinks(
Expand All @@ -110,6 +112,7 @@ async fn main() -> eyre::Result<()> {
.await
.context("failed to start sinks")?;

#[cfg(feature = "prometheus")]
prometheus_exporter_thread.abort();
server_listener_thread.abort();

Expand Down
Loading