googlecloudcommon_contract

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormBasePriority is the base priority for Google Cloud common forms.
	FormBasePriority = 100000
	// PriorityForQueryTimeGroup is the priority for the query time group.
	PriorityForQueryTimeGroup = FormBasePriority + 50000
	// PriorityForResourceIdentifierGroup is the priority for the resource identifier group.
	PriorityForResourceIdentifierGroup = FormBasePriority + 40000
	// PriorityForK8sResourceFilterGroup is the priority for the k8s resource filter group.
	PriorityForK8sResourceFilterGroup = FormBasePriority + 30000
)
View Source
const (
	// InspectionTypeLabelKeyProduct is the label key for the Google Cloud product name running on the cluster.
	// Expected values of this label key: "composer", etc.
	InspectionTypeLabelKeyProduct = "cloud.google.com/product"

	// InspectionTypeLabelKeyClusterType is the label key for the cluster type.
	// Expected values of this label key: "gke", "gdc", "gke_multicloud", etc.
	InspectionTypeLabelKeyClusterType = "cloud.google.com/cluster_type"

	// InspectionTypeLabelKeyClusterSubType is the label key for the cluster sub type.
	// Expected values of this label key: "aws", "azure", etc.
	InspectionTypeLabelKeyClusterSubType = "cloud.google.com/cluster_subtype"
)

Variables

View Source
var (
	RevisionStateOperationStarted = style.MustRegisterRevisionState(
		"Processing operation",
		"change_circle",
		"The GCP API long-running operation is currently in progress.",
		style.Color{R: 0.012, G: 0.671, B: 0.012, A: 1.0},
		pb.RevisionStateStyle_REVISION_STATE_STYLE_NORMAL,
	)
	RevisionStateOperationSucceed = style.MustRegisterRevisionState(
		"Operation succeeded",
		"check_circle",
		"The GCP API long-running operation has completed successfully.",
		style.Color{R: 0.812, G: 0.812, B: 0.812, A: 1.0},
		pb.RevisionStateStyle_REVISION_STATE_STYLE_DELETED,
	)
	RevisionStateOperationFailed = style.MustRegisterRevisionState(
		"Operation failed",
		"error",
		"The GCP API long-running operation has failed.",
		style.Color{R: 1.000, G: 0.000, B: 0.000, A: 1.0},
		pb.RevisionStateStyle_REVISION_STATE_STYLE_DELETED,
	)
	RevisionStateOperationStartedLogNotFound = style.MustRegisterRevisionState(
		"Operation started, but starting log not found",
		"unknown_document",
		"The operation was started, but the starting log entry was not found in the selected time range. Try adjusting the time range.",
		style.Color{R: 0.012, G: 0.671, B: 0.012, A: 1.0},
		pb.RevisionStateStyle_REVISION_STATE_STYLE_PARTIAL_INFO,
	)
)

The following block defines the registered timeline style RevisionStates. These are registered as package-level variables so they are initialized immediately when this package is imported.

