Documentation
¶
Index ¶
- func FindOrCreateAuthenticatedUser(ctx context.Context, db database.Handle, ...) (*int64, error)
- func FindOrCreateInstanceName(ctx context.Context, db database.Handle, instanceName string) (int64, error)
- func FindOrCreateInvocation(ctx context.Context, db database.Handle, invocationUUID uuid.UUID, ...) (int64, error)
- func SaveSingleFile(ctx context.Context, tx database.Handle, instanceNameDbID int64, ...) (int64, error)
- type Batcher
- type BuildEventRecorder
- func NewBuildEventRecorder(ctx context.Context, db database.Client, publishAuthorizer auth.Authorizer, ...) (BuildEventRecorder, error)
- func NewMetricsBuildEventRecorder(buildEventRecorder BuildEventRecorder) BuildEventRecorder
- func NewMinDurationBuildEventRecorder(buildEventRecorder BuildEventRecorder, minDuration time.Duration) BuildEventRecorder
- type BuildEventWithInfo
- type DataExtractors
- type Factory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindOrCreateAuthenticatedUser ¶
func FindOrCreateAuthenticatedUser( ctx context.Context, db database.Handle, authMetadataExtractors *authmetadataextraction.AuthMetadataExtractors, authenticatedUsersGauge prometheus.Gauge, ) (*int64, error)
FindOrCreateAuthenticatedUser creates a user or returns its ID if it already exists.
func FindOrCreateInstanceName ¶
func FindOrCreateInstanceName( ctx context.Context, db database.Handle, instanceName string, ) (int64, error)
FindOrCreateInstanceName creates an instance name or returns its ID if it already exists.
func FindOrCreateInvocation ¶
func FindOrCreateInvocation( ctx context.Context, db database.Handle, invocationUUID uuid.UUID, instanceNameDbID int64, authenticatedUserDbID *int64, invocationsGaugeVec *prometheus.GaugeVec, ) (int64, error)
FindOrCreateInvocation creates an invocation or returns its ID if it already exists.
Types ¶
type Batcher ¶
type Batcher[T any] struct { // contains filtered or unexported fields }
Batcher is a utility that atomically accumulates items to be processed in a batch.
func (*Batcher[T]) Add ¶
func (b *Batcher[T]) Add(item T)
Add adds an item to the batch and signals that data is available to any consumer.
type BuildEventRecorder ¶
type BuildEventRecorder interface {
// StartLoggingConnectionMetadata starts a logging routine that will
// log that there is a connection alive and well for the specific
// invocation.
StartLoggingConnectionMetadata(ctx context.Context)
// SaveBatch saves a batch of build events to the storage layer.
SaveBatch(ctx context.Context, batch []BuildEventWithInfo) error
}
BuildEventRecorder performs the actual recording of build events for an invocation to the storage layer.
func NewBuildEventRecorder ¶
func NewBuildEventRecorder( ctx context.Context, db database.Client, publishAuthorizer auth.Authorizer, saveDataLevel *bb_portal.BuildEventStreamService_SaveDataLevel, tracerProvider trace.TracerProvider, instanceName string, invocationID string, dataExtractors *DataExtractors, buildKey string, batchRetryTimeout time.Duration, ) (BuildEventRecorder, error)
NewBuildEventRecorder creates a new BuildEventRecorder
func NewMetricsBuildEventRecorder ¶
func NewMetricsBuildEventRecorder(buildEventRecorder BuildEventRecorder) BuildEventRecorder
NewMetricsBuildEventRecorder decorates a BuildEventRecorder with prometheus metrics.
func NewMinDurationBuildEventRecorder ¶
func NewMinDurationBuildEventRecorder(buildEventRecorder BuildEventRecorder, minDuration time.Duration) BuildEventRecorder
NewMinDurationBuildEventRecorder decorates a BuildEventRecorder so that it processes a batch for atleast as long as configured. This prevents small batches from consuming an undue amount of resources.
type BuildEventWithInfo ¶
type BuildEventWithInfo struct {
Event *bes.BuildEvent
// Sequence number is int64 by spec, however it is also starting at
// 1 and incrementing by 1 for each event by spec. We therefore
// assume we can fit the SequenceNumber in an uint32 and in case we
// can not we will refuse to process the event.
SequenceNumber uint32
}
BuildEventWithInfo couples a build event with additional metadata required for processing.
type DataExtractors ¶
type DataExtractors struct {
AuthMetadataExtractors *authmetadataextraction.AuthMetadataExtractors
InvocationMetadataExtractor *jmespath.Expression
}
DataExtractors are used to extract specific data from a invocation in different ways.
Source Files
¶
- batcher.go
- besfileutils.go
- build_event_recorder.go
- handled_events.go
- metrics_build_event_recorder.go
- min_duration_build_event_recorder.go
- saveActionExecuted.go
- saveBuildFinished.go
- saveBuildMetadata.go
- saveBuildMetrics.go
- saveBuildToolLogs.go
- saveFetch.go
- saveStarted.go
- saveWorkspaceStatus.go
- save_batch.go
- save_configuration.go
- save_files.go
- save_options_parsed.go
- save_progress.go
- save_remaining_events.go
- save_structured_command_line.go
- save_target_completed.go
- save_target_configured.go
- save_test_result.go
- save_test_summary.go