Files
ReSkate/Engine/Core/Debug/multipart.h
T
AyeZeeBB 4ac1343b95 Crash reports: self-hosted Sentry instead of Backtrace, and opt-in performance timings
Crash dumps now go to the project's own Sentry server. The launcher's
out-of-process helper is unchanged; only where it posts and what it expects
back are:

- The default endpoint is the Sentry project's minidump URL. Report
  attributes travel as Sentry tags, with the release as reskate@<version>.
- An upload counts as accepted when the server answers with an event ID.
- "backtrace" is "crash_report" throughout: the namespace, files, CMake
  targets, DINGOSDK_CRASH_REPORT_URL, DINGOSDK_BUILD_CRASH_REPORT_TESTS and
  the RESKATE_CRASH_REPORT_URL override.

Performance timings are new, and off unless "Send performance timings" is
ticked in the launcher's settings (RESKATE_TRACING=1). A small tracer
(Engine/Core/Debug/trace.h) posts each finished step to Sentry as a
transaction from a background thread; the launcher and the game it starts
share one trace. Timed: the update check, the Steam download, Thunderstore
installs, the mod merge, starting the game, the launch up to the first
playable level, each level load, joining a session, fetching the identity
lists, and the time spent in each level with its average frame rate and
long frames. Turning crash reports off turns timings off too.
2026-10-12 23:24:33 -05:00

27 lines
1.0 KiB
C++

#pragma once
#include "protocol.h"
#include "Engine/Core/Json/json.h"
#include <filesystem>
#include <functional>
namespace dingosdk::crash_report {
inline constexpr DWORD max_log_bytes = 8 * 1024 * 1024;
enum class LogSnapshot { unavailable, complete, tail };
std::filesystem::path log_attachment_path(const std::filesystem::path& dump);
// Snapshot before publishing the dump; retrying must never read a later session's log.
LogSnapshot snapshot_log(const std::filesystem::path& source, const std::filesystem::path& dump) noexcept;
// Keeps the queued files open and unchanged until the complete request is sent.
class MultipartReport {
public:
MultipartReport(const std::filesystem::path& dump, const Json& attributes, const std::string& boundary);
DWORD error() const { return error_; }
DWORD size() const { return size_; }
bool write(const std::function<bool(const void*, DWORD)>& sink);
private:
Handle dump_, log_;
DWORD dump_bytes_{}, log_bytes_{}, size_{}, error_{};
std::string prefix_, attachments_, suffix_;
};
}