Documentation
¶
Overview ¶
Package kbqpb is the bigquery proto API of karte.
These protos should implement the ValueSaver interface, which allows them to control the names of their fields.
The protos also control the schema of the BigQuery tables belonging to Karte. These protos are intentionally very simple. Karte uses flat BigQuery tables in order to make ad hoc SQL queries more ergonomic.
Index ¶
- Variables
- type Action
- func (*Action) Descriptor() ([]byte, []int)deprecated
- func (x *Action) GetActionType() string
- func (x *Action) GetAllowFail() string
- func (x *Action) GetAssetTag() string
- func (x *Action) GetBoard() string
- func (x *Action) GetBuildbucketId() string
- func (x *Action) GetClientName() string
- func (x *Action) GetClientVersion() string
- func (x *Action) GetCreateTime() *timestamppb.Timestamp
- func (x *Action) GetFailReason() string
- func (x *Action) GetHostname() string
- func (x *Action) GetKind() string
- func (x *Action) GetModel() string
- func (x *Action) GetModificationCount() int32
- func (x *Action) GetName() string
- func (x *Action) GetPlanName() string
- func (x *Action) GetRecoveredBy() string
- func (x *Action) GetRestarts() int32
- func (x *Action) GetSealTime() *timestamppb.Timestamp
- func (x *Action) GetStartTime() *timestamppb.Timestamp
- func (x *Action) GetStatus() string
- func (x *Action) GetStopTime() *timestamppb.Timestamp
- func (x *Action) GetSwarmingTaskId() string
- func (x *Action) GetUpdateTime() *timestamppb.Timestamp
- func (*Action) ProtoMessage()
- func (x *Action) ProtoReflect() protoreflect.Message
- func (x *Action) Reset()
- func (a *Action) Save() (row map[string]bigquery.Value, insertID string, err error)
- func (x *Action) String() string
- type Observation
- func (*Observation) Descriptor() ([]byte, []int)deprecated
- func (x *Observation) GetActionName() string
- func (x *Observation) GetMetricKind() string
- func (x *Observation) GetName() string
- func (x *Observation) GetType() string
- func (x *Observation) GetValueNumber() float64
- func (x *Observation) GetValueString() string
- func (*Observation) ProtoMessage()
- func (x *Observation) ProtoReflect() protoreflect.Message
- func (x *Observation) Reset()
- func (o *Observation) Save() (map[string]bigquery.Value, string, error)
- func (x *Observation) String() string
Constants ¶
This section is empty.
Variables ¶
var File_go_chromium_org_infra_cros_karte_api_bigquery_action_proto protoreflect.FileDescriptor
var File_go_chromium_org_infra_cros_karte_api_bigquery_observation_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // The resource name of the action. Names are generated // automatically when a new action is created. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // A kind is a coarse-grained type of an action, such as // ssh-attempt. New action_kinds will be created frequently so this field // is a string; see https://google.aip.dev/126 for details. Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` // A swarming task ID is the ID of a single swarming task. // The swarming task of an action is the swarming task that invoked the // action. // For example, "4f6c0ba2ef3fc610" is a swarming task ID. SwarmingTaskId string `protobuf:"bytes,3,opt,name=swarming_task_id,json=swarmingTaskId,proto3" json:"swarming_task_id,omitempty"` // An asset tag is the tag of a given asset in UFS. // An asset tag may be a short number such as C444444 printed on a device, // or it may be a UUID in some circumstances. AssetTag string `protobuf:"bytes,4,opt,name=asset_tag,json=assetTag,proto3" json:"asset_tag,omitempty"` // The start time is the time that an action started. StartTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` // The stop time is the time that an action finished. StopTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=stop_time,json=stopTime,proto3" json:"stop_time,omitempty"` // The create time is the time that an action was created by Karte. // This is the time that the event was first received, since events are // immutable outside of rare cases. // This field is managed by Karte itself. CreateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // The status of an action is whether the action succeeded or failed. Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"` // The fail reason of an event is a diagnostic message that is emitted when // the action in question has failed. FailReason string `protobuf:"bytes,9,opt,name=fail_reason,json=failReason,proto3" json:"fail_reason,omitempty"` // The seal time is when the particular Karte record is sealed and no further changes can be made. SealTime *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=seal_time,json=sealTime,proto3" json:"seal_time,omitempty"` // This is the last time that the particular Karte record was updated on the Karte side. UpdateTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` // The client name is the name of the entity creating the Action entry, e.g. "paris". ClientName string `protobuf:"bytes,12,opt,name=client_name,json=clientName,proto3" json:"client_name,omitempty"` // The client version is the version of the entity creating the Action entry, e.g. "0.0.1". ClientVersion string `protobuf:"bytes,13,opt,name=client_version,json=clientVersion,proto3" json:"client_version,omitempty"` // The buildbucket ID is the ID of the buildbucket build associated with the event in question. BuildbucketId string `protobuf:"bytes,14,opt,name=buildbucket_id,json=buildbucketId,proto3" json:"buildbucket_id,omitempty"` // The hostname is the hostname of the DUT in question. Hostname string `protobuf:"bytes,15,opt,name=hostname,proto3" json:"hostname,omitempty"` // model is the model of the DUT this event applies to. Model string `protobuf:"bytes,16,opt,name=model,proto3" json:"model,omitempty"` // board is the board of the DUT this event applies to. Board string `protobuf:"bytes,17,opt,name=board,proto3" json:"board,omitempty"` // The modification count is the number of times that the record has been updated. // A complete action should be written to twice: once when it was created and once when it completed. ModificationCount int32 `protobuf:"varint,18,opt,name=modification_count,json=modificationCount,proto3" json:"modification_count,omitempty"` // recovered by is the name of the task that recovered the current action, if one exists. RecoveredBy string `protobuf:"bytes,19,opt,name=recovered_by,json=recoveredBy,proto3" json:"recovered_by,omitempty"` // restarts is the number of times that the current plan was restarted. Restarts int32 `protobuf:"varint,20,opt,name=restarts,proto3" json:"restarts,omitempty"` // plan_name is the name of the plan that we're currently executing. PlanName string `protobuf:"bytes,21,opt,name=plan_name,json=planName,proto3" json:"plan_name,omitempty"` // allow_fail captures whether the action is allowed to fail or not. AllowFail string `protobuf:"bytes,22,opt,name=allow_fail,json=allowFail,proto3" json:"allow_fail,omitempty"` // Action type is the type of action "ACTION_TYPE_" + {"UNSPECIFIED", "VERIFIER", "CONDITION", "RECOVERY"}. ActionType string `protobuf:"bytes,23,opt,name=action_type,json=actionType,proto3" json:"action_type,omitempty"` // contains filtered or unexported fields }
Action is the type a chromeos.karte.action that has been exported to BigQuery.
func (*Action) Descriptor
deprecated
func (*Action) GetActionType ¶
func (*Action) GetAllowFail ¶
func (*Action) GetAssetTag ¶
func (*Action) GetBuildbucketId ¶
func (*Action) GetClientName ¶
func (*Action) GetClientVersion ¶
func (*Action) GetCreateTime ¶
func (x *Action) GetCreateTime() *timestamppb.Timestamp
func (*Action) GetFailReason ¶
func (*Action) GetHostname ¶
func (*Action) GetModificationCount ¶
func (*Action) GetPlanName ¶
func (*Action) GetRecoveredBy ¶
func (*Action) GetRestarts ¶
func (*Action) GetSealTime ¶
func (x *Action) GetSealTime() *timestamppb.Timestamp
func (*Action) GetStartTime ¶
func (x *Action) GetStartTime() *timestamppb.Timestamp
func (*Action) GetStopTime ¶
func (x *Action) GetStopTime() *timestamppb.Timestamp
func (*Action) GetSwarmingTaskId ¶
func (*Action) GetUpdateTime ¶
func (x *Action) GetUpdateTime() *timestamppb.Timestamp
func (*Action) ProtoMessage ¶
func (*Action) ProtoMessage()
func (*Action) ProtoReflect ¶
func (x *Action) ProtoReflect() protoreflect.Message
func (*Action) Save ¶
Save takes in an action and produces a record to be inserted into bigquery and an insertID used for best-effort deduplication (which Karte) doesn't use. Why do we need this? Without the value-saver interface, we try to insert rows with fields that use the wrong casing convention `CreateTime` vs `create_time`. A sample error is shown below.
"persist to bigquery failed: rpc error: code = Aborted desc = error persisting single record: ... Message: \"no such field: CreateTime.\"; ...
type Observation ¶
type Observation struct { // The resource name of the observation. Names are generated // automatically when a new observation is created. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // A reference to a Karte action. ActionName string `protobuf:"bytes,2,opt,name=action_name,json=actionName,proto3" json:"action_name,omitempty"` // The metric kind records what measurement is being performed, e.g. // "battery_level" or "disk_usage" MetricKind string `protobuf:"bytes,3,opt,name=metric_kind,json=metricKind,proto3" json:"metric_kind,omitempty"` // Type is "num" if the type is numeric. Type is "string" otherwise. Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` // The string value of an observation. ValueString string `protobuf:"bytes,5,opt,name=value_string,json=valueString,proto3" json:"value_string,omitempty"` // The numeric value of a observation. ValueNumber float64 `protobuf:"fixed64,6,opt,name=value_number,json=valueNumber,proto3" json:"value_number,omitempty"` // contains filtered or unexported fields }
An observation represents a single concrete measurement. Examples include running a command on a DUT or resetting the servo attached to a DUT.
Examples:
battery_level:70 - battery level on device is 70% rrd:present - rrd metric is present on device disk_usage:35 - 35% internal storage used
func (*Observation) Descriptor
deprecated
func (*Observation) Descriptor() ([]byte, []int)
Deprecated: Use Observation.ProtoReflect.Descriptor instead.
func (*Observation) GetActionName ¶
func (x *Observation) GetActionName() string
func (*Observation) GetMetricKind ¶
func (x *Observation) GetMetricKind() string
func (*Observation) GetName ¶
func (x *Observation) GetName() string
func (*Observation) GetType ¶
func (x *Observation) GetType() string
func (*Observation) GetValueNumber ¶
func (x *Observation) GetValueNumber() float64
func (*Observation) GetValueString ¶
func (x *Observation) GetValueString() string
func (*Observation) ProtoMessage ¶
func (*Observation) ProtoMessage()
func (*Observation) ProtoReflect ¶
func (x *Observation) ProtoReflect() protoreflect.Message
func (*Observation) Reset ¶
func (x *Observation) Reset()
func (*Observation) Save ¶
Save populates a row, which is a string that points to interface{}'s and produces an insertID, which is, in this case, a no-op.
func (*Observation) String ¶
func (x *Observation) String() string