Skip to content

Commit

Permalink
0.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimryndin committed May 2, 2024
1 parent 95b54cc commit d1392ef
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/site/src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
8 changes: 4 additions & 4 deletions .github/site/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ curl --proto '=https' --tlsv1.2 -sSf https://maksimryndin.github.io/goral/instal
</summary>

```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
```
</details>
Expand All @@ -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 <target triple>
```
Expand Down
6 changes: 4 additions & 2 deletions .github/site/src/kv-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:<port>/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_]*$ */
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion .github/site/src/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "goral"
version = "0.1.4"
version = "0.1.5"
edition = "2021"
author = "Maksim Ryndin"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/services/general/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async fn latest_release() -> Result<GithubRelease, Box<dyn std::error::Error + S
let url = "https://api.github.com/repos/maksimryndin/goral/releases/latest"
.parse()
.expect("assert: latest release url is correct");
let client = HttpClient::new(8192, true, Duration::from_millis(1000), url);
let client = HttpClient::new(32768, true, Duration::from_millis(1000), url);
let res = client.get().await?;
Ok(serde_json::from_str(&res)?)
}
Expand Down
4 changes: 3 additions & 1 deletion src/services/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ impl KvService {
let body = hyper::body::aggregate(req).await?;
let req_body: Request = match serde_json::from_reader(body.reader()) {
Err(e) => {
tracing::warn!("invalid request to KV service: {e}");
return Ok(HyperResponse::builder()
.status(StatusCode::UNPROCESSABLE_ENTITY)
.header(header::CONTENT_TYPE, "application/json")
Expand All @@ -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")
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d1392ef

Please sign in to comment.