-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
124058: log,logstream: structured log emission & consumption mechanism r=abarganier a=abarganier **Note: please only consider the final two commits. The first two commits are being reviewed separately in #119416 --- This PR introduces `log.Structured` to the log package API. It aims to serve as a prototype for the log facility we will use for exporting "exhaust" from CRDB in the form of JSON objects. The intention is that this exhaust can be consumed externally and be sufficient enough to build features around. This iteration has some serious limitations, the main one being that it is not redaction-aware. The `log.StructuredEvent` exists alongside it for now. Both implementations are quite similar, so they should probably be reconciled and/or combined, but this is left as a TODO to avoid slowing down the prototyping process. For now, it's sufficient for prototyping. The patch also introduces a new logging channel explicitly for the new `log.Structured` API, called `STRUCTURED_EVENTS`. The ability to segment these types of logs from the rest of the logs is what motivates this separate channel. The name works for now, but we should consider if there's a better name available. The PR also expands upon the new structured logging facilities, adding a mechanism to consume emitted structured logs internally. This is done primarily via the new pkg/obs/logstream package, which handles buffering, routing, & processing of events logged via log.Structured. It can be used in conjunction with the eventagg package, and the KVProcessor interface, to provide users of the eventagg package a way to consume streams of events flushed from their aggregations. This enables engineers to use the aggregated data flushed from their aggregations to build features internal to CRDB. Features that are powered by the same data that could be consumed externally via the STRUCTURED_EVENTS log channel. The provided log config can be updated to make use of this new channel. For example: ``` sinks: file-groups: structured-events: channels: [STRUCTURED_EVENTS] ``` The changes aim to complete the eventagg pipeline/ecosystem, which now allows engineers to use common facilities to define aggregations, log the aggregated results, and consume the logged events internally as input data. Finally, it completes the toy StmtStats example by defining a processor for the aggregated events that are logged. The below diagram outlines the end-to-end architecture of the system: ![Screenshot 2024-04-26 at 3 59 21 PM](https://github.com/cockroachdb/cockroach/assets/8194877/497c87d8-b7e7-440e-a69d-505a2e760be7) Release note: none Epic: CRDB-35919 Co-authored-by: Alex Barganier <abarganier@cockroachlabs.com>
- Loading branch information
Showing
31 changed files
with
1,839 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.