View Source
var (
	TimelineTypeGKE = style.MustRegisterTimelineType(
		"gke",
		"Control plane operations and lifecycle logs of the GKE cluster",
		"cloud",
		1.0,
		style.Color{R: 0.780, G: 0.863, B: 1.000, A: 1.0},
		style.ColorBlack,
		style.Color{R: 0.780, G: 0.863, B: 1.000, A: 1.0},
		style.ColorBlack,
		true,
		40,
		style.AlphabeticalSortPolicy(),
	)
	// TimelineTypeGKEControlPlanes is the timeline style for a GKE control planes folder.
	TimelineTypeGKEControlPlanes = style.MustRegisterTimelineType(
		"controlplanes",
		"Control Plane",
		"category",
		0.6,
		style.Color{R: 0.361, G: 0.604, B: 1.000, A: 1.0},
		style.ColorWhite,
		style.Color{R: 0.361, G: 0.604, B: 1.000, A: 1.0},
		style.ColorWhite,
		false,
		3002,
		style.AlphabeticalSortPolicy(),
	)
	// TimelineTypeGKENodePools is the timeline style for a GKE node pools folder.
	TimelineTypeGKENodePools = style.MustRegisterTimelineType(
		"nodepools",
		"Node Pools",
		"dns",
		0.6,
		style.Color{R: 0.361, G: 0.604, B: 1.000, A: 1.0},
		style.ColorWhite,
		style.Color{R: 0.361, G: 0.604, B: 1.000, A: 1.0},
		style.ColorWhite,
		false,
		3001,
		style.AlphabeticalSortPolicy(),
	)
	// TimelineTypeOtherGKEResources is the timeline style for other GKE resources.
	TimelineTypeOtherGKEResources = style.MustRegisterTimelineType(
		"other_gke_resources",
		"Other GKE Resources",
		"category",
		0.6,
		style.Color{R: 0.361, G: 0.604, B: 1.000, A: 1.0},
		style.ColorWhite,
		style.Color{R: 0.361, G: 0.604, B: 1.000, A: 1.0},
		style.ColorWhite,
		false,
		3003,
		style.AlphabeticalSortPolicy(),
	)
	// TimelineTypeGKENodePool is the style for a GKE node pool.
	TimelineTypeGKENodePool = style.MustRegisterTimelineType(
		"nodepool",
		"Grouping timeline for GKE nodepools",
		"dns",
		0.8,
		style.Color{R: 0.941, G: 0.965, B: 1.000, A: 1.0},
		style.ColorBlack,
		style.Color{R: 0.941, G: 0.965, B: 1.000, A: 1.0},
		style.ColorBlack,
		true,
		45,
		style.AlphabeticalSortPolicy(),
	)
	TimelineTypeOperation = style.MustRegisterTimelineType(
		"operation",
		"Google Cloud operations associated with the resource",
		"engineering",
		0.6,
		style.ColorWhite,
		style.ColorBlack,
		style.ColorBlack,
		style.ColorWhite,
		true,
		3000,
		style.ChronologicalSortPolicy(0),
	)
	TimelineTypeGCPProject = style.MustRegisterTimelineType(
		"project",
		"Timeline representing a Google Cloud project",
		"cloud",
		1.0,
		style.Color{R: 0.102, G: 0.451, B: 0.910, A: 1.0},
		style.ColorWhite,
		style.Color{R: 0.102, G: 0.451, B: 0.910, A: 1.0},
		style.ColorWhite,
		true,
		30,
		style.AlphabeticalSortPolicy(),
	)
	TimelineTypeGCPResourceType = style.MustRegisterTimelineType(
		"gcp_resource_type",
		"Grouping timeline for Google Cloud resource types",
		"category",
		0.6,
		style.ColorWhite,
		style.ColorBlack,
		style.MustForceConvertSRGBHex("#34A853"),
		style.ColorWhite,
		true,
		31,
		style.AlphabeticalSortPolicy(),
	)
	TimelineTypeGCPResource = style.MustRegisterTimelineType(
		"gcp_resource",
		"Timeline representing a Google Cloud resource",
		"deployed_code",
		0.6,
		style.ColorWhite,
		style.ColorBlack,
		style.MustForceConvertSRGBHex("#FBBC05"),
		style.ColorBlack,
		true,
		32,
		style.AlphabeticalSortPolicy(),
	)
)

The following block defines the registered timeline style TimelineTypes. These are registered as package-level variables so they are initialized immediately when this package is imported.

View Source
var (
	VerbOperationStart  = style.MustRegisterVerb("Start", style.MustForceConvertSRGBHex("#22CC22"), style.ColorWhite, true)
	VerbOperationFinish = style.MustRegisterVerb("Finish", style.MustForceConvertSRGBHex("#9999CC"), style.ColorWhite, true)
)

The following block defines the registered timeline style Verbs. These are registered as package-level variables so they are initialized immediately when this package is imported.

View Source
var APICallOptionsInjectorContextKey = typedmap.NewTypedKey[*[]googlecloud.CallOptionInjectorOption]("api-call-option-injector-options")

APICallOptionsInjectorContextKey is the key to retrieve the list of googlecloud.CallOptionInjectorOption from task context. The value is injected on the task server during the initialization.

View Source
var APIClientCallOptionsInjectorTaskID = taskid.NewDefaultImplementationID[*googlecloud.CallOptionInjector](GoogleCloudCommonTaskIDPrefix + "api-client-option-injector")

APIClientCallOptionsInjectorTaskID is the task ID to inject CallOptionInjector reference.

View Source
var APIClientFactoryOptionsContextKey = typedmap.NewTypedKey[*[]googlecloud.ClientFactoryOption]("api-client-factory-options")

APIClientFactoryOptionsContextKey is the key to retrieve googlecloud.ClientFactoryOption from task context. The value is injected on the task server during the initialization.

View Source
var APIClientFactoryOptionsTaskID = taskid.NewDefaultImplementationID[[]googlecloud.ClientFactoryOption](GoogleCloudCommonTaskIDPrefix + "api-client-factory-options")

APIClientFactoryOptionsTaskID is the task ID to generate options list for the ClientFactory. This can be overridden with the selection priority label defined in the coretask package.

APIClientFactoryTaskID is the task ID to generate the ClientFactory. This factory is instantiated with the options generated from the task with APIClientFactoryOptionsTaskID.

AutocompleteLocationTaskID is the task ID for the location autocomplete.

View Source
var DefaultAPIClientOptionTasksPriority = 1000

DefaultAPIClientOptionTasksPriority is the selection priority of the default implementation for APIClientFactoryOptionsTaskID and APICallOptionsInjectorTask. Users can define another task for the task ID with higher priority to override the options.

View Source
var GoogleCloudCommonTaskIDPrefix = "cloud.google.com/common/"

GoogleCloudCommonTaskIDPrefix is the prefix for Google Cloud common task IDs.

InputDurationTaskID is the task ID for the duration of the log query.

InputEndTimeTaskID is the task ID for the end time of the log query.

View Source
var InputLocationsTaskID = taskid.NewDefaultImplementationID[string](GoogleCloudCommonTaskIDPrefix + "input-location")

InputLocationsTaskID is the task ID for the locations of the target resource.

View Source
var InputLoggingFilterResourceNameTaskID = taskid.NewDefaultImplementationID[*ResourceNamesInput](GoogleCloudCommonTaskIDPrefix + "input-logging-filter-resource-name")

InputLoggingFilterResourceNameTaskID is the task ID to get log query target resource names.

View Source
var InputProjectIdTaskID = taskid.NewDefaultImplementationID[string](GoogleCloudCommonTaskIDPrefix + "input-project-id")

InputProjectIdTaskID is the task ID for the Google Cloud project ID.

View Source
var InputStartTimeTaskID = taskid.NewDefaultImplementationID[time.Time](GoogleCloudCommonTaskIDPrefix + "input-start-time")

InputStartTimeTaskID is the task ID for the start time of the log query. This is computed from InputDurationTask and InputEndTimeTask.

LocationFetcherTaskID is the task ID to inject the instance of LocationFetcher.

LoggingFetcherTaskID is the task ID to inject the instance of LogFetcher.

View Source
var RequestOptionalInputResourceNameTaskLabel = typedmap.NewTypedKey[string]("request-optional-input-resource-name")

RequestOptionalInputResourceNameTaskLabel is a label assigned to a task that requests the Cloud Logging resource name optionally. The value is the query ID.

Functions

func MustGCPOperationTimeline added in v0.56.0

func MustGCPOperationTimeline(ctx context.Context, parentTimeline *khifilev6.TimelinePath, shortMethodName string, operationID string) *khifilev6.TimelinePath

MustGCPOperationTimeline returns the timeline path for a GCP long running operation. The operation timeline is nested under its associated GKE or GCP resource timeline path.

func MustGCPProjectTimeline added in v0.56.0

func MustGCPProjectTimeline(ctx context.Context, projectID string) *khifilev6.TimelinePath

MustGCPProjectTimeline returns the timeline path for a Google Cloud Project root timeline.

func MustGCPResourceTimeline added in v0.56.0

func MustGCPResourceTimeline(ctx context.Context, resourceTypePath *khifilev6.TimelinePath, resourceName string) *khifilev6.TimelinePath

