Documentation
¶
Index ¶
- Constants
- type AlertDetails
- type AlertNotificationResponse
- type AlertingRuleCondition
- type AlertingRuleMetadata
- type AlertingRuleRequest
- type AlertingRuleSource
- type AlertingRuleSyncResponse
- type ComponentSearchScope
- type HTTPMetricsQueryResponse
- type LogEntry
- type LogMetadata
- type LogsQueryRequest
- type LogsQueryResponse
- type MetricsQueryRequest
- type MetricsTimeSeriesItem
- type ResourceMetricsQueryResponse
- type RuntimeTopologyEdge
- type RuntimeTopologyMetrics
- type RuntimeTopologyNode
- type RuntimeTopologyNodeKind
- type RuntimeTopologyNodeRef
- type RuntimeTopologyProtocol
- type RuntimeTopologyRequest
- type RuntimeTopologyResponse
- type RuntimeTopologySummary
- type SearchScope
- type SpanInfo
- type SpansQueryResponse
- type TraceInfo
- type TracesQueryRequest
- type TracesQueryResponse
- type WorkflowSearchScope
Constants ¶
const ( // Logs API (v1) internal server error codes. ErrorCodeV1LogsInternalGeneric = "OBS-V1-L-01" ErrorCodeV1LogsAuthzInternal = "OBS-V1-L-02" ErrorCodeV1LogsServiceNotReady = "OBS-V1-L-03" ErrorCodeV1LogsResolverFailed = "OBS-V1-L-04" ErrorCodeV1LogsRetrievalFailed = "OBS-V1-L-05" // Metrics API (v1) internal server error codes. ErrorCodeV1MetricsInternalGeneric = "OBS-V1-M-01" ErrorCodeV1MetricsAuthzInternal = "OBS-V1-M-02" ErrorCodeV1MetricsServiceNotReady = "OBS-V1-M-03" ErrorCodeV1MetricsResolverFailed = "OBS-V1-M-04" ErrorCodeV1MetricsRetrievalFailed = "OBS-V1-M-05" // Traces API (v1alpha1) internal server error codes. ErrorCodeV1TracesInternalGeneric = "OBS-V1-T-01" ErrorCodeV1TracesAuthzInternal = "OBS-V1-T-02" ErrorCodeV1TracesServiceNotReady = "OBS-V1-T-03" ErrorCodeV1TracesResolverFailed = "OBS-V1-T-04" ErrorCodeV1TracesRetrievalFailed = "OBS-V1-T-05" ErrorCodeV1TracesInvalidRequest = "OBS-V1-T-06" ErrorCodeV1TracesSpanNotFound = "OBS-V1-T-07" // Runtime topology API (v1alpha1) internal server error codes. ErrorCodeV1RuntimeTopologyInternalGeneric = "OBS-V1-RG-01" ErrorCodeV1RuntimeTopologyAuthzInternal = "OBS-V1-RG-02" ErrorCodeV1RuntimeTopologyServiceNotReady = "OBS-V1-RG-03" ErrorCodeV1RuntimeTopologyResolverFailed = "OBS-V1-RG-04" ErrorCodeV1RuntimeTopologyRetrievalFailed = "OBS-V1-RG-05" // Scope resolution auth failure — shared across all APIs. ErrorCodeV1ScopeAuthFailed = "OBS-V1-SCOPE-AUTH-FAILED" )
Error codes for the new API
const ( MetricTypeResource = "resource" MetricTypeHTTP = "http" )
Metric type constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertDetails ¶ added in v0.13.0
type AlertDetails struct {
// Alert information
AlertName string `json:"alertName"`
AlertTimestamp string `json:"alertTimestamp"`
AlertSeverity string `json:"alertSeverity"`
AlertDescription string `json:"alertDescription"`
AlertThreshold string `json:"alertThreshold"`
AlertValue string `json:"alertValue"`
AlertType string `json:"alertType"`
// Component information
Namespace string `json:"namespace"`
Component string `json:"component"`
Project string `json:"project"`
Environment string `json:"environment"`
ComponentID string `json:"componentId"`
ProjectID string `json:"projectId"`
EnvironmentID string `json:"environmentId"`
// Notification channels to send alerts to
NotificationChannels []string `json:"notificationChannels,omitempty"`
// Incident actions
IncidentEnabled bool `json:"incidentEnabled"`
TriggerAiRca bool `json:"triggerAiRca"`
TriggerAiCostAnalysis bool `json:"triggerAiCostAnalysis"`
}
AlertDetails represents alert information used for notifications and CEL template rendering
func (*AlertDetails) ToMap ¶ added in v0.13.0
func (a *AlertDetails) ToMap() map[string]interface{}
ToMap converts AlertDetails to a map for CEL template rendering. Uses JSON marshaling to automatically convert struct fields to map keys based on JSON tags.
type AlertNotificationResponse ¶
type AlertNotificationResponse struct {
Status string `json:"status"`
AlertID string `json:"alertId,omitempty"`
EmailRecipients []string `json:"emailRecipients,omitempty"`
}
AlertNotificationResponse represents the outcome of processing an alert notification.
type AlertingRuleCondition ¶
type AlertingRuleCondition struct {
Enabled bool `json:"enabled"`
Window string `json:"window"`
Interval string `json:"interval"`
Operator string `json:"operator"`
Threshold float64 `json:"threshold"`
}
AlertingRuleCondition defines the condition that triggers the alert
type AlertingRuleMetadata ¶
type AlertingRuleMetadata struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
ComponentUID string `json:"component-uid"`
ProjectUID string `json:"project-uid"`
EnvironmentUID string `json:"environment-uid"`
Severity string `json:"severity"`
}
AlertingRuleMetadata contains metadata about an alerting rule
type AlertingRuleRequest ¶
type AlertingRuleRequest struct {
Metadata AlertingRuleMetadata `json:"metadata"`
Source AlertingRuleSource `json:"source"`
Condition AlertingRuleCondition `json:"condition"`
}
AlertingRuleRequest represents the request body for PUT /api/alerting/rule/{sourceType}/{ruleName}
type AlertingRuleSource ¶
type AlertingRuleSource struct {
Type string `json:"type"`
Query string `json:"query"` // For log-based alert rules
Metric string `json:"metric"` // For metric-based alert rules (e.g., "cpu_usage", "memory_usage")
}
AlertingRuleSource defines the source of data for the alerting rule
type AlertingRuleSyncResponse ¶
type AlertingRuleSyncResponse struct {
Status string `json:"status"`
LogicalID string `json:"logicalId"`
BackendID string `json:"backendId"`
Action string `json:"action"`
LastSynced string `json:"lastSynced"`
}
AlertingRuleSyncResponse captures the result of an alert rule upsert.
type ComponentSearchScope ¶ added in v0.17.0
type ComponentSearchScope struct {
Namespace string `json:"namespace" validate:"required"`
Project string `json:"project,omitempty"`
Component string `json:"component,omitempty"`
Environment string `json:"environment,omitempty"`
}
ComponentSearchScope defines the search scope for component logs Matches OpenAPI ComponentSearchScope schema
type HTTPMetricsQueryResponse ¶ added in v0.17.0
type HTTPMetricsQueryResponse struct {
RequestCount []MetricsTimeSeriesItem `json:"requestCount,omitempty"`
SuccessfulRequestCount []MetricsTimeSeriesItem `json:"successfulRequestCount,omitempty"`
UnsuccessfulRequestCount []MetricsTimeSeriesItem `json:"unsuccessfulRequestCount,omitempty"`
MeanLatency []MetricsTimeSeriesItem `json:"meanLatency,omitempty"`
LatencyP50 []MetricsTimeSeriesItem `json:"latencyP50,omitempty"`
LatencyP90 []MetricsTimeSeriesItem `json:"latencyP90,omitempty"`
LatencyP99 []MetricsTimeSeriesItem `json:"latencyP99,omitempty"`
}
HTTPMetricsQueryResponse is the response for metric="http" queries
type LogEntry ¶ added in v0.17.0
type LogEntry struct {
Timestamp string `json:"timestamp"`
Log string `json:"log"`
Level string `json:"level,omitempty"`
Metadata *LogMetadata `json:"metadata,omitempty"`
}
LogEntry represents a single log entry in the response Used for both component and workflow logs Matches OpenAPI ComponentLogEntry/WorkflowLogEntry schemas
type LogMetadata ¶ added in v0.17.0
type LogMetadata struct {
// Component-specific fields (empty for workflow logs)
ComponentName string `json:"componentName,omitempty"`
ProjectName string `json:"projectName,omitempty"`
EnvironmentName string `json:"environmentName,omitempty"`
NamespaceName string `json:"namespaceName,omitempty"`
ComponentUID string `json:"componentUid,omitempty"`
ProjectUID string `json:"projectUid,omitempty"`
EnvironmentUID string `json:"environmentUid,omitempty"`
ContainerName string `json:"containerName,omitempty"`
PodName string `json:"podName,omitempty"`
PodNamespace string `json:"podNamespace,omitempty"`
}
LogMetadata contains metadata for a log entry Used for both component and workflow logs Matches OpenAPI ComponentLogEntry.metadata schema (workflow logs use a subset)
type LogsQueryRequest ¶ added in v0.17.0
type LogsQueryRequest struct {
// SearchScope defines where to search for logs (component or workflow)
SearchScope *SearchScope `json:"searchScope" validate:"required"`
// Time range for the query (required)
StartTime string `json:"startTime" validate:"required"`
EndTime string `json:"endTime" validate:"required"`
// Optional filters
SearchPhrase string `json:"searchPhrase,omitempty"`
LogLevels []string `json:"logLevels,omitempty"`
// Pagination and sorting
Limit int `json:"limit,omitempty"`
SortOrder string `json:"sortOrder,omitempty"` // asc or desc, default: desc
}
LogsQueryRequest represents the request body for POST /api/v1/logs/query Matches OpenAPI LogsQueryRequest schema
type LogsQueryResponse ¶ added in v0.17.0
type LogsQueryResponse struct {
Logs []LogEntry `json:"logs"`
Total int `json:"total"`
TookMs int `json:"tookMs"`
}
LogsQueryResponse represents the response for POST /api/v1/logs/query Matches OpenAPI LogsQueryResponse schema
type MetricsQueryRequest ¶ added in v0.17.0
type MetricsQueryRequest struct {
// Metric defines the type of metrics to query
Metric string `json:"metric" validate:"required"` // "resource" | "http"
// Time range for the query (required)
StartTime string `json:"startTime" validate:"required"`
EndTime string `json:"endTime" validate:"required"`
// Step is the query resolution step (e.g. "1m", "5m", "15m", "30m", "1h")
Step *string `json:"step,omitempty"`
// SearchScope restricts the query to a specific component, project, or namespace.
// Uses ComponentSearchScope directly (not the SearchScope union) because metrics
// queries do not support workflow scope. Required — matches the OpenAPI spec.
SearchScope ComponentSearchScope `json:"searchScope"`
}
MetricsQueryRequest represents the request body for POST /api/v1/metrics/query Matches OpenAPI MetricsQueryRequest schema
type MetricsTimeSeriesItem ¶ added in v0.17.0
type MetricsTimeSeriesItem struct {
Timestamp time.Time `json:"timestamp"`
Value float64 `json:"value"`
}
MetricsTimeSeriesItem represents a single point in a metrics time series
type ResourceMetricsQueryResponse ¶ added in v0.17.0
type ResourceMetricsQueryResponse struct {
CPUUsage []MetricsTimeSeriesItem `json:"cpuUsage,omitempty"`
CPURequests []MetricsTimeSeriesItem `json:"cpuRequests,omitempty"`
CPULimits []MetricsTimeSeriesItem `json:"cpuLimits,omitempty"`
MemoryUsage []MetricsTimeSeriesItem `json:"memoryUsage,omitempty"`
MemoryRequests []MetricsTimeSeriesItem `json:"memoryRequests,omitempty"`
MemoryLimits []MetricsTimeSeriesItem `json:"memoryLimits,omitempty"`
}
ResourceMetricsQueryResponse is the response for metric="resource" queries
type RuntimeTopologyEdge ¶ added in v1.1.0
type RuntimeTopologyEdge struct {
// ID is a stable identifier for the edge. See the OpenAPI schema for the
// convention used by the server when constructing it.
ID string `json:"id"`
Source RuntimeTopologyNodeRef `json:"source"`
Target RuntimeTopologyNodeRef `json:"target"`
Protocol RuntimeTopologyProtocol `json:"protocol,omitempty"`
Metrics *RuntimeTopologyMetrics `json:"metrics,omitempty"`
}
RuntimeTopologyEdge represents an observed traffic flow between two nodes.
type RuntimeTopologyMetrics ¶ added in v1.1.0
type RuntimeTopologyMetrics struct {
RequestCount float64 `json:"requestCount"`
UnsuccessfulRequestCount float64 `json:"unsuccessfulRequestCount"`
MeanLatency float64 `json:"meanLatency"`
LatencyP50 float64 `json:"latencyP50"`
LatencyP90 float64 `json:"latencyP90"`
LatencyP99 float64 `json:"latencyP99"`
}
RuntimeTopologyMetrics carries aggregate HTTP metrics for a node or edge. Latency values are in seconds. Counts are totals over the requested window.
type RuntimeTopologyNode ¶ added in v1.1.0
type RuntimeTopologyNode struct {
RuntimeTopologyNodeRef
Metrics *RuntimeTopologyMetrics `json:"metrics,omitempty"`
}
RuntimeTopologyNode is a topology node with its observed aggregate metrics. Embeds RuntimeTopologyNodeRef for the identifying fields.
type RuntimeTopologyNodeKind ¶ added in v1.1.0
type RuntimeTopologyNodeKind string
RuntimeTopologyNodeKind identifies the kind of node referenced in the topology.
const ( RuntimeTopologyNodeKindComponent RuntimeTopologyNodeKind = "component" RuntimeTopologyNodeKindGateway RuntimeTopologyNodeKind = "gateway" RuntimeTopologyNodeKindExternal RuntimeTopologyNodeKind = "external" )
type RuntimeTopologyNodeRef ¶ added in v1.1.0
type RuntimeTopologyNodeRef struct {
Kind RuntimeTopologyNodeKind `json:"kind"`
// Component-kind fields — both name and UID from pod labels.
Component string `json:"component,omitempty"`
ComponentUID string `json:"componentUid,omitempty"`
Service string `json:"service,omitempty"`
// Gateway-kind fields.
Name string `json:"name,omitempty"`
// External-kind fields.
Host string `json:"host,omitempty"`
Project string `json:"project,omitempty"`
ProjectUID string `json:"projectUid,omitempty"`
// Common identifier — namespace the node lives in.
Namespace string `json:"namespace,omitempty"`
}
RuntimeTopologyNodeRef identifies a node in the topology. The shape depends on Kind:
- Kind == "component": Component (name) + ComponentUID and Project (name) + ProjectUID are populated from the metrics backend using pod label data.
- Kind == "gateway": Name is required (e.g. "internet", "intranet").
- Kind == "external": at least one of Host or Component should be set.
type RuntimeTopologyProtocol ¶ added in v1.1.0
type RuntimeTopologyProtocol string
RuntimeTopologyProtocol is the wire protocol of an observed edge.
const (
RuntimeTopologyProtocolHTTP RuntimeTopologyProtocol = "http"
)
type RuntimeTopologyRequest ¶ added in v1.1.0
type RuntimeTopologyRequest struct {
// SearchScope identifies the project and environment to query. namespace,
// project, and environment are all required for this endpoint.
SearchScope ComponentSearchScope `json:"searchScope"`
// Time range for the query window (RFC3339, required).
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
// IncludeGateways toggles inclusion of gateway -> component edges. Defaults
// to true when omitted.
IncludeGateways *bool `json:"includeGateways,omitempty"`
// IncludeExternal toggles inclusion of cross-project / off-platform edges.
// Defaults to true when omitted.
IncludeExternal *bool `json:"includeExternal,omitempty"`
}
RuntimeTopologyRequest is the request body for POST /api/v1alpha1/metrics/runtime-topology. Matches the OpenAPI RuntimeTopologyRequest schema.
type RuntimeTopologyResponse ¶ added in v1.1.0
type RuntimeTopologyResponse struct {
Nodes []RuntimeTopologyNode `json:"nodes,omitempty"`
Edges []RuntimeTopologyEdge `json:"edges,omitempty"`
Summary RuntimeTopologySummary `json:"summary"`
}
RuntimeTopologyResponse is the response body for the runtime topology endpoint. Nodes and edges only include entities for which traffic was observed in the window — static topology must come from a separate source.
type RuntimeTopologySummary ¶ added in v1.1.0
type RuntimeTopologySummary struct {
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
GeneratedAt time.Time `json:"generatedAt"`
}
RuntimeTopologySummary describes the query window the response covers.
type SearchScope ¶ added in v0.17.0
type SearchScope struct {
Component *ComponentSearchScope `json:"-"`
Workflow *WorkflowSearchScope `json:"-"`
}
SearchScope is a union type for component or workflow search scope Implements oneOf from OpenAPI spec - can be either ComponentSearchScope or WorkflowSearchScope
func (*SearchScope) MarshalJSON ¶ added in v0.17.0
func (s *SearchScope) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling
func (*SearchScope) UnmarshalJSON ¶ added in v0.17.0
func (s *SearchScope) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling to handle oneOf The JSON can be either a ComponentSearchScope or WorkflowSearchScope directly
type SpanInfo ¶ added in v0.17.0
type SpanInfo struct {
SpanID string `json:"spanId"`
SpanName string `json:"spanName"`
SpanKind string `json:"spanKind,omitempty"`
ParentSpanID string `json:"parentSpanId,omitempty"`
StartTime *time.Time `json:"startTime,omitempty"`
EndTime *time.Time `json:"endTime,omitempty"`
DurationNs int64 `json:"durationNs,omitempty"`
Status string `json:"status,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
ResourceAttributes map[string]interface{} `json:"resourceAttributes,omitempty"`
}
SpanInfo contains information about a span
type SpansQueryResponse ¶ added in v0.17.0
type SpansQueryResponse struct {
Spans []SpanInfo `json:"spans"`
Total int `json:"total"`
TookMs int `json:"tookMs"`
}
SpansQueryResponse represents the internal response for span queries
type TraceInfo ¶ added in v0.17.0
type TraceInfo 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,omitempty"`
EndTime *time.Time `json:"endTime,omitempty"`
DurationNs int64 `json:"durationNs,omitempty"`
HasErrors bool `json:"hasErrors"`
}
TraceInfo contains summary information about a trace
type TracesQueryRequest ¶ added in v0.17.0
type TracesQueryRequest struct {
StartTime time.Time
EndTime time.Time
Limit int
SortOrder string
IncludeAttributes bool
SearchScope ComponentSearchScope
}
TracesQueryRequest represents the internal request for querying traces
type TracesQueryResponse ¶ added in v0.17.0
type TracesQueryResponse struct {
Traces []TraceInfo `json:"traces"`
Total int `json:"total"`
TookMs int `json:"tookMs"`
}
TracesQueryResponse represents the internal response for trace queries
type WorkflowSearchScope ¶ added in v0.17.0
type WorkflowSearchScope struct {
Namespace string `json:"namespace" validate:"required"`
WorkflowRunName string `json:"workflowRunName,omitempty"`
TaskName string `json:"taskName,omitempty"`
}
WorkflowSearchScope defines the search scope for workflow run logs Matches OpenAPI WorkflowSearchScope schema