Skip to content
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

feat: Generic endpoint to get logs from Admin Service #4844

Merged
merged 2 commits into from
Mar 12, 2025
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
15 changes: 3 additions & 12 deletions backend/admin/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,18 +618,9 @@ func (s *Service) FailChangeset(ctx context.Context, c *connect.Request[ftlv1.Fa
return connect.NewResponse(res.Msg), nil
}

func (s *Service) StreamChangesetLogs(ctx context.Context, req *connect.Request[adminpb.StreamChangesetLogsRequest], resp *connect.ServerStream[adminpb.StreamChangesetLogsResponse]) error {
func (s *Service) StreamLogs(ctx context.Context, req *connect.Request[adminpb.StreamLogsRequest], resp *connect.ServerStream[adminpb.StreamLogsResponse]) error {
timeline, err := s.timelineClient.StreamTimeline(ctx, connect.NewRequest(&timelinepb.StreamTimelineRequest{
Query: &timelinepb.GetTimelineRequest{
Limit: 100000,
Filters: []*timelinepb.GetTimelineRequest_Filter{{
Filter: &timelinepb.GetTimelineRequest_Filter_Changesets{
Changesets: &timelinepb.GetTimelineRequest_ChangesetFilter{
Changesets: []string{req.Msg.ChangesetKey},
},
},
}},
},
Query: req.Msg.Query,
}))
if err != nil {
return fmt.Errorf("failed to get timeline: %w", err)
Expand All @@ -643,7 +634,7 @@ func (s *Service) StreamChangesetLogs(ctx context.Context, req *connect.Request[
logs = append(logs, log)
}
}
if err := resp.Send(&adminpb.StreamChangesetLogsResponse{
if err := resp.Send(&adminpb.StreamLogsResponse{
Logs: logs,
}); err != nil {
return fmt.Errorf("failed to send logs: %w", err)
Expand Down
969 changes: 486 additions & 483 deletions backend/protos/xyz/block/ftl/admin/v1/admin.pb.go

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions backend/protos/xyz/block/ftl/admin/v1/admin.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
syntax = "proto3";

Check failure on line 1 in backend/protos/xyz/block/ftl/admin/v1/admin.proto

View workflow job for this annotation

GitHub Actions / Proto Breaking Change Check

Previously present message "StreamChangesetLogsRequest" was deleted from file.

Check failure on line 1 in backend/protos/xyz/block/ftl/admin/v1/admin.proto

View workflow job for this annotation

GitHub Actions / Proto Breaking Change Check

Previously present message "StreamChangesetLogsResponse" was deleted from file.

package xyz.block.ftl.admin.v1;

import "xyz/block/ftl/schema/v1/schema.proto";
import "xyz/block/ftl/timeline/v1/event.proto";
import "xyz/block/ftl/timeline/v1/timeline.proto";
import "xyz/block/ftl/v1/ftl.proto";
import "xyz/block/ftl/v1/schemaservice.proto";

Expand Down Expand Up @@ -196,17 +197,17 @@
string arch = 2;
}

message StreamChangesetLogsRequest {
string changeset_key = 1;
message StreamLogsRequest {
timeline.v1.TimelineQuery query = 1;
}

message StreamChangesetLogsResponse {
message StreamLogsResponse {
repeated timeline.v1.LogEvent logs = 1;
}

// AdminService is the service that provides and updates admin data. For example,
// it is used to encapsulate configuration and secrets.
service AdminService {

Check failure on line 210 in backend/protos/xyz/block/ftl/admin/v1/admin.proto

View workflow job for this annotation

GitHub Actions / Proto Breaking Change Check

Previously present RPC "StreamChangesetLogs" on service "AdminService" was deleted.
rpc Ping(ftl.v1.PingRequest) returns (ftl.v1.PingResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
Expand Down Expand Up @@ -283,5 +284,5 @@
// Upload an artefact to the server.
rpc UploadArtefact(stream UploadArtefactRequest) returns (UploadArtefactResponse);

rpc StreamChangesetLogs(StreamChangesetLogsRequest) returns (stream StreamChangesetLogsResponse);
rpc StreamLogs(StreamLogsRequest) returns (stream StreamLogsResponse);
}

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

Loading
Loading