Skip to content
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: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ client never generates one, never reads or writes the file, and sends nothing.
| Property | Meaning |
|---|---|
| **Returns immediately** | The HTTP call runs on one thread the client owns. A game loop can report from its main thread and no frame waits on the network. |
| **Never throws** | Nothing in the client throws. A server that is down, slow, or rejecting the key — or a machine with no `curl` — is a dropped report, not an exception or a crash in your program. Drops are passed to the optional `Logger` (a `std::function<void(const std::string&)>`, last constructor argument), otherwise not mentioned at all. |
| **Never throws** | Nothing in the client throws. A server that is down, slow, or rejecting the key — or a machine with no `curl` — is a dropped report, not an exception or a crash in your program. Drops are passed to the optional `Logger` (a `std::function<void(const std::string&)>`, last constructor argument), otherwise not mentioned at all. A failed delivery is mentioned on the client's own thread, a full queue on the thread that called `report`, so a `Logger` that touches the program's state must be safe to call from either. |
| **Bounded** | At most 256 reports wait to be sent; past that, new ones are dropped. A trace server that is unreachable for a week costs a few kilobytes, not your memory. |
| **`close()` drains** | Reports already queued get up to the client timeout (5 s total) to be sent before the thread stops, so a CLI that reports and exits at once does not lose its event. Still bounded: an unreachable server delays exit by at most the timeout — a request still in flight then is abandoned and its `curl` process killed. `close(seconds)` takes another bound: a NaN or negative one waits for nothing, and `close(INFINITY)` waits until the queue is sent, each request still bounded by the timeout. Once `close()` returns, the `Logger` is never called again. |
| **Fits the server's limits** | Names and tag keys/values are cut to 255 bytes (never mid-character), at most 32 tags are sent, blank tag keys are dropped, invalid UTF-8 becomes U+FFFD, and NaN or infinite values are left out — so a report is never rejected as a whole for one bad field. A report whose name is empty or blank is not an event at all: it is ignored, without a mention to the `Logger`. |
Expand Down Expand Up @@ -238,7 +238,8 @@ or, where there is no make (MSVC),
Tests run the client against a small HTTP server written with plain sockets
on a loopback port — no more dependencies than the client itself — and never
reach a real trace server. CI runs them on Linux (g++ and clang++, C++11, 17
and 20; libcurl; ThreadSanitizer and AddressSanitizer), macOS and Windows
and 20; libcurl; ThreadSanitizer, and AddressSanitizer with
UndefinedBehaviorSanitizer), macOS and Windows
(MSVC with the system `curl.exe`).

## License
Expand Down
2 changes: 1 addition & 1 deletion trace_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ typedef std::function<void(const std::string &)> Logger;

/** How many reports may wait to be sent before new ones are dropped. */
static const std::size_t QUEUE_CAPACITY = 256;
/** Per-request timeout, and the most close() waits for queued reports. */
/** Per-request timeout, and the most close() waits for queued reports by default. */
static const double TIMEOUT_SECONDS = 5.0;
/** The server's limits: tags per report, and length of a name or tag key/value. */
static const std::size_t MAX_TAGS = 32;
Expand Down
Loading