analytics

package
v1.5.0-dev15 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeInstallationIDKey = "installation_id"
	NodeInstanceIDKey     = "instance_id"
	NodeIDKey             = "node_id"
	NodeTypeKey           = "node_type"
	NodeVersionKey        = "node_version"
)
View Source
const ComputeMessageExecutionEventType = "bacalhau.execution_v1.compute_message"
View Source
const CreatedExecutionEventType = "bacalhau.execution_v1.create"
View Source
const DefaultOtelCollectorEndpoint = "t.bacalhau.org:4317"
View Source
const ProviderKey = "bacalhau-analytics"
View Source
const SubmitJobEventType = "bacalhau.job_v1.submit"

SubmitJobEventType is the event type for a job that has been submitted to an orchestrator.

View Source
const TerminalExecutionEventType = "bacalhau.execution_v1.terminal"
View Source
const TerminalJobEventType = "bacalhau.job_v1.terminal"

TerminalJobEventType is the event type for a job that has reached a terminal state.

Variables

This section is empty.

Functions

func EmitEvent

func EmitEvent(ctx context.Context, event *Event)

func SetupAnalyticsProvider

func SetupAnalyticsProvider(ctx context.Context, opts ...Option) error

func ShutdownAnalyticsProvider

func ShutdownAnalyticsProvider(ctx context.Context) error

Types

type Config

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

type Event

type Event struct {
	Type       string
	Properties any
}

func NewComputeMessageExecutionEvent

func NewComputeMessageExecutionEvent(e models.Execution) *Event

func NewCreatedExecutionEvent

func NewCreatedExecutionEvent(e models.Execution) *Event

func NewEvent

func NewEvent(eventType string, properties any) *Event

NewEvent creates a new Event.

func NewJobTerminalEvent

func NewJobTerminalEvent(j models.Job) *Event

func NewTerminalExecutionEvent

func NewTerminalExecutionEvent(e models.Execution) *Event

func (*Event) ToLogRecord

func (e *Event) ToLogRecord() (otellog.Record, error)

ToLogRecord converts an Event to a LogRecord.

type EventType

type EventType string

type ExecutionComputeMessage

type ExecutionComputeMessage struct {
	JobID            string `json:"job_id,omitempty"`
	ExecutionID      string `json:"execution_id,omitempty"`
	ComputeMessage   string `json:"compute_message,omitempty"`
	ComputeErrorCode string `json:"compute_state_error_code,omitempty"`
}

type ExecutionEvent

type ExecutionEvent struct {
	JobID       string `json:"job_id,omitempty"`
	ExecutionID string `json:"execution_id,omitempty"`
	EvalID      string `json:"evaluation_id,omitempty"`

	NameSet       bool   `json:"name_set,omitempty"`
	NodeNameHash  string `json:"node_name_hash,omitempty"`
	NamespaceHash string `json:"namespace_hash,omitempty"`

	Resources map[string]Resource `json:"resources,omitempty"`

	DesiredState          string `json:"desired_state,omitempty"`
	DesiredStateErrorCode string `json:"desired_state_error_code,omitempty"`

	ComputeState          string `json:"compute_state,omitempty"`
	ComputeStateErrorCode string `json:"compute_state_error_code,omitempty"`

	PublishedResultType string `json:"publisher_type,omitempty"`

	RunResultStdoutTruncated bool `json:"run_result_stdout_truncated,omitempty"`
	RunResultStderrTruncated bool `json:"run_result_stderr_truncated,omitempty"`
	RunResultExitCode        int  `json:"run_result_exit_code,omitempty"`

	PreviousExecution string `json:"previous_execution,omitempty"`
	NextExecution     string `json:"next_execution,omitempty"`
	FollowupEvalID    string `json:"followup_eval_id,omitempty"`

	Revision   uint64    `json:"revision,omitempty"`
	CreateTime time.Time `json:"create_time,omitempty"`
	ModifyTime time.Time `json:"modify_time,omitempty"`
}

type GPUInfo

type GPUInfo struct {
	Name   string `json:"name,omitempty"`
	Vendor string `json:"vendor,omitempty"`
}

