Skip to content

Commit

Permalink
add time window for storage grpc plugin
Browse files Browse the repository at this point in the history
Signed-off-by: rim99 <[email protected]>
  • Loading branch information
rim99 committed Nov 23, 2024
1 parent c00931f commit 975c152
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 105 deletions.
8 changes: 8 additions & 0 deletions plugin/storage/grpc/proto/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ message GetTraceRequest {
(gogoproto.customtype) = "github.com/jaegertracing/jaeger/model.TraceID",
(gogoproto.customname) = "TraceID"
];
google.protobuf.Timestamp start_time = 2 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
google.protobuf.Timestamp end_time = 3 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
}

message GetServicesRequest {}
Expand Down
4 changes: 4 additions & 0 deletions plugin/storage/grpc/proto/storage_test.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ package storageprototest;

option go_package = "./storageprototest";

import "google/protobuf/timestamp.proto";

message GetTraceRequest {
bytes trace_id = 1;
google.protobuf.Timestamp start_time = 2;
google.protobuf.Timestamp end_time = 3;
}
11 changes: 9 additions & 2 deletions plugin/storage/grpc/proto/storage_v1/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/jaegertracing/jaeger/model"
"github.com/jaegertracing/jaeger/pkg/testutils"
Expand All @@ -31,9 +32,15 @@ func TestGetTraceRequestMarshalProto(t *testing.T) {
}
for _, testCase := range testCases {
t.Run(testCase.name, func(t *testing.T) {
ref1 := storage_v1.GetTraceRequest{TraceID: model.NewTraceID(2, 3)}
ref1 := storage_v1.GetTraceRequest{
TraceID: model.NewTraceID(2, 3),
StartTime: time.Unix(1, 2).UTC(),
EndTime: time.Unix(3, 4).UTC(),
}
ref2 := storageprototest.GetTraceRequest{
TraceId: []byte{0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3},
TraceId: []byte{0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3},
StartTime: timestamppb.New(time.Unix(1, 2).UTC()),
EndTime: timestamppb.New(time.Unix(3, 4).UTC()),
}
d1, err := testCase.marshal(&ref1)
require.NoError(t, err)
Expand Down
55 changes: 42 additions & 13 deletions plugin/storage/grpc/proto/storageprototest/storage_test.pb.go

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

Loading

0 comments on commit 975c152

Please sign in to comment.