metropolis/pkg/logtree: move logtree protobuf definition to logtree pkg
Before this change we had the LogEntry message inside the metropolis
common proto file. This splits it out into the logtree package to make
it standalone in a future change.
Change-Id: Idb26a829d6174efa946a6c4ce0f1b984cb2f18a2
Reviewed-on: https://review.monogon.dev/c/monogon/+/3080
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/metropolis/proto/api/BUILD.bazel b/metropolis/proto/api/BUILD.bazel
index a1d681b..66ab06a 100644
--- a/metropolis/proto/api/BUILD.bazel
+++ b/metropolis/proto/api/BUILD.bazel
@@ -12,6 +12,7 @@
],
visibility = ["//visibility:public"],
deps = [
+ "//metropolis/pkg/logtree/proto:proto_proto",
"//metropolis/proto/common:common_proto",
"//metropolis/proto/ext:ext_proto",
"//net/proto:net_proto_proto",
@@ -26,6 +27,7 @@
proto = ":api_proto",
visibility = ["//visibility:public"],
deps = [
+ "//metropolis/pkg/logtree/proto",
"//metropolis/proto/common",
"//metropolis/proto/ext",
"//net/proto",
diff --git a/metropolis/proto/api/management.proto b/metropolis/proto/api/management.proto
index bdb4a03..bd7bd5b 100644
--- a/metropolis/proto/api/management.proto
+++ b/metropolis/proto/api/management.proto
@@ -4,6 +4,7 @@
import "google/protobuf/duration.proto";
+import "metropolis/pkg/logtree/proto/logtree.proto";
import "metropolis/proto/common/common.proto";
import "metropolis/proto/ext/authorization.proto";
@@ -386,11 +387,11 @@
message GetLogsResponse {
// Entries from the requested historical entries (via WithBackLog). They will
// all be served before the first stream_entries are served (if any).
- repeated metropolis.proto.common.LogEntry backlog_entries = 1;
+ repeated metropolis.pkg.logtree.proto.LogEntry backlog_entries = 1;
// Entries streamed as they arrive. Currently no server-side buffering is
// enabled, instead every line is served as early as it arrives. However, this
// might change in the future, so this behaviour cannot be depended upon.
- repeated metropolis.proto.common.LogEntry stream_entries = 2;
+ repeated metropolis.pkg.logtree.proto.LogEntry stream_entries = 2;
}
enum ActivationMode {
diff --git a/metropolis/proto/common/BUILD.bazel b/metropolis/proto/common/BUILD.bazel
index 05c4995..10f7f84 100644
--- a/metropolis/proto/common/BUILD.bazel
+++ b/metropolis/proto/common/BUILD.bazel
@@ -7,6 +7,7 @@
srcs = ["common.proto"],
visibility = ["//metropolis:__subpackages__"],
deps = [
+ "//metropolis/pkg/logtree/proto:proto_proto",
"//version/spec:spec_proto",
"@com_google_protobuf//:timestamp_proto",
],
@@ -17,7 +18,10 @@
importpath = "source.monogon.dev/metropolis/proto/common",
proto = ":common_proto",
visibility = ["//metropolis:__subpackages__"],
- deps = ["//version/spec"],
+ deps = [
+ "//metropolis/pkg/logtree/proto",
+ "//version/spec",
+ ],
)
go_library(
diff --git a/metropolis/proto/common/common.proto b/metropolis/proto/common/common.proto
index 653b0d2..b870d20 100644
--- a/metropolis/proto/common/common.proto
+++ b/metropolis/proto/common/common.proto
@@ -21,6 +21,8 @@
import "google/protobuf/timestamp.proto";
import "version/spec/spec.proto";
+import "metropolis/pkg/logtree/proto/logtree.proto";
+
// NodeRoles are the possible roles that a Metropolis Node should run within the
// cluster. These are configured by the cluster and can be retrieved through the
// Curator.
@@ -196,15 +198,6 @@
repeated Prefix prefixes = 2;
}
-// Severity level corresponding to //metropolis/pkg/logtree.Severity.
-enum LeveledLogSeverity {
- INVALID = 0;
- INFO = 1;
- WARNING = 2;
- ERROR = 3;
- FATAL = 4;
-}
-
// Filter set when requesting logs for a given DN. This message is equivalent to
// the following GADT enum:
// data LogFilter = WithChildren
@@ -231,7 +224,7 @@
// If leveled logs are returned, all entries at severity lower than `minimum`
// will be discarded.
message LeveledWithMinimumSeverity {
- LeveledLogSeverity minimum = 1;
+ metropolis.pkg.logtree.proto.LeveledLogSeverity minimum = 1;
}
oneof filter {
WithChildren with_children = 1;
@@ -241,34 +234,6 @@
}
}
-// LogEntry corresponding to logtree.LogEntry in //metropolis/pkg/logtree.
-message LogEntry {
- // A leveled log entry emitted from a compatible system, eg. Metorpolis code
- // or a klog-parsed line.
- message Leveled {
- repeated string lines = 1;
- google.protobuf.Timestamp timestamp = 2;
- LeveledLogSeverity severity = 3;
- // Source of the error, expressed as file:line.
- string location = 4;
- }
- // Raw log entry, captured from an external system without parting. Might
- // contain some timestamp/level/origin information embedded in data. Data
- // contained within should be treated as unsanitized external data.
- message Raw {
- string data = 1;
- // Original length of line, set if data was truncated.
- int64 original_length = 2;
- }
-
- // Origin DN.
- string dn = 1;
- oneof kind {
- Leveled leveled = 2;
- Raw raw = 3;
- }
-}
-
// ClusterConfiguration contains the entirety of the user-configurable behaviour
// of the cluster that is scoped to the entirety of the cluster (vs. per-node
// configuration, which is kept alongside Node).