Skip to content

Commit

Permalink
bigquery: monkit stat and timeout for BQ eventkit injection
Browse files Browse the repository at this point in the history
Change-Id: I923004513ed27b15b5e285430df5a23ae2d88c64
  • Loading branch information
elek committed Feb 21, 2024
1 parent 3c9a399 commit 6551794
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion eventkitd-bigquery/bigquery/destination.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (C) 2024 Storj Labs, Inc.
// See LICENSE for copying information.

package bigquery

import (
Expand Down Expand Up @@ -38,6 +41,8 @@ func NewBigQueryDestination(ctx context.Context, appName string, project string,

// Submit implements Destination.
func (b *BigQueryDestination) Submit(events ...*eventkit.Event) {
var err error
defer mon.Task()(nil)(&err)
records := map[string][]*Record{}
for _, event := range events {
var tags []*pb.Tag
Expand Down Expand Up @@ -65,7 +70,9 @@ func (b *BigQueryDestination) Submit(events ...*eventkit.Event) {
})
}

err := b.client.SaveRecord(context.Background(), records)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
err = b.client.SaveRecord(ctx, records)
if err != nil {
fmt.Println("WARN: Couldn't save eventkit record to BQ: ", err)
}
Expand Down

0 comments on commit 6551794

Please sign in to comment.