Commit graph

21 commits

Author SHA1 Message Date
Gergely Nagy
7c6ac855d8
Lift out the metrics into its own module
Some checks failed
build / binary (push) Has been cancelled
build / binary-static (x86_64-linux) (push) Has been cancelled
build / container (push) Has been cancelled
build / clippy (push) Has been cancelled
lint / linting (push) Has been cancelled
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-07 15:24:22 +01:00
Gergely Nagy
6fa438ebcb
Make the metrics always available
Previously, metrics were behind a feature flag (which was enabled by
default), now it's always available, but still disabled by default.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-07 15:07:40 +01:00
Gergely Nagy
4cc634e07e
metrics: No need to set instance
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-06 22:01:54 +01:00
Gergely Nagy
4b91d25a88
metrics: Add a process_start_time_seconds gauge
The new metric is there to help gauge iocaine's uptime, without relying
on an external collector like `systemd_exporter`.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-06 21:50:53 +01:00
Gergely Nagy
7497c955fc
app: Do not ignore app startup errors
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (x86_64-linux) (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
documentation / documentation (push) Waiting to run
documentation / notification (push) Blocked by required conditions
lint / linting (push) Waiting to run
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-06 17:11:46 +01:00
Gergely Nagy
2bdfa92d3e
Implement per-host templates
Fixes #7.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-06 17:04:11 +01:00
Gergely Nagy
0b1ee4fe42
Metrics reimagined
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-05 09:50:07 +01:00
Gergely Nagy
3126882a35
Implement Prometheus-compatible, optional metrics
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-05 02:36:13 +01:00
Gergely Nagy
0b76a1633e
No need for a Mutex
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
lint / linting (push) Waiting to run
There's no need for a `Mutex` in `StatefulIocaine`, so drop it - keep
only `Arc`.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-04 01:43:04 +01:00
Gergely Nagy
a0410a528d
Slightly reduce the amount of cloning
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
lint / linting (push) Waiting to run
Rather than cloning `Iocaine` (along with the markov chain & everything)
all over the place, declare it shared state behind an `Arc<Mutex>`. This
should reduce the amount of cloning done noticably.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-02-03 23:37:03 +01:00
Gergely Nagy
aa4c387605
Add a number of tests
Some checks are pending
build / binary (push) Waiting to run
build / binary-static (push) Waiting to run
build / container (push) Waiting to run
build / clippy (push) Waiting to run
lint / linting (push) Waiting to run
These are quite... simple, and cover little, but it's more than nothing!

While there, enable tests in the Nix package, so they're run in CI too.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-30 09:18:35 +01:00
Gergely Nagy
a039cf2310
Update rand & rand_chacha to 0.9.0
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-30 07:47:39 +01:00
Gergely Nagy
ae8b06a4d5
Make templating actually useful
This rebuilds the templating so that the *content* is no longer
pre-generated, only the parameters. It is up to the template (and some
newly implemented helper functions) to construct the output from those.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-29 00:20:21 +01:00
Gergely Nagy
5d60b84300
Make the generated HTML templatable
Use Handlebars to generate the HTML output, to make it easier to change.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-28 08:50:22 +01:00
Gergely Nagy
e3306e7998
Slight environment variable adjustment
When configuring iocaine via environment variables, sections and
settings were separated by two underlines, but the `IOCAINE_` prefix
only had one. This felt weird, so now iocaine supports an `IOCAINE__`
prefix too, and keeps recognizing the old one too.

Documentation and examples updated to use the new naming. No mention of
the backwards compatibility - I'll just silently support that.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-25 02:16:06 +01:00
Gergely Nagy
b214131d8b
app: Implement graceful shutdown
When calling `axum::serve`, use `.with_graceful_shutdown()` to register
a `ctrl+c` handler, so that Iocaine can be gracefully shut down. This
also allows gracefully shutting it down when running inside a container.

Fixes #1, thanks @alciregi!

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-19 22:04:55 +01:00
Gergely Nagy
764cf9afd0
Add an "initial_seed" option
The initial seed is used by the RNG, and the intended use is to allow
modifying the generated output without otherwise modifying the
configuration, while still being a static, controllable seed that can be
shared between instances if need be.

Thanks to @buherator@infosec.place for the idea!

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-19 19:16:04 +01:00
Gergely Nagy
598338094c
Fix the tokio-console feature
Don't initialize `tracing_subscriber` if the `tokio-console` feature is
enabled - they conflict.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 14:20:38 +01:00
Gergely Nagy
a01cb16ae0
cli: Default to "config.toml" as config file
This is expected to run through a systemd system service, with the
config file explicitly specified. Using XDG for the default config makes
little sense in that case, and ends up causing issues with a strict
systemd service file.

Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 12:24:16 +01:00
Gergely Nagy
9658f95ac3
poison: Remove a superfluous <p></p>
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 12:23:25 +01:00
Gergely Nagy
f28642532d
Initial import
Signed-off-by: Gergely Nagy <me@gergo.csillger.hu>
2025-01-16 10:44:56 +01:00