analytics

package
v1.5.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 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 (
	// SubmitJobEventType is the event type for a job that has been submitted to an orchestrator.
	SubmitJobEventType = "bacalhau.job_v1.submit"
	// TerminalJobEventType is the event type for a job that has reached a terminal state.
	TerminalJobEventType = "bacalhau.job_v1.terminal"
)
View Source
const DefaultOtelCollectorEndpoint = "t.bacalhau.org:4317"
View Source
const ProviderKey = "bacalhau-analytics"

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 NewEvent

func NewEvent(eventType string, properties any) *Event

NewEvent creates a new Event.

func NewJobTerminalEvent

func NewJobTerminalEvent(j models.Job) *Event

func (*Event) ToLogRecord

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

ToLogRecord converts an Event to a LogRecord.

type EventType

type EventType string

type JobTerminalEvent

type JobTerminalEvent struct {
	ID            string `json:"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"`
	StateMessage  string `json:"state_message"`
	Version       uint64 `json:"version"`
	Revision      uint64 `json:"revision"`
	CreateTime    int64  `json:"create_time"`
	ModifyTime    int64  `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"`
	TaskCPUUnits         float64  `json:"task_cpu_units"`
	TaskMemoryBytes      uint64   `json:"task_memory_bytes"`
	TaskDiskBytes        uint64   `json:"task_disk_bytes"`
	TaskGPUCount         uint64   `json:"task_gpu_count"`
	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 SubmitJobEvent

type SubmitJobEvent struct {
	ID            string `json:"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    int64  `json:"create_time"`
	ModifyTime    int64  `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"`
	TaskCPUUnits         float64  `json:"task_cpu_units"`
	TaskMemoryBytes      uint64   `json:"task_memory_bytes"`
	TaskDiskBytes        uint64   `json:"task_disk_bytes"`
	TaskGPUCount         uint64   `json:"task_gpu_count"`
	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