From d1392efc5cb30b9bd34620230bc4f9ead6f78d3e Mon Sep 17 00:00:00 2001 From: Maksim Ryndin Date: Thu, 2 May 2024 16:11:55 +0000 Subject: [PATCH] 0.1.5 --- .github/ISSUE_TEMPLATE/BUG_REPORT.yaml | 1 + .github/site/src/install.sh | 2 +- .github/site/src/installation.md | 8 ++++---- .github/site/src/kv-log.md | 6 ++++-- .github/site/src/logs.md | 2 +- CHANGELOG.md | 4 ++++ Cargo.lock | 2 +- Cargo.toml | 2 +- src/services/general/mod.rs | 2 +- src/services/kv/mod.rs | 4 +++- 10 files changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yaml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yaml index 05d9403..77d28fd 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yaml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yaml @@ -80,6 +80,7 @@ body: label: Which version of Goral do you run (`goral --version`)? multiple: false options: + - 0.1.5 - 0.1.4 - 0.1.3 - 0.1.2 diff --git a/.github/site/src/install.sh b/.github/site/src/install.sh index eaab101..376156c 100755 --- a/.github/site/src/install.sh +++ b/.github/site/src/install.sh @@ -21,7 +21,7 @@ main() { get_architecture || return 1 local _arch="$RETVAL" - local _version=${1:-'0.1.4'} + local _version=${1:-'0.1.5'} assert_nz "$_arch" "arch" local _file="goral-${_version}-${_arch}" diff --git a/.github/site/src/installation.md b/.github/site/src/installation.md index b3a5584..5dde8d1 100644 --- a/.github/site/src/installation.md +++ b/.github/site/src/installation.md @@ -11,9 +11,9 @@ curl --proto '=https' --tlsv1.2 -sSf https://maksimryndin.github.io/goral/instal ```sh -wget https://github.com/maksimryndin/goral/releases/download/0.1.4/goral-0.1.4-x86_64-unknown-linux-gnu.tar.gz -tar -xzf goral-0.1.4-x86_64-unknown-linux-gnu.tar.gz -cd goral-0.1.4-x86_64-unknown-linux-gnu/ +wget https://github.com/maksimryndin/goral/releases/download/0.1.5/goral-0.1.5-x86_64-unknown-linux-gnu.tar.gz +tar -xzf goral-0.1.5-x86_64-unknown-linux-gnu.tar.gz +cd goral-0.1.5-x86_64-unknown-linux-gnu/ shasum -a 256 -c sha256_checksum.txt ``` @@ -23,7 +23,7 @@ shasum -a 256 -c sha256_checksum.txt ```sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -git clone --depth 1 --branch 0.1.4 https://github.com/maksimryndin/goral +git clone --depth 1 --branch 0.1.5 https://github.com/maksimryndin/goral cd goral RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target ``` diff --git a/.github/site/src/kv-log.md b/.github/site/src/kv-log.md index cae2670..584ad1b 100644 --- a/.github/site/src/kv-log.md +++ b/.github/site/src/kv-log.md @@ -27,7 +27,8 @@ port = <"port from the range 49152-65535"> Such a configuration runs a server process in the Goral daemon listening at the specified port (localhost only for security reasons). From your app you periodically make a batch POST request to `localhost:/api/kv` with a json body: ```json -[ +{ + "rows": [ { "datetime": "2023-12-09T09:50:46.136945094Z", /* an RFC 3339 and ISO 8601 date and time string */ "log_name": "orders", /* validated against regex ^[a-zA-Z_][a-zA-Z0-9_]*$ */ @@ -43,7 +44,8 @@ Such a configuration runs a server process in the Goral daemon listening at the "log_name": "campaigns", "data": [["name", "10% discount for buying 3 donuts"], ["is active", true], ["credits", -6], ["datetime", "2023-12-11 09:19:32.827321506"]], /* datatypes for values are string, integer (unsigned 64-bits), boolean, float (64 bits) and datetime string (in common formats without tz) */ } -] + ] +} ``` Appending to the log is *not idempotent*, i.e. if you retry the same request two times, then the same set of rows will be added twice. If it is absolutely important to avoid any duplication (which may happen in case of some unexpected failure or retrying logic), then it is recommended to some unique idempotence key to `data` to be able to filter duplicates in the spreadsheet and remove them manually. diff --git a/.github/site/src/logs.md b/.github/site/src/logs.md index 34d20a8..47c64de 100644 --- a/.github/site/src/logs.md +++ b/.github/site/src/logs.md @@ -29,7 +29,7 @@ will create a single sheet with columns `datetime`, `level`, `log_line`. A log line is truncated to 50 000 chars as it is a Google Sheets limit for a cell. Goral tries to extract a log level and datetime from a log line. If it fails to extract a log level then `N/A` is displayed. If it fails to extract datetime, then the current system time is used. -For logs collection Goral reads its stdin. Basically it is a portable way to collect stdout of another process without a privileged access. +For logs collection Goral reads its stdin. Basically it is a portable way to collect stdout of another process without a privileged access. Using pipes, you can create a more sophisticated preprocessing of logs. There is a caveat - if we make a simple pipe like `instrumented_app | goral` then in case of a termination of the `instrumented_app` Goral will not see any input and will stop reading. [There is a way with named pipes](https://www.baeldung.com/linux/stdout-to-multiple-commands#3-solve-the-problem-usingtee-and-named-pipes) (for Windows there should also be a way as it also supports named pipes). * You create a named pipe, say `instrumented_app_logs_pipe` with the command `mkfifo instrumented_app_logs_pipe` (it creates a pipe file in the current directory - you can choose an appropriate place) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3d4b4c..b6b0647 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +* 0.1.5 + * increase max body size for latest release check + * KV server shutdown message fix + * 0.1.4 * minor improvements for notifications * urls with specified domains do not require ports diff --git a/Cargo.lock b/Cargo.lock index cc7fa30..9482974 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -657,7 +657,7 @@ dependencies = [ [[package]] name = "goral" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 4aaf3a3..ed5fd70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "goral" -version = "0.1.4" +version = "0.1.5" edition = "2021" author = "Maksim Ryndin" license = "Apache-2.0" diff --git a/src/services/general/mod.rs b/src/services/general/mod.rs index 6d9584b..03fd625 100644 --- a/src/services/general/mod.rs +++ b/src/services/general/mod.rs @@ -30,7 +30,7 @@ async fn latest_release() -> Result { + tracing::warn!("invalid request to KV service: {e}"); return Ok(HyperResponse::builder() .status(StatusCode::UNPROCESSABLE_ENTITY) .header(header::CONTENT_TYPE, "application/json") @@ -188,6 +189,7 @@ impl KvService { Ok(b) => b, }; if let Err(e) = req_body.validate() { + tracing::warn!("invalid request to KV service: {e}"); return Ok(HyperResponse::builder() .status(StatusCode::BAD_REQUEST) .header(header::CONTENT_TYPE, "application/json") @@ -278,8 +280,8 @@ impl KvService { })); let server = server.with_graceful_shutdown(async move { - tracing::info!("KV server is shutting down"); shutdown.recv().await.ok(); + tracing::info!("KV server is shutting down"); }); let send_notification = self.shared.send_notification.clone();