Files
ReSkate/Engine/Core/Debug/upload.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

22 lines
1.1 KiB
C++

#pragma once
#include "Engine/Core/Json/json.h"
#include <Windows.h>
#include <filesystem>
#include <functional>
#include <string>
namespace dingosdk::crash_report {
inline constexpr std::uintmax_t max_dump_bytes = 128ull * 1024 * 1024;
inline constexpr std::size_t max_pending_reports = 20;
struct Endpoint { std::wstring host, resource; USHORT port{}; };
struct UploadResult { bool accepted{}; DWORD http_status{}, error{}; std::string report_id; };
bool parse_endpoint(const std::wstring& url, Endpoint& endpoint);
bool accepted_response(DWORD status, std::string_view response, std::string& report_id);
std::filesystem::path queue_directory(const std::filesystem::path& root, const std::wstring& url);
UploadResult upload_report(const std::wstring& url, const std::filesystem::path& dump, const Json& attributes);
using Sender = std::function<UploadResult(const std::wstring&, const std::filesystem::path&, const Json&)>;
// Cross-process queue lock prevents the launcher and game helpers submitting the same dump.
std::size_t upload_pending(const std::wstring& url, const std::filesystem::path& directory,
const Sender& sender = upload_report) noexcept;
}