type JobTerminalEvent

type JobTerminalEvent struct {
	JobID string `json:"job_id"`

	NameSet       bool   `json:"name_set"`
	NamespaceHash string `json:"namespace_hash"`

	Type        string `json:"type"`
	Count       int    `json:"count"`
	LabelsCount int    `json:"labels_count"`
	MetaCount   int    `json:"meta_count"`

	State string `json:"state"`

	Version    uint64    `json:"version"`
	Revision   uint64    `json:"revision"`
	CreateTime time.Time `json:"create_time"`
	ModifyTime time.Time `json:"modify_time"`

	TaskNameHash         string   `json:"task_name_hash"`
	TaskEngineType       string   `json:"task_engine_type"`
	TaskPublisherType    string   `json:"task_publisher_type"`
	TaskEnvVarCount      int      `json:"task_env_var_count"`
	TaskMetaCount        int      `json:"task_meta_count"`
	TaskInputSourceTypes []string `json:"task_input_source_types"`
	TaskResultPathCount  int      `json:"task_result_path_count"`

	Resources Resource `json:"resources,omitempty"`

	TaskNetworkType      string `json:"task_network_type"`
	TaskDomainsCount     int    `json:"task_domains_count"`
	TaskExecutionTimeout int64  `json:"task_execution_timeout"`
	TaskQueueTimeout     int64  `json:"task_queue_timeout"`
	TaskTotalTimeout     int64  `json:"task_total_timeout"`
}

type Option

type Option func(*Config)

func WithEndpoint

func WithEndpoint(endpoint string) Option

func WithInstallationID

func WithInstallationID(id string) Option

func WithInstanceID

func WithInstanceID(id string) Option

func WithNodeNodeID

func WithNodeNodeID(id string) Option

func WithNodeType

func WithNodeType(isRequester, isCompute bool) Option

func WithVersion

func WithVersion(bv *models.BuildVersionInfo) Option

type Resource

type Resource struct {
	CPUUnits    float64   `json:"cpu_units,omitempty"`
	MemoryBytes uint64    `json:"memory_bytes,omitempty"`
	DiskBytes   uint64    `json:"disk_bytes,omitempty"`
	GPUCount    uint64    `json:"gpu_count,omitempty"`
	GPUTypes    []GPUInfo `json:"gpu_types,omitempty"`
}

type SubmitJobEvent

type SubmitJobEvent struct {
	JobID string `json:"job_id"`

	NameSet       bool   `json:"name_set"`
	NamespaceHash string `json:"namespace_hash"`

	Type        string `json:"type"`
	Count       int    `json:"count"`
	LabelsCount int    `json:"labels_count"`
	MetaCount   int    `json:"meta_count"`

	Version    uint64    `json:"version"`
	Revision   uint64    `json:"revision"`
	CreateTime time.Time `json:"create_time"`
	ModifyTime time.Time `json:"modify_time"`

	TaskNameHash         string   `json:"task_name_hash"`
	TaskEngineType       string   `json:"task_engine_type"`
	TaskPublisherType    string   `json:"task_publisher_type"`
	TaskEnvVarCount      int      `json:"task_env_var_count"`
	TaskMetaCount        int      `json:"task_meta_count"`
	TaskInputSourceTypes []string `json:"task_input_source_types"`
	TaskResultPathCount  int      `json:"task_result_path_count"`

	Resources Resource `json:"resources,omitempty"`

	TaskNetworkType      string `json:"task_network_type"`
	TaskDomainsCount     int    `json:"task_domains_count"`
	TaskExecutionTimeout int64  `json:"task_execution_timeout"`
	TaskQueueTimeout     int64  `json:"task_queue_timeout"`
	TaskTotalTimeout     int64  `json:"task_total_timeout"`

	Warnings []string `json:"warnings"`
	Error    string   `json:"error"`
}

func NewSubmitJobEvent

func NewSubmitJobEvent(j models.Job, warnings ...string) SubmitJobEvent

Jump to

Keyboard shortcuts

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