Skip to content

Commit

Permalink
Redis set support + RedisTempList managed expiring list, great for te…
Browse files Browse the repository at this point in the history
…mp logs/events (#31)
  • Loading branch information
zakstucke authored Apr 8, 2024
1 parent e277f26 commit d1f4458
Show file tree
Hide file tree
Showing 14 changed files with 599 additions and 163 deletions.
25 changes: 13 additions & 12 deletions .zetch.lock

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

4 changes: 2 additions & 2 deletions js/package-lock.json

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

2 changes: 1 addition & 1 deletion opencollector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exporters:
stream-name: default
# Writes all opentelemetry logs, traces, metrics to a file, useful for testing:
file/debug_file_writing:
path: /home/runner/work/bitbazaar/bitbazaar/logs/otlp_telemetry_out.log
path: /Users/zak/z/code/bitbazaar/logs/otlp_telemetry_out.log
rotation:
max_megabytes: 10
max_days: 3
Expand Down
1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ redis = [
'dep:rand',
'dep:futures',
'dep:futures-timer',
'dep:chrono',
]
opentelemetry-grpc = [
'dep:tracing-log',
Expand Down
15 changes: 14 additions & 1 deletion rust/bitbazaar/log/global_log/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,29 @@ pub fn builder_into_global_log(builder: GlobalLogBuilder) -> Result<GlobalLog, A
// Spinlock up to 10 seconds until the collector is listening, important not to lose startup logs, don't want to continue until we know the collector can receive logs.
let wait_start = std::time::Instant::now();
let mut found_collector = false;
let mut is_first = true;
while wait_start.elapsed() < std::time::Duration::from_secs(10) {
if crate::misc::is_tcp_port_listening("localhost", port)? {
found_collector = true;

// If printed the spinlocking message, confirm all good now:
if !is_first {
println!("Collector up after {:?}!", wait_start.elapsed());
}

break;
}

if is_first {
println!("Spinlocking for up to 10 seconds for OpenTelemetry collector availability on local port {}...", port);
is_first = false;
}

// Don't want this to delay startup otherwise, so very short waits:
std::thread::sleep(std::time::Duration::from_millis(5));
}
if !found_collector {
return Err(anyerr!("Can't connect to open telemetry collector on local port {} (waited for 10 seconds). Are you sure it's running?", port));
return Err(anyerr!("Can't connect to open telemetry collector on local port {}. Are you sure it's running?", port));
}

let endpoint = format!("grpc://localhost:{}", port);
Expand Down
Loading

0 comments on commit d1f4458

Please sign in to comment.