Skip to content

Commit 88c0592

Browse files
committed
Extend alertstore to support read/write of clusterpb.FullState.
Required to support the work for ring-based/sharding replication. Due to the underlying `clusterpb.FullState` type being an upstream type defined in alertmanager, it is wrapped in a separate message type (`alertspb.FullStateDesc`). This can be used to cope with backwards incompatible changes to the upstream data format, if ever necessary. Assuming we want to store the state alongside the existing state for the alertmanager, then it makes sense to extend the alertstore. This avoids having to plumb through a different storage widget or configuration. The slight complication is that the existing store uses an object path of `<prefix>/<user>`, so we have to use a different prefix in order to use the desired object path of `<prefix>/<user>/<object>`. Signed-off-by: Steve Simpson <[email protected]>
1 parent f629803 commit 88c0592

File tree

8 files changed

+434
-28
lines changed

8 files changed

+434
-28
lines changed

pkg/alertmanager/alertspb/alerts.pb.go

+225-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/alertmanager/alertspb/alerts.proto

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ syntax = "proto3";
22

33
package alerts;
44

5-
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
5+
import "gogoproto/gogo.proto";
6+
import "github.com/prometheus/alertmanager/cluster/clusterpb/cluster.proto";
67

78
option go_package = "alertspb";
89
option (gogoproto.marshaler_all) = true;
@@ -18,4 +19,11 @@ message AlertConfigDesc {
1819
message TemplateDesc {
1920
string filename = 1;
2021
string body = 2;
21-
}
22+
}
23+
24+
message FullStateDesc {
25+
// Alertmanager (clusterpb) types do not have Equal methods.
26+
option (gogoproto.equal) = false;
27+
28+
clusterpb.FullState state = 1;
29+
}

0 commit comments

Comments
 (0)