service

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPMetricsTimeSeries added in v0.5.0

type HTTPMetricsTimeSeries struct {
	LatencyPercentile50th    []prometheus.TimeValuePoint `json:"latencyPercentile50th"`
	LatencyPercentile90th    []prometheus.TimeValuePoint `json:"latencyPercentile90th"`
	LatencyPercentile99th    []prometheus.TimeValuePoint `json:"latencyPercentile99th"`
	MeanLatency              []prometheus.TimeValuePoint `json:"meanLatency"`
	RequestCount             []prometheus.TimeValuePoint `json:"requestCount"`
	SuccessfulRequestCount   []prometheus.TimeValuePoint `json:"successfulRequestCount"`
	UnsuccessfulRequestCount []prometheus.TimeValuePoint `json:"unsuccessfulRequestCount"`
}

HTTPMetricsTimeSeries represents HTTP metrics as time series data. This is what will be returned by the POST /api/metrics/component/http API

type LogResponse

type LogResponse struct {
	Logs       []opensearch.LogEntry `json:"logs"`
	TotalCount int                   `json:"totalCount"`
	Took       int                   `json:"tookMs"`
}

LogResponse represents the response structure for log queries

type LoggingService

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

LoggingService provides logging and metrics functionality

func NewLoggingService

func NewLoggingService(osClient OpenSearchClient, metricsService *prometheus.MetricsService, k8sClient client.Client, cfg *config.Config, logger *slog.Logger) *LoggingService

NewLoggingService creates a new logging service instance

func (*LoggingService) DeleteAlertRule added in v0.9.0

func (s *LoggingService) DeleteAlertRule(ctx context.Context, sourceType string, ruleName string) (*types.AlertingRuleSyncResponse, error)

DeleteAlertRule deletes an alert rule from the observability backend

func (*LoggingService) DeleteOpenSearchAlertRule added in v0.9.0

func (s *LoggingService) DeleteOpenSearchAlertRule(ctx context.Context, ruleName string) (*types.AlertingRuleSyncResponse, error)

DeleteOpenSearchAlertRule deletes an alert rule from OpenSearch

func (*LoggingService) GetBuildLogs added in v0.6.0

func (s *LoggingService) GetBuildLogs(ctx context.Context, params opensearch.BuildQueryParams) (*LogResponse, error)

GetBuildLogs retrieves logs for a specific build using V2 wildcard search

func (*LoggingService) GetComponentHTTPMetrics added in v0.5.0

func (s *LoggingService) GetComponentHTTPMetrics(ctx context.Context, componentID, environmentID, projectID string, startTime, endTime time.Time) (*HTTPMetricsTimeSeries, error)

GetComponentHTTPMetrics retrieves HTTP metrics for a component

func (*LoggingService) GetComponentLogs

func (s *LoggingService) GetComponentLogs(ctx context.Context, params opensearch.ComponentQueryParams) (*LogResponse, error)

GetComponentLogs retrieves logs for a specific component using V2 wildcard search

func (*LoggingService) GetComponentResourceMetrics added in v0.4.0

func (s *LoggingService) GetComponentResourceMetrics(ctx context.Context, componentID, environmentID, projectID string, startTime, endTime time.Time) (*prometheus.ResourceMetricsTimeSeries, error)

GetComponentResourceMetrics retrieves resource usage metrics for a component as time series

func (*LoggingService) GetGatewayLogs

func (s *LoggingService) GetGatewayLogs(ctx context.Context, params opensearch.GatewayQueryParams) (*LogResponse, error)

GetGatewayLogs retrieves gateway logs using V2 wildcard search

func (*LoggingService) GetOrganizationLogs

func (s *LoggingService) GetOrganizationLogs(ctx context.Context, params opensearch.QueryParams, podLabels map[string]string) (*LogResponse, error)

GetOrganizationLogs retrieves logs for an organization with custom filters

func (*LoggingService) GetProjectLogs

func (s *LoggingService) GetProjectLogs(ctx context.Context, params opensearch.QueryParams, componentIDs []string) (*LogResponse, error)

GetProjectLogs retrieves logs for a specific project using V2 wildcard search

func (*LoggingService) GetRCAReportByAlert added in v0.9.0

func (s *LoggingService) GetRCAReportByAlert(ctx context.Context, params opensearch.RCAReportByAlertQueryParams) (map[string]interface{}, error)

GetRCAReportByAlert retrieves a single RCA report by alert with optional version

func (*LoggingService) GetRCAReportsByProject added in v0.9.0

func (s *LoggingService) GetRCAReportsByProject(ctx context.Context, params opensearch.RCAReportQueryParams) (map[string]interface{}, error)

GetRCAReportsByProject retrieves RCA reports for a specific project with optional filtering

func (*LoggingService) GetTraces added in v0.7.0

func (*LoggingService) HealthCheck

func (s *LoggingService) HealthCheck(ctx context.Context) error

HealthCheck performs a health check on the service

func (*LoggingService) SendAlertNotification added in v0.9.0

func (s *LoggingService) SendAlertNotification(ctx context.Context, requestBody map[string]interface{}) error

SendAlertNotification sends an alert notification via the configured notification channel

func (*LoggingService) StoreAlertEntry added in v0.9.0

func (s *LoggingService) StoreAlertEntry(ctx context.Context, requestBody map[string]interface{}) (string, error)

StoreAlertEntry stores an alert entry in the logs backend and returns the alert ID

func (*LoggingService) UpsertAlertRule added in v0.9.0

func (s *LoggingService) UpsertAlertRule(ctx context.Context, sourceType string, ruleName string, rule types.AlertingRuleRequest) (*types.AlertingRuleSyncResponse, error)

UpsertAlertRule creates or updates an alert rule in the observability backend

func (*LoggingService) UpsertOpenSearchAlertRule added in v0.9.0

func (s *LoggingService) UpsertOpenSearchAlertRule(ctx context.Context, ruleName string, rule types.AlertingRuleRequest) (*types.AlertingRuleSyncResponse, error)

UpsertOpenSearchAlertRule creates or updates an alert rule in OpenSearch

type OpenSearchClient

type OpenSearchClient interface {
	Search(ctx context.Context, indices []string, query map[string]interface{}) (*opensearch.SearchResponse, error)
	GetIndexMapping(ctx context.Context, index string) (*opensearch.MappingResponse, error)
	SearchMonitorByName(ctx context.Context, name string) (id string, exists bool, err error)
	GetMonitorByID(ctx context.Context, monitorID string) (monitor map[string]interface{}, err error)
	CreateMonitor(ctx context.Context, monitor map[string]interface{}) (id string, lastUpdateTime int64, err error)
	UpdateMonitor(ctx context.Context, monitorID string, monitor map[string]interface{}) (lastUpdateTime int64, err error)
	DeleteMonitor(ctx context.Context, monitorID string) error
	WriteAlertEntry(ctx context.Context, entry map[string]interface{}) (string, error)
	HealthCheck(ctx context.Context) error
}

OpenSearchClient interface for testing

Jump to

Keyboard shortcuts

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