Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: set high frequency log flushing defaults #37

Merged
merged 2 commits into from
Aug 21, 2024
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
5 changes: 5 additions & 0 deletions .changeset/plenty-years-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"pinorama-studio": patch
---

set high frequency log flushing defaults
17 changes: 12 additions & 5 deletions packages/pinorama-studio/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const defaultOptions = {
"server-prefix": "/pinorama",
"server-db-path": path.resolve(os.tmpdir(), "pinorama.msp"),
"admin-secret": "your-secret",
preset: "pino"
preset: "pino",
"batch-size": 10,
"flush-interval": 100
}

async function start(options) {
Expand Down Expand Up @@ -55,11 +57,13 @@ async function start(options) {
-f, --server-db-path Set Pinorama Server db filepath (default: TMPDIR/pinorama.msp).
-k, --server-admin-secret Set Pinorama Server admin secret key (default: ${defaultOptions["admin-secret"]}).
-p, --preset Use a predefined config preset (default: ${defaultOptions.preset}).
-b, --batch-size Set batch size for transport (default: ${defaultOptions.batchSize}).
-f, --flush-interval Set flush wait time in ms (default: ${defaultOptions.flushInterval}).

Examples:
pinorama --open
node app.js | pinorama
cat logs | pinorama -l -o
cat logs | pinorama --batch-size 1000 --flush-interval 5000
pinorama --host 192.168.1.1 --port 8080
pinorama --server --logger
node app.js | pinorama --open --preset fastify
Expand Down Expand Up @@ -118,8 +122,9 @@ async function start(options) {

const stream = pinoramaTransport({
url: serverUrl,
batchSize: 1000,
adminSecret: opts["admin-secret"]
adminSecret: opts["admin-secret"],
batchSize: opts["batch-size"],
flushInterval: opts["flush-interval"]
})

stream.on("error", (error) => {
Expand Down Expand Up @@ -167,7 +172,9 @@ start(
"server-prefix": "e",
"server-db-path": "f",
"admin-secret": "k",
preset: "p"
preset: "p",
"batch-size": "b",
"flush-interval": "f"
},
boolean: ["server", "open"],
default: defaultOptions
Expand Down