-
Notifications
You must be signed in to change notification settings - Fork 240
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
Oss observability proposal draft #806
base: main
Are you sure you want to change the base?
Oss observability proposal draft #806
Conversation
Related: #811 provides a draft implementation of BES support for Buck2. |
Let's move the discussion from Discord to this PR so folks can reference items in our discussion more easily. For context, I also raised bazelbuild/remote-apis#318 to the Remote API working group and got some pretty interesting feedback there. First, let's give a high-level overview of Bazel's current BES/BEP state. Currently, in Bazel, we have this
This establishes a bi-directional stream for the client to send events to the server. I think this is a good design that we should keep in Buck2. Next, let's talk about the Build Events. There are actually 2 "event" protos in Bazel. An outer generic one and an inner set of "events" that are Bazel-specific. The first type of events is google.devtools.build.v1.BuildEvent.
This is what is being sent in the bidi stream above. All the Bazel-specific events are currently being stuffed into the Bazel's Build Event Protocol(BEP) is the set of inner events that are stuffed into the From the Remote APIs meetings, folks were very much in favor of standardizing BES and not BEP as the latter is specific to Bazel. My past proposal in #685, which @aherrmann is building upon, introduced a much more simplified version of BES that is specific to Buck2's BuckEvent:
I picked this because I think it's the simplest interface that I think can get the job done.
Just note that bringing on the entire BES could add additional complexity to the implementation. Protocol aside, there is a need to make BuckEvent work with existing tooling today. However, I prefer to treat it as a separate problem from the protocol as it would help narrow down the problem scope and increase the chance of success for the implementation. |
Small correction: @aherrmann implemented BuckEvent -> Bazel BEP conversion in #811 instead of using my proposal 😅 |
I opted for that route for now to keep the implementation simple while it is at a more exploratory stage. That said, it is structured in a way that should make it easy to adopt the pattern proposed in #685. |
@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
I created a prototype of this last week based on @aherrmann PR #811 . It's very incomplete but you can check out the code here main...sluongng:buck2:sluongng/bes The main ideas are: 1. To send raw BuckEvent from the client to the server and 2. To support send_now, which bypasses the queue. For (1), we do that by simply modifying the proto message message BuildEvent {
...
// //////////////////////////////////////////////////////////////////////////
// Events that indicate a state change of a build request in the build
// queue.
oneof event {
// An invocation attempt has started.
InvocationAttemptStarted invocation_attempt_started = 51;
// An invocation attempt has finished.
InvocationAttemptFinished invocation_attempt_finished = 52;
// The build is enqueued.
BuildEnqueued build_enqueued = 53;
// The build has finished. Set when the build is terminated.
BuildFinished build_finished = 55;
// An event containing printed text.
ConsoleOutput console_output = 56;
// Indicates the end of a build event stream (with the same StreamId) from
// a build component executing the requested build task.
// *** This field does not indicate the WatchBuild RPC is finished. ***
BuildComponentStreamFinished component_stream_finished = 59;
// Structured build event generated by Bazel about its execution progress.
google.protobuf.Any bazel_event = 60;
// An event that contains supplemental tool-specific information about
// build execution.
google.protobuf.Any build_execution_event = 61;
// An event that contains supplemental tool-specific information about
// source fetching.
google.protobuf.Any source_fetch_event = 62;
// Structured build event generated by Buck about its execution progress.
google.protobuf.Any buck_event = 63;
}
} This enables us to shove the raw, unmodified BuckEvent to servers that implemented service PublishBuildEvent {
rpc PublishLifecycleEvent(PublishLifecycleEventRequest) returns (google.protobuf.Empty)
rpc PublishBuildToolEventStream(stream PublishBuildToolEventStreamRequest) returns (stream PublishBuildToolEventStreamResponse)
} Here, we solved number (2) by sending all the regular events asynchronously with I think this is a reasonable approach with minimal, backward-compatible API changes for most OSS implementations out there. The most difficult part here would probably be having Meta agree with using the field and Google agree with adding the field to the proto. But if Meta team is willing to give a thumbs up, I am willing to put some hours into sending the change to Google folks for approval. Implementation-wise, I noticed a few problems client-side when I was working on this:
|
The goal of this proposal is to add observability to Buck2's OSS variant that is on par with similar build systems like Bazel.