Skip to content

Commit

Permalink
(feat) add ListActiveSources and SourceHeartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
tphoney committed Sep 23, 2024
1 parent 51bd589 commit b5a2207
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions account.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
syntax = "proto3";

import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

Expand Down Expand Up @@ -150,6 +151,12 @@ service ManagementService {
// Deletes a source from a user's account
rpc DeleteSource(DeleteSourceRequest) returns (DeleteSourceResponse);

// Sources heartbeat and health
// List of all recently active sources and their health, includes managed and local sources
rpc ListAllSourcesStatus(ListAllSourcesStatusRequest) returns (ListAllSourcesStatusResponse);
// Heartbeat from a source to keep it registered and healthy
rpc SubmitSourceHeartbeat(SubmitSourceHeartbeatRequest) returns (SubmitSourceHeartbeatResponse);

// Updates sources to keep them running in the background. This can be used
// to add explicit action, when the built-in keepalives are not sufficient.
rpc KeepaliveSources(KeepaliveSourcesRequest) returns (KeepaliveSourcesResponse);
Expand Down Expand Up @@ -301,6 +308,71 @@ message SourceKeepaliveResult {
string Error = 3;
}

message ListAllSourcesStatusRequest {}

enum ActiveSourceStatus {
ACTIVE_SOURCE_STATUS_HEALTHY = 0;
ACTIVE_SOURCE_STATUS_UNHEALTHY = 1;
ACTIVE_SOURCE_STATUS_DISCONNECTED = 2;
}

// Whether the source is managed by srcman or was created by the user locally
enum SourceManaged {
MANAGED = 0;
LOCAL = 1;
}

message SourceHealth {
// The UUID of the source
bytes UUID = 1;
// The version of the source
string version = 2;
// The name of the source
string name = 3;
// The error message if the source is unhealthy
optional string error = 4;
// The status of the source, this is calculated based on the last heartbeat received and if there is an error
ActiveSourceStatus status = 5;
// The last time we received a heartbeat from the source
google.protobuf.Timestamp lastHeartbeat = 6;
// The type of the source, AWS or Stdlib or Kubernetes
string type = 7;
// Whether the source is managed, or local
SourceManaged managed = 8;
// The types of sources that this source can discover
repeated string availableTypes = 9;
// The scopes that this source can discover
repeated string availableScopes = 10;
}

message ListAllSourcesStatusResponse {
repeated SourceHealth source = 1;
}

// The source sends a heartbeat to the API to let it know that it is still alive, note it does not give a status.
message SubmitSourceHeartbeatRequest {
// The UUID of the source that is sending the heartbeat
bytes UUID = 1;
// The version of the source
string version = 2;
// The name of the source
string name = 3;
// The error message if the source is unhealthy
optional string error = 4;
// The interval until the source will send the next heartbeat, e.g. 10s
google.protobuf.Duration nextHeartbeat = 5;
// The type of the source, AWS or Stdlib or Kubernetes
string type = 6;
// Whether the source is managed, or local
SourceManaged managed = 7;
// The types of sources that this source can discover
repeated string availableTypes = 8;
// The scopes that this source can discover
repeated string availableScopes = 9;
}

message SubmitSourceHeartbeatResponse {}

message KeepaliveSourcesRequest {
// Set to true to have the API call wait until the source is up and healthy
bool waitForHealthy = 1;
Expand Down

0 comments on commit b5a2207

Please sign in to comment.