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

Analytics: don't spam warning when there is an HTTP connection problem #1564

Merged
merged 2 commits into from
Mar 13, 2023
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
8 changes: 4 additions & 4 deletions crates/re_analytics/src/pipeline_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ fn realtime_pipeline(
}

if let Err(err) = flush_events(session_file, &analytics_id, &session_id, sink) {
warn!(%err, %analytics_id, %session_id, "couldn't flush analytics data file");
re_log::debug_once!("couldn't flush analytics data file: {err}");
// We couldn't flush the session file: keep it intact so that we can retry later.
return;
}

if let Err(err) = session_file.set_len(0) {
warn!(%err, %analytics_id, %session_id, "couldn't truncate analytics data file");
re_log::warn_once!("couldn't truncate analytics data file: {err}");
// We couldn't truncate the session file: we'll have to keep it intact for now, which
// will result in duplicated data that we'll be able to deduplicate at query time.
return;
Expand All @@ -214,7 +214,7 @@ fn realtime_pipeline(
// We couldn't reset the session file... That one is a bit messy and will likely break
// analytics for the entire duration of this session, but that really _really_ should
// never happen.
warn!(%err, %analytics_id, %session_id, "couldn't seek into analytics data file");
re_log::warn_once!("couldn't seek into analytics data file: {err}");
}
};

Expand Down Expand Up @@ -288,7 +288,7 @@ fn flush_events(
) -> Result<(), SinkError> {
if let Err(err) = session_file.rewind() {
warn!(%err, %analytics_id, %session_id, "couldn't seek into analytics data file");
return Err(err.into());
return Err(SinkError::FileSeek(err));
}

let events = BufReader::new(&*session_file)
Expand Down
8 changes: 4 additions & 4 deletions crates/re_analytics/src/sink_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ struct Url(String);

#[derive(thiserror::Error, Debug)]
pub enum SinkError {
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("File seek error: {0}")]
FileSeek(std::io::Error),

#[error(transparent)]
#[error("JSON: {0}")]
Serde(#[from] serde_json::Error),

#[error(transparent)]
#[error("HTTP transport: {0}")]
HttpTransport(Box<ureq::Transport>),

#[error("HTTP status {status_code} {status_text}: {body}")]
Expand Down