observability

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package observability provides public interfaces for component observability. External Go modules can implement these interfaces to provide custom logging adapters while the Observer handles authentication, authorization, and HTTP request handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentApplicationLogsParams

type ComponentApplicationLogsParams struct {
	ComponentID   string    `json:"componentId"`
	EnvironmentID string    `json:"environmentId"`
	ProjectID     string    `json:"projectId"`
	Namespace     string    `json:"namespace"`
	StartTime     time.Time `json:"startTime"`
	EndTime       time.Time `json:"endTime"`
	SearchPhrase  string    `json:"searchPhrase"`
	LogLevels     []string  `json:"logLevels"`
	Versions      []string  `json:"versions"`
	VersionIDs    []string  `json:"versionIds"`
	Limit         int       `json:"limit"`
	SortOrder     string    `json:"sortOrder"`
}

ComponentApplicationLogsParams holds parameters for component application log queries

type ComponentApplicationLogsResult

type ComponentApplicationLogsResult struct {
	Logs       []LogEntry `json:"logs"`
	TotalCount int        `json:"totalCount"`
	Took       int        `json:"took"`
}

ComponentApplicationLogsResult represents the result of a component log query

type ComponentEventsParams added in v1.2.0

type ComponentEventsParams struct {
	ComponentID   string    `json:"componentId"`
	EnvironmentID string    `json:"environmentId"`
	ProjectID     string    `json:"projectId"`
	Namespace     string    `json:"namespace"`
	StartTime     time.Time `json:"startTime"`
	EndTime       time.Time `json:"endTime"`
	Limit         int       `json:"limit"`
	SortOrder     string    `json:"sortOrder"`
}

ComponentEventsParams holds parameters for component Kubernetes event queries

type ComponentEventsResult added in v1.2.0

type ComponentEventsResult struct {
	Events     []EventEntry `json:"events"`
	TotalCount int          `json:"totalCount"`
	Took       int          `json:"took"`
}

ComponentEventsResult represents the result of a component event query

type EventEntry added in v1.2.0

type EventEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Message   string    `json:"message"`
	Type      string    `json:"type"`
	Reason    string    `json:"reason"`
	// OpenChoreo resource metadata
	ComponentID     string `json:"componentId,omitempty"`
	ComponentName   string `json:"componentName,omitempty"`
	EnvironmentID   string `json:"environmentId,omitempty"`
	EnvironmentName string `json:"environmentName,omitempty"`
	ProjectID       string `json:"projectId,omitempty"`
	ProjectName     string `json:"projectName,omitempty"`
	NamespaceName   string `json:"namespaceName,omitempty"`
	// Kubernetes object the event involves
	ObjectKind      string `json:"objectKind,omitempty"`
	ObjectName      string `json:"objectName,omitempty"`
	ObjectNamespace string `json:"objectNamespace,omitempty"`
}

EventEntry represents a parsed Kubernetes event entry. The same shape is used for both component and workflow scopes; fields that do not apply to a given scope are left empty.

type EventsAdapter added in v1.2.0

type EventsAdapter interface {
	// GetComponentEvents retrieves Kubernetes events for a component
	GetComponentEvents(ctx context.Context,
		params ComponentEventsParams) (*ComponentEventsResult, error)

	// GetWorkflowEvents retrieves Kubernetes events for a workflow run
	GetWorkflowEvents(ctx context.Context,
		params WorkflowEventsParams) (*WorkflowEventsResult, error)
}

EventsAdapter defines the interface for events adapter implementations

type LogEntry

type LogEntry struct {
	Timestamp     time.Time         `json:"timestamp"`
	Log           string            `json:"log"`
	LogLevel      string            `json:"logLevel"`
	ComponentID   string            `json:"componentId"`
	EnvironmentID string            `json:"environmentId"`
	ProjectID     string            `json:"projectId"`
	Version       string            `json:"version"`
	VersionID     string            `json:"versionId"`
	Namespace     string            `json:"namespace"`
	PodID         string            `json:"podId"`
	ContainerName string            `json:"containerName"`
	Labels        map[string]string `json:"labels"`
	// Additional fields for logs API v1
	ComponentName   string `json:"componentName,omitempty"`
	EnvironmentName string `json:"environmentName,omitempty"`
	ProjectName     string `json:"projectName,omitempty"`
	NamespaceName   string `json:"namespaceName,omitempty"`
	PodNamespace    string `json:"podNamespace,omitempty"`
	PodName         string `json:"podName,omitempty"`
}

LogEntry represents a parsed log entry for component logs

type LogsAdapter added in v0.17.0

type LogsAdapter interface {
	// GetComponentApplicationLogs retrieves component application logs
	GetComponentApplicationLogs(ctx context.Context,
		params ComponentApplicationLogsParams) (*ComponentApplicationLogsResult, error)

	// GetWorkflowLogs retrieves workflow run logs
	GetWorkflowLogs(ctx context.Context,
		params WorkflowLogsParams) (*WorkflowLogsResult, error)
}

LogsAdapter defines the interface for logs adapter implementations

type SpanDetail added in v1.0.0

type SpanDetail struct {
	SpanID             string                 `json:"spanId"`
	SpanName           string                 `json:"spanName"`
	SpanKind           string                 `json:"spanKind,omitempty"`
	ParentSpanID       string                 `json:"parentSpanId,omitempty"`
	StartTime          time.Time              `json:"startTime"`
	EndTime            time.Time              `json:"endTime"`
	DurationNs         int64                  `json:"durationNs"`
	Status             *SpanStatus            `json:"status,omitempty"`
	Attributes         map[string]interface{} `json:"attributes,omitempty"`
	ResourceAttributes map[string]interface{} `json:"resourceAttributes,omitempty"`
}

SpanDetail represents detailed information about a single span

