bqexporter

package
v0.0.0-...-9eda336 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package bqexporter handles export to BigQuery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureViews

func EnsureViews(ctx context.Context) error

func ExportTestAnalyses

func ExportTestAnalyses(ctx context.Context) error

ExportTestAnalyses exports test failure analyses to BigQuery. A test failure analysis will be exported if it satisfies the following conditions:

  1. It has not been exported yet.
  2. It was created within the past 14 days.
  3. Has ended.
  4. If it found culprit, then actions must have been taken.

The limit of 14 days is chosen to save the query time. It is also because if the exporter is broken for some reasons, we will have 14 days to fix it.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides methods to export test analyses to BigQuery via the BigQuery Write API.

func NewClient

func NewClient(ctx context.Context, projectID string) (s *Client, reterr error)

NewClient creates a new client for exporting test analyses via the BigQuery Write API. projectID is the project ID of the GCP project.

func (*Client) Close

func (client *Client) Close() (reterr error)

Close releases resources held by the client.

func (*Client) EnsureSchema

func (client *Client) EnsureSchema(ctx context.Context) error

func (*Client) Insert

func (client *Client) Insert(ctx context.Context, rows []*bqpb.TestAnalysisRow) error

Insert inserts the given rows in BigQuery.

func (*Client) ReadTestFailureAnalysisRows

func (client *Client) ReadTestFailureAnalysisRows(ctx context.Context) ([]*TestFailureAnalysisRow, error)

ReadTestFailureAnalysisRows returns the Test Failure analysis rows in test_failure_analyses table that has created_time within the past 14 days.

type ExportClient

type ExportClient interface {
	EnsureSchema(ctx context.Context) error
	Insert(ctx context.Context, rows []*bqpb.TestAnalysisRow) error
	ReadTestFailureAnalysisRows(ctx context.Context) ([]*TestFailureAnalysisRow, error)
}

type TestFailureAnalysisRow

type TestFailureAnalysisRow struct {
	// We only need analysis ID for now.
	AnalysisID int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL