Skip to content

Commit

Permalink
Prevent rows that are too large (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-soltesz authored Oct 22, 2024
1 parent ea71376 commit c5f7e36
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions parser/scamper1.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import (

const (
scamper1 = "scamper1"

// BigQuery rows must be under 100MB. Use 90MB to allow for JSON export.
// This is already an unusually large trace file.
maxRowSize = 90000000
)

// Scamper1Parser handles parsing for the scamper1 datatype.
Expand Down Expand Up @@ -99,6 +103,12 @@ func (p *Scamper1Parser) ParseAndInsert(meta etl.Metadata, testName string, rawC
metrics.WorkerState.WithLabelValues(p.TableName(), scamper1).Inc()
defer metrics.WorkerState.WithLabelValues(p.TableName(), scamper1).Dec()

// BigQuery rows must be under 100MB.
if len(rawContent) > maxRowSize {
metrics.TestTotal.WithLabelValues(p.TableName(), scamper1, "row too big").Inc()
return fmt.Errorf("row size too big")
}

trcParser, err := parser.New("mda")
if err != nil {
metrics.TestTotal.WithLabelValues(p.TableName(), scamper1, err.Error()).Inc()
Expand Down

0 comments on commit c5f7e36

Please sign in to comment.