type SpanStatus added in v1.2.0

type SpanStatus struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

SpanStatus represents the execution status of a span, following the OpenTelemetry span Status model (a status code plus an optional message).

type SpansResult added in v1.0.0

type SpansResult struct {
	Spans      []TraceSpan `json:"spans"`
	TotalCount int         `json:"totalCount"`
	Took       int         `json:"tookMs"`
}

SpansResult defines the result structure for span queries

type Trace added in v0.17.0

type Trace struct {
	TraceID      string      `json:"traceId"`
	TraceName    string      `json:"traceName"`
	SpanCount    int         `json:"spanCount"`
	RootSpanID   string      `json:"rootSpanId"`
	RootSpanName string      `json:"rootSpanName"`
	RootSpanKind string      `json:"rootSpanKind"`
	StartTime    time.Time   `json:"startTime"`
	EndTime      time.Time   `json:"endTime"`
	DurationNs   int64       `json:"durationNs"`
	HasErrors    bool        `json:"hasErrors"`
	Spans        []TraceSpan `json:"spans,omitempty"`
}

Trace represents a distributed trace

type TraceSpan added in v0.17.0

type TraceSpan struct {
	SpanID             string                 `json:"spanId"`
	Name               string                 `json:"name"`
	SpanKind           string                 `json:"spanKind,omitempty"`
	ParentSpanID       string                 `json:"parentSpanId,omitempty"`
	StartTime          time.Time              `json:"startTime"`
	EndTime            time.Time              `json:"endTime"`
	DurationNs         int64                  `json:"durationNs"`
	Status             *SpanStatus            `json:"status,omitempty"`
	Attributes         map[string]interface{} `json:"attributes,omitempty"`
	ResourceAttributes map[string]interface{} `json:"resourceAttributes,omitempty"`
}

TraceSpan represents a span within a trace with all details

type TracesQueryParams added in v0.17.0

type TracesQueryParams struct {
	// Time range
	StartTime time.Time `json:"startTime"`
	EndTime   time.Time `json:"endTime"`

	// Resource identifiers
	Namespace     string `json:"namespace"`
	ProjectID     string `json:"projectId"`
	ComponentID   string `json:"componentId,omitempty"`
	EnvironmentID string `json:"environmentId,omitempty"`

	// Query options
	TraceID           string `json:"traceId,omitempty"`
	Limit             int    `json:"limit"`
	SortOrder         string `json:"sortOrder"`
	IncludeAttributes bool   `json:"includeAttributes,omitempty"`
}

TracesQueryParams defines parameters for querying traces

type TracesQueryResult added in v0.17.0

type TracesQueryResult struct {
	Traces     []Trace `json:"traces"`
	TotalCount int     `json:"totalCount"`
	Took       int     `json:"tookMs"`
}

TracesQueryResult defines the result structure for trace queries

type TracingAdapter added in v0.17.0

type TracingAdapter interface {
	// GetTraces retrieves traces based on query parameters
	GetTraces(ctx context.Context, params TracesQueryParams) (*TracesQueryResult, error)
	// GetSpans retrieves spans for a specific trace
	GetSpans(ctx context.Context, traceID string, params TracesQueryParams) (*SpansResult, error)
	// GetSpanDetails retrieves detailed information about a specific span
	GetSpanDetails(ctx context.Context, traceID string, spanID string) (*SpanDetail, error)
}

TracingAdapter defines the interface for retrieving traces from an external adapter

type WorkflowEventsParams added in v1.2.0

type WorkflowEventsParams struct {
	Namespace       string    `json:"namespace"`
	WorkflowRunName string    `json:"workflowRunName"`
	TaskName        string    `json:"taskName"`
	StartTime       time.Time `json:"startTime"`
	EndTime         time.Time `json:"endTime"`
	Limit           int       `json:"limit"`
	SortOrder       string    `json:"sortOrder"`
}

WorkflowEventsParams holds parameters for workflow run Kubernetes event queries

type WorkflowEventsResult added in v1.2.0

type WorkflowEventsResult struct {
	Events     []EventEntry `json:"events"`
	TotalCount int          `json:"totalCount"`
	Took       int          `json:"took"`
}

WorkflowEventsResult represents the result of a workflow run event query

type WorkflowLogEntry added in v0.17.0

type WorkflowLogEntry struct {
	Timestamp     time.Time         `json:"timestamp"`
	Log           string            `json:"log"`
	LogLevel      string            `json:"logLevel"`
	PodNamespace  string            `json:"podNamespace,omitempty"`
	PodID         string            `json:"podId,omitempty"`
	PodName       string            `json:"podName,omitempty"`
	ContainerName string            `json:"containerName,omitempty"`
	Labels        map[string]string `json:"labels,omitempty"`
}

WorkflowLogEntry represents a parsed log entry for workflow logs

type WorkflowLogsParams added in v0.17.0

type WorkflowLogsParams struct {
	Namespace       string    `json:"namespace"`
	WorkflowRunName string    `json:"workflowRunName"`
	TaskName        string    `json:"taskName"`
	StartTime       time.Time `json:"startTime"`
	EndTime         time.Time `json:"endTime"`
	SearchPhrase    string    `json:"searchPhrase"`
	LogLevels       []string  `json:"logLevels"`
	Limit           int       `json:"limit"`
	SortOrder       string    `json:"sortOrder"`
}

WorkflowLogsParams holds parameters for workflow log queries

type WorkflowLogsResult added in v0.17.0

type WorkflowLogsResult struct {
	Logs       []WorkflowLogEntry `json:"logs"`
	TotalCount int                `json:"totalCount"`
	Took       int                `json:"took"`
}

WorkflowLogsResult represents the result of a workflow log query

Jump to

Keyboard shortcuts

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