Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions internal/agent/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,11 @@ func (c *Client) StreamEvents(ctx context.Context, events chan<- container.Conta
}

events <- container.ContainerEvent{
ActorID: resp.Event.ActorId,
Name: resp.Event.Name,
Host: resp.Event.Host,
Time: resp.Event.Timestamp.AsTime(),
ActorID: resp.Event.ActorId,
Name: resp.Event.Name,
Host: resp.Event.Host,
Time: resp.Event.Timestamp.AsTime(),
ActorAttributes: resp.Event.ActorAttributes,
}
}
}
Expand Down Expand Up @@ -531,6 +532,11 @@ func (c *Client) UpdateNotificationConfig(ctx context.Context, subscriptions []t
Url: d.URL,
Template: d.Template,
Headers: d.Headers,
ApiKey: d.APIKey,
Prefix: d.Prefix,
}
if d.ExpiresAt != nil {
pbDispatchers[i].ExpiresAt = timestamppb.New(*d.ExpiresAt)
}
}

Expand Down
104 changes: 73 additions & 31 deletions internal/agent/pb/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions internal/agent/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ func (s *server) StreamEvents(in *pb.StreamEventsRequest, out pb.AgentService_St
case event := <-events:
out.Send(&pb.StreamEventsResponse{
Event: &pb.ContainerEvent{
ActorId: event.ActorID,
Name: event.Name,
Host: event.Host,
Timestamp: timestamppb.New(event.Time),
ActorId: event.ActorID,
Name: event.Name,
Host: event.Host,
Timestamp: timestamppb.New(event.Time),
ActorAttributes: event.ActorAttributes,
},
})
case <-out.Context().Done():
Expand Down Expand Up @@ -431,6 +432,12 @@ func (s *server) UpdateNotificationConfig(ctx context.Context, req *pb.UpdateNot
URL: d.Url,
Template: d.Template,
Headers: d.Headers,
APIKey: d.ApiKey,
Prefix: d.Prefix,
}
if d.ExpiresAt != nil {
t := d.ExpiresAt.AsTime()
dispatchers[i].ExpiresAt = &t
}
}

Expand Down
20 changes: 12 additions & 8 deletions internal/container/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ func (container Container) ToProto() pb.Container {
var pbStats []*pb.ContainerStat
for _, stat := range container.Stats.Data() {
pbStats = append(pbStats, &pb.ContainerStat{
Id: stat.ID,
CpuPercent: stat.CPUPercent,
MemoryPercent: stat.MemoryPercent,
MemoryUsage: stat.MemoryUsage,
Id: stat.ID,
CpuPercent: stat.CPUPercent,
MemoryPercent: stat.MemoryPercent,
MemoryUsage: stat.MemoryUsage,
NetworkRxTotal: stat.NetworkRxTotal,
NetworkTxTotal: stat.NetworkTxTotal,
})
}

Expand Down Expand Up @@ -68,10 +70,12 @@ func FromProto(c *pb.Container) Container {
var stats []ContainerStat
for _, stat := range c.Stats {
stats = append(stats, ContainerStat{
ID: stat.Id,
CPUPercent: stat.CpuPercent,
MemoryPercent: stat.MemoryPercent,
MemoryUsage: stat.MemoryUsage,
ID: stat.Id,
CPUPercent: stat.CpuPercent,
MemoryPercent: stat.MemoryPercent,
MemoryUsage: stat.MemoryUsage,
NetworkRxTotal: stat.NetworkRxTotal,
NetworkTxTotal: stat.NetworkTxTotal,
})
}

Expand Down
4 changes: 4 additions & 0 deletions protos/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ message ContainerEvent {
string name = 2;
string host = 3;
google.protobuf.Timestamp timestamp = 4;
map<string, string> actorAttributes = 5;
}

message Host {
Expand Down Expand Up @@ -113,6 +114,9 @@ message NotificationDispatcher {
string url = 4;
string template = 5;
map<string, string> headers = 6;
string apiKey = 7;
string prefix = 8;
google.protobuf.Timestamp expiresAt = 9;
}

message NotificationSubscriptionStats {
Expand Down
Loading