Skip to content
Open
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
16 changes: 9 additions & 7 deletions pkg/workflows/dontime/pb/dontime.pb.go

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

2 changes: 1 addition & 1 deletion pkg/workflows/dontime/pb/dontime.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ message Observation {
int64 timestamp = 1;
map<string, int64> requests = 2;
reserved 3;
bool limit_by_batch_size_flag = 4;
bool limit_by_batch_size_flag = 4 [deprecated = true];
}

message ObservedDonTimes {
Expand Down
5 changes: 2 additions & 3 deletions pkg/workflows/dontime/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ func (p *Plugin) Observation(ctx context.Context, outctx ocr3types.OutcomeContex
p.metrics.observationBatchOverflow.Record(ctx, int64(overflowCount))

observation := &pb.Observation{
Timestamp: time.Now().UTC().UnixMilli(),
Requests: requests,
LimitByBatchSizeFlag: true,
Timestamp: time.Now().UTC().UnixMilli(),
Requests: requests,
}

return proto.MarshalOptions{Deterministic: true}.Marshal(observation)
Expand Down
9 changes: 4 additions & 5 deletions pkg/workflows/dontime/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,12 @@ func TestPlugin_Outcome_TrimByBatchSize(t *testing.T) {
require.NoError(t, err)

timestamp := time.Now().UnixMilli()
makeObservations := func(limitByBatchSize bool) []types.AttributedObservation {
makeObservations := func() []types.AttributedObservation {
aos := make([]types.AttributedObservation, 4)
for i := range 4 {
obs := &pb.Observation{
Timestamp: timestamp + int64(i),
Requests: map[string]int64{},
LimitByBatchSizeFlag: limitByBatchSize,
Timestamp: timestamp + int64(i),
Requests: map[string]int64{},
}
rawObs, err := proto.Marshal(obs)
require.NoError(t, err)
Expand All @@ -622,7 +621,7 @@ func TestPlugin_Outcome_TrimByBatchSize(t *testing.T) {
require.NoError(t, err)

t.Run("batch size enforced", func(t *testing.T) {
outcome, err := plugin.Outcome(ctx, ocr3types.OutcomeContext{PreviousOutcome: prevOutcomeBytes}, query, makeObservations(true))
outcome, err := plugin.Outcome(ctx, ocr3types.OutcomeContext{PreviousOutcome: prevOutcomeBytes}, query, makeObservations())
require.NoError(t, err)

outcomeProto := &pb.Outcome{}
Expand Down
Loading