MustGCPResourceTimeline returns the timeline path for a GCP resource under a resource type.

func MustGCPResourceTypeTimeline added in v0.56.0

func MustGCPResourceTypeTimeline(ctx context.Context, projectPath *khifilev6.TimelinePath, resourceType string) *khifilev6.TimelinePath

MustGCPResourceTypeTimeline returns the timeline path for a GCP resource type layer under a GCP Project.

func MustGKEClusterTimeline added in v0.56.0

func MustGKEClusterTimeline(ctx context.Context, projectPath *khifilev6.TimelinePath, clusterName string) *khifilev6.TimelinePath

MustGKEClusterTimeline returns the timeline path for a GKE Cluster under a GCP Project.

func MustGKENodePoolTimeline added in v0.56.0

func MustGKENodePoolTimeline(ctx context.Context, gkeClusterTimeline *khifilev6.TimelinePath, nodePoolName string) *khifilev6.TimelinePath

MustGKENodePoolTimeline returns the timeline path for a GKE NodePool under a GKE Cluster.

func NewGCPOperationLogIngester added in v0.56.1

func NewGCPOperationLogIngester(rawLogTask taskid.TaskReference[[]*log.Log], logType *pb.LogType) inspectiontaskbase.LogIngester

NewGCPOperationLogIngester creates a new GCPOperationLogIngester.

func NewGCPOperationLogIngesterTask added in v0.56.1

func NewGCPOperationLogIngesterTask(taskID taskid.TaskImplementationID[[]*log.Log], rawLogTask taskid.TaskReference[[]*log.Log], logType *pb.LogType) coretask.Task[[]*log.Log]

NewGCPOperationLogIngesterTask returns a new log ingester task for GCP Operation audit logs.

func NewListLogEntriesTask

func NewListLogEntriesTask(taskSetting ListLogEntriesTaskSetting) coretask.Task[[]*log.Log]

NewListLogEntriesTask creates a new task that lists log entries from Cloud Logging based on the provided settings.

func ParseGCPSeverity added in v0.56.0

func ParseGCPSeverity(gcpSeverity string) *pb.Severity

ParseGCPSeverity converts a GCP Cloud Logging severity string into a timeline style Severity. It maps the GCP log severities defined in https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity to KHI's registered timeline style Severities in the core contract.

func ProcessGCPClusterNodepoolOperationLog added in v0.56.2

func ProcessGCPClusterNodepoolOperationLog(
	ctx context.Context,
	cs *khifilev6.TimelineChangeSet,
	tracker *GCPOperationTracker,
	targetTimeline *khifilev6.TimelinePath,
	operationTimeline *khifilev6.TimelinePath,
	audit *GCPAuditLogFieldSet,
	common *log.CommonFieldSet,
	shortMethodName string,
	isCluster bool,
)

ProcessGCPClusterNodepoolOperationLog processes a GCP operation log for a cluster or node pool resource timeline. It generates resource creation/deletion/enrollment/unenrollment revisions, handles missing start logs by prepending appropriate LogNotFound revisions at Unix time 0, and updates operation tracking.

Types

type GCPAccessLogFieldSet

type GCPAccessLogFieldSet struct {
	Method       string
	RequestURL   string
	RequestSize  int64
	Status       int
	ResponseSize int64
	UserAgent    string
	RemoteIP     string
	ServerIP     string
	Referer      string
	Latency      string
	Protocol     string
}

func (*GCPAccessLogFieldSet) Kind

func (g *GCPAccessLogFieldSet) Kind() string

Kind implements log.FieldSet.

type GCPAccessLogFieldSetReader

type GCPAccessLogFieldSetReader struct {
}

func (*GCPAccessLogFieldSetReader) FieldSetKind

func (g *GCPAccessLogFieldSetReader) FieldSetKind() string

FieldSetKind implements log.FieldSetReader.

func (*GCPAccessLogFieldSetReader) Read

Read implements log.FieldSetReader.

type GCPAuditLogFieldSet

type GCPAuditLogFieldSet struct {
	ProjectID      string
	OperationID    string
	OperationFirst bool
	OperationLast  bool
	MethodName     string
	ResourceName   string
	PrincipalEmail string
	Status         int
	StatusMessage  string
	Request        *structured.NodeReader
	Response       *structured.NodeReader
}

func (*GCPAuditLogFieldSet) Ending

func (g *GCPAuditLogFieldSet) Ending() bool

Ending returns true when the operation is long running operation and the log entry is for the ending timing.

func (*GCPAuditLogFieldSet) GuessRevisionVerb added in v0.54.0

func (g *GCPAuditLogFieldSet) GuessRevisionVerb() *pb.Verb

GuessRevisionVerb returns the guessed revision verb from the method name.

func (*GCPAuditLogFieldSet) ImmediateOperation

func (g *GCPAuditLogFieldSet) ImmediateOperation() bool

ImmediateOperation returns true when the log represents an operation completes immediately.

func (*GCPAuditLogFieldSet) Kind

func (g *GCPAuditLogFieldSet) Kind() string

Kind implements log.FieldSet.

func (*GCPAuditLogFieldSet) RequestString

func (g *GCPAuditLogFieldSet) RequestString() (string, error)

RequestString returns the request body as a YAML string.

func (*GCPAuditLogFieldSet) ResponseString

func (g *GCPAuditLogFieldSet) ResponseString() (string, error)

ResponseString returns the response body as a YAML string.

func (*GCPAuditLogFieldSet) Starting

func (g *GCPAuditLogFieldSet) Starting() bool

Starting returns true when the operation is long running operation and the log entry is for the starting timing.

type GCPDefaultSeverityFieldSetReader added in v0.56.0

type GCPDefaultSeverityFieldSetReader struct {
}

GCPDefaultSeverityFieldSetReader reads and parses the severity field from a GCP Cloud Logging entry.

func (*GCPDefaultSeverityFieldSetReader) FieldSetKind added in v0.56.0

func (g *GCPDefaultSeverityFieldSetReader) FieldSetKind() string

FieldSetKind implements log.FieldSetReader.

func (*GCPDefaultSeverityFieldSetReader) Read added in v0.56.0

Read implements log.FieldSetReader.

type GCPMainMessageFieldSet added in v0.56.0

type GCPMainMessageFieldSet struct {
	MainMessage string
}

func (*GCPMainMessageFieldSet) Kind added in v0.56.0

func (d *GCPMainMessageFieldSet) Kind() string

Kind implements FieldSet.

type GCPMainMessageFieldSetReader added in v0.56.0

type GCPMainMessageFieldSetReader struct{}

GCPMainMessageFieldSetReader read its main message from the content of log stored on Cloud Logging. It treats fields as its main message in the order: `textPayload` > `jsonPayload.****` (**** would be `message`, `msg`...etc) > jsonPayload > labels

func (*GCPMainMessageFieldSetReader) FieldSetKind added in v0.56.0

func (g *GCPMainMessageFieldSetReader) FieldSetKind() string

func (*GCPMainMessageFieldSetReader) Read added in v0.56.0

type GCPOperationAuditLogFieldSetReader

type GCPOperationAuditLogFieldSetReader struct {
}

func (*GCPOperationAuditLogFieldSetReader) FieldSetKind

func (g *GCPOperationAuditLogFieldSetReader) FieldSetKind() string

FieldSetKind implements log.FieldSetReader.

func (*GCPOperationAuditLogFieldSetReader) Read

Read implements log.FieldSetReader.

type GCPOperationLogIngester added in v0.56.1

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

GCPOperationLogIngester is a common LogIngester implementation for GCP Operation audit logs.

func (*GCPOperationLogIngester) Dependencies added in v0.56.1

Dependencies returns additional task dependencies of the ingester.

func (*GCPOperationLogIngester) ProcessLog added in v0.56.1

ProcessLog parses raw log entry and populates the LogChangeSet.

func (*GCPOperationLogIngester) RawLogTask added in v0.56.1

func (i *GCPOperationLogIngester) RawLogTask() taskid.TaskReference[[]*log.Log]

RawLogTask returns the task reference that provides the raw logs to ingest.

type GCPOperationTracker added in v0.56.1

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

GCPOperationTracker tracks operation start/finish logs within a group and generates revisions.

func NewGCPOperationTracker added in v0.56.1

func NewGCPOperationTracker() *GCPOperationTracker

NewGCPOperationTracker creates a new GCPOperationTracker.

func (*GCPOperationTracker) HasResourceRevision added in v0.56.2

func (t *GCPOperationTracker) HasResourceRevision(path *khifilev6.TimelinePath) bool

HasResourceRevision returns true if any revision has been added to the given resource timeline path.

func (*GCPOperationTracker) HasStarted added in v0.56.2

func (t *GCPOperationTracker) HasStarted(operationID string) bool

HasStarted returns true if the operation start log for the given operation ID was observed.

func (*GCPOperationTracker) MarkResourceRevision added in v0.56.2

func (t *GCPOperationTracker) MarkResourceRevision(path *khifilev6.TimelinePath)

MarkResourceRevision records that a revision was added to the given resource timeline path.

func (*GCPOperationTracker) ProcessOperationLog added in v0.56.1

func (t *GCPOperationTracker) ProcessOperationLog(ctx context.Context, cs *khifilev6.TimelineChangeSet, targetPath *khifilev6.TimelinePath, audit *GCPAuditLogFieldSet, timestamp time.Time)

ProcessOperationLog adds necessary operation revisions or events to the TimelineChangeSet. If an ending log is encountered without a prior starting log, it automatically prepends a dummy starting revision with RevisionStateOperationStartedLogNotFound at Unix time 0.

func (*GCPOperationTracker) TrackAndGetManifest added in v0.56.1

func (t *GCPOperationTracker) TrackAndGetManifest(audit *GCPAuditLogFieldSet) (string, bool)

TrackAndGetManifest tracks the latest resource manifest from an audit log and returns it if updated.

type ListLogEntriesTaskDescription

type ListLogEntriesTaskDescription struct {
	QueryName    string
	ExampleQuery string
}

ListLogEntriesTaskDescription holds descriptive information for a task to list log entries from CloudLogging.

type ListLogEntriesTaskSetting

type ListLogEntriesTaskSetting interface {
	// TaskID returns the task ID for the Cloud Logging list log entries task.
	TaskID() taskid.TaskImplementationID[[]*log.Log]

	// Dependencies returns the list of dependencies for the Cloud Logging list log entries task.
	// Return the dependency task reference IDs when the result is used in DefaultResourceNames(), LogFilters() or TimePartitionCount().
	Dependencies() []taskid.UntypedTaskReference

	// DefaultResourceNames returns the list of resource names for the Cloud Logging list log entries task.
	// This is just a default value for the resource name. Users can override this value with the form field.
	// Return the list of resource names. ref: https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/list
	DefaultResourceNames(ctx context.Context) ([]string, error)

	// LogFilters returns the list of log filters for the Cloud Logging list log entries task.
	// When generated logging filter can exceed the 20,000 character maximum limit in Cloud Logging, return multiple subset query.
	// Result includes the logs for all log filters.
	LogFilters(ctx context.Context, taskMode inspectioncore_contract.InspectionTaskModeType) ([]string, error)

	// TimePartitionCount returns the number of time partitions for the Cloud Logging list log entries task.
	// ListLogEntriesTask split the duration into the number of partition count to gather logs in parallel.
	// Return 1 - 16 values depending on the expected log volume by the log filter.
	TimePartitionCount(ctx context.Context) (int, error)

	// Description returns the description for the Cloud Logging filter task.
	Description() *ListLogEntriesTaskDescription
}

ListLogEntriesTaskSetting defines the settings for a Cloud Logging list log entries task.

type LocationFetcher

type LocationFetcher interface {
	FetchRegions(ctx context.Context, projectId string) ([]string, error)
}

func NewLocationFetcher

func NewLocationFetcher(client *compute.RegionsClient, callOptionInjector *googlecloud.CallOptionInjector) LocationFetcher

type LogFetchProgress

type LogFetchProgress struct {
	// LogCount is the total number of logs fetched so far.
	LogCount int
	// Progress indicates the completion status, ranging from 0.0 to 1.0.
	Progress float32
}

LogFetchProgress represents the progress of a log fetching operation.

type LogFetcher

type LogFetcher interface {
	FetchLogs(dest chan<- *loggingpb.LogEntry, ctx context.Context, filter string, container googlecloud.ResourceContainer, resourceContainers []string) error
}

LogFetcher is an interface for fetching logs from Cloud Logging with a given filter and sending them to a specified channel. The implementation must close the destination channel after the query is done.

func NewLogFetcher

func NewLogFetcher(clientFactory *googlecloud.ClientFactory, callOptionInjector *googlecloud.CallOptionInjector, pageSize int32) LogFetcher

NewLogFetcher returns the instance of LogFetcher initialized with the given *googlecloud.ClientFactory.

type ProgressReportableLogFetcher

type ProgressReportableLogFetcher interface {
	// FetchLogsWithProgress fetches logs while periodically reporting its progress through a separate channel.
	// Implementations must close both the dest and progress channels upon completion.
	FetchLogsWithProgress(dest chan<- *loggingpb.LogEntry, progress chan<- LogFetchProgress, ctx context.Context, beginTime, endTime time.Time, filterWithoutTimeRange string, container googlecloud.ResourceContainer, resourceContainers []string) error
}

type QueryResourceNames

type QueryResourceNames struct {
	QueryID              string
	DefaultResourceNames []string
	CurrentResourceNames []string
}

QueryResourceNames holds the resource names for a specific query.

func (*QueryResourceNames) GetInputID

func (q *QueryResourceNames) GetInputID() string

GetInputID returns the form input ID for the query.

type ResourceNamesInput

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

ResourceNamesInput is a container for resource names used in log queries.

func NewResourceNamesInput

func NewResourceNamesInput() *ResourceNamesInput

NewResourceNamesInput creates a new ResourceNamesInput.

func (*ResourceNamesInput) GetResourceNamesForQuery

func (r *ResourceNamesInput) GetResourceNamesForQuery(ctx context.Context, queryID string) *QueryResourceNames

GetResourceNamesForQuery returns the resource names for a given query ID.

func (*ResourceNamesInput) UpdateDefaultResourceNamesForQuery

func (r *ResourceNamesInput) UpdateDefaultResourceNamesForQuery(queryID string, defaultResourceNames []string)

UpdateDefaultResourceNamesForQuery updates the default resource names for a given query ID.

type StandardProgressReportableLogFetcher

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

StandardProgressReportableLogFetcher is a decorator for a LogFetcher that adds the ability to report the progress of log fetching.

func NewStandardProgressReportableLogFetcher

func NewStandardProgressReportableLogFetcher(fetcher LogFetcher, interval time.Duration) *StandardProgressReportableLogFetcher

NewProgressReportableLogFetcher creates a new instance of ProgressReportableLogFetcher.

func (*StandardProgressReportableLogFetcher) FetchLogsWithProgress

func (s *StandardProgressReportableLogFetcher) FetchLogsWithProgress(dest chan<- *loggingpb.LogEntry, progress chan<- LogFetchProgress, ctx context.Context, beginTime, endTime time.Time, filterWithoutTimeRange string, container googlecloud.ResourceContainer, resourceContainers []string) error

FetchLogsWithProgress implements FetchLogsWithProgress.

type TimePartitioningProgressReportableLogFetcher

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

func NewTimePartitioningProgressReportableLogFetcher

func NewTimePartitioningProgressReportableLogFetcher(fetcher LogFetcher, interval time.Duration, partitionCount int, maxParallelism int) *TimePartitioningProgressReportableLogFetcher

func (*TimePartitioningProgressReportableLogFetcher) FetchLogsWithProgress

func (t *TimePartitioningProgressReportableLogFetcher) FetchLogsWithProgress(logChan chan<- *loggingpb.LogEntry, progressChan chan<- LogFetchProgress, ctx context.Context, beginTime time.Time, endTime time.Time, filterWithoutTimeRange string, container googlecloud.ResourceContainer, resourceContainers []string) error

FetchLogsWithProgress implements ProgressReportableLogFetcher.

Jump to

Keyboard shortcuts

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