ocimonitoring

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 36 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

OCI Monitoring

Parity grade: B · SDK github.com/oracle/oci-go-sdk/v65@v65.126.2 · last audited 2026-10-29 (ee4983645)

Coverage

Metric Value
PARITY entries audited 18 (14 ok, 4 partial)
Feature families 9 (7 ok, 2 partial)
Known gaps 3
Deferred items 0
Resource leaks unknown
Known gaps
  • Alarm overrides, ruleName rules and evaluationSlackDuration are stored but not evaluated: the SDK says each override is evaluated in order and then BASE (monitoring AlarmOverride and CreateAlarmDetails comments) but defines no per-rule state, history or message shape, and the default slack (PT3M) would delay every evaluation in alarm tests; evaluation is one rule per alarm in eval.go:evaluate.
  • MQL lacks grouping(), nested queries and joins (&& and ||): the MQL reference page documents arithmetic (+ - * / %) and the joins but gives no syntax for grouping() or nested queries (mql.go ParseMQL rejects them).
  • IAM policy checks, resource principals and instance principals are not applied; only API-key signatures are verified (out of scope: IAM evaluation).

More

Documentation

Index

Constants

View Source
const DefaultPort = 8161

DefaultPort is the dedicated listener's default TCP port.

View Source
const (
	// Region is the fixed region baked into emulated OCIDs.
	Region = "us-ashburn-1"
)

Variables

View Source
var ErrNilAppContext = errors.New("ocimonitoring: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

View Source
var ErrSnapshotNull = errors.New("ocimonitoring: null entry in snapshot")

ErrSnapshotNull is returned when a snapshot contains a null entry.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    string
	Message string
	Status  int
}

APIError is an OCI error response: HTTP status plus the `code` and `message` body fields.

func (*APIError) Error

func (e *APIError) Error() string

type Alarm

type Alarm struct {
	TimeCreated         time.Time         `json:"timeCreated"`
	TimeUpdated         time.Time         `json:"timeUpdated"`
	StatusSince         time.Time         `json:"statusSince"`
	PendingSince        *time.Time        `json:"pendingSince,omitempty"`
	LastNotified        *time.Time        `json:"lastNotified,omitempty"`
	Suppression         *SuppressionSpec  `json:"suppression,omitempty"`
	InSubtree           *bool             `json:"metricCompartmentIdInSubtree,omitempty"`
	PerDimension        *bool             `json:"isNotificationsPerMetricDimensionEnabled,omitempty"`
	Tags                Tags              `json:"tags"`
	Extra               map[string]string `json:"extra,omitempty"`
	Overrides           []jsontext.Value  `json:"overrides,omitempty"`
	ID                  string            `json:"id"`
	Name                string            `json:"displayName"`
	CompartmentID       string            `json:"compartmentId"`
	MetricCompartmentID string            `json:"metricCompartmentId"`
	Namespace           string            `json:"namespace"`
	ResourceGroup       string            `json:"resourceGroup,omitempty"`
	Query               string            `json:"query"`
	Severity            string            `json:"severity"`
	Body                string            `json:"body,omitempty"`
	Resolution          string            `json:"resolution"`
	PendingDuration     string            `json:"pendingDuration"`
	RepeatNotification  string            `json:"repeatNotificationDuration,omitempty"`
	MessageFormat       string            `json:"messageFormat"`
	Status              string            `json:"status"`
	Etag                string            `json:"etag"`
	Destinations        []string          `json:"destinations"`
	History             []HistoryEntry    `json:"history,omitempty"`
	DimStates           []DimState        `json:"dimensionStates,omitempty"`
	Seq                 int64             `json:"seq"`
	Enabled             bool              `json:"isEnabled"`
}

Alarm is a stored alarm and its evaluation state.

type AlarmFilter

type AlarmFilter struct {
	Compartment, Name, State string
	Subtree                  bool
}

AlarmFilter narrows ListAlarms and ListAlarmsStatus.

type AlarmHistoryWire

type AlarmHistoryWire struct {
	AlarmID   string             `json:"alarmId"`
	Entries   []historyEntryWire `json:"entries"`
	IsEnabled bool               `json:"isEnabled"`
}

AlarmHistoryWire is the GetAlarmHistory response body.

type AlarmStatusWire

type AlarmStatusWire struct {
	TimestampTriggered time.Time        `json:"timestampTriggered"`
	Suppression        *SuppressionWire `json:"suppression,omitempty"`
	ID                 string           `json:"id"`
	Name               string           `json:"displayName"`
	Severity           string           `json:"severity"`
	Status             string           `json:"status"`
}

AlarmStatusWire is the ListAlarmsStatus item.

type AlarmSummaryWire

type AlarmSummaryWire struct {
	Suppression    *SuppressionWire          `json:"suppression,omitempty"`
	PerDimension   *bool                     `json:"isNotificationsPerMetricDimensionEnabled,omitempty"`
	FreeformTags   map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags    map[string]map[string]any `json:"definedTags,omitempty"`
	ID             string                    `json:"id"`
	Name           string                    `json:"displayName"`
	CompartmentID  string                    `json:"compartmentId"`
	MetricComp     string                    `json:"metricCompartmentId"`
	Namespace      string                    `json:"namespace"`
	ResourceGroup  string                    `json:"resourceGroup,omitempty"`
	Query          string                    `json:"query"`
	Severity       string                    `json:"severity"`
	LifecycleState string                    `json:"lifecycleState"`
	Destinations   []string                  `json:"destinations"`
	Enabled        bool                      `json:"isEnabled"`
}

AlarmSummaryWire is the ListAlarms item.

type AlarmSuppression

type AlarmSuppression struct {
	TimeCreated   time.Time         `json:"timeCreated"`
	TimeUpdated   time.Time         `json:"timeUpdated"`
	From          time.Time         `json:"timeSuppressFrom"`
	Until         time.Time         `json:"timeSuppressUntil"`
	DeletedAt     *time.Time        `json:"deletedAt,omitempty"`
	Tags          Tags              `json:"tags"`
	Dimensions    map[string]string `json:"dimensions,omitempty"`
	ID            string            `json:"id"`
	CompartmentID string            `json:"compartmentId"`
	TargetType    string            `json:"targetType"`
	TargetAlarm   string            `json:"targetAlarmId,omitempty"`
	TargetComp    string            `json:"targetCompartmentId,omitempty"`
	Level         string            `json:"level"`
	Name          string            `json:"displayName"`
	Description   string            `json:"description,omitempty"`
	State         string            `json:"state"`
	Etag          string            `json:"etag"`
	Conditions    []SuppressionCond `json:"conditions,omitempty"`
	Seq           int64             `json:"seq"`
	Subtree       bool              `json:"subtree,omitempty"`
}

AlarmSuppression suppresses notifications of one alarm or of every alarm in a compartment.

type AlarmSuppressionWire

type AlarmSuppressionWire struct {
	TimeSuppressFrom  time.Time                 `json:"timeSuppressFrom"`
	TimeSuppressUntil time.Time                 `json:"timeSuppressUntil"`
	TimeCreated       time.Time                 `json:"timeCreated"`
	TimeUpdated       time.Time                 `json:"timeUpdated"`
	Target            suppressionTargetWire     `json:"alarmSuppressionTarget"`
	FreeformTags      map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags       map[string]map[string]any `json:"definedTags,omitempty"`
	Dimensions        map[string]string         `json:"dimensions,omitempty"`
	ID                string                    `json:"id"`
	CompartmentID     string                    `json:"compartmentId"`
	Level             string                    `json:"level"`
	DisplayName       string                    `json:"displayName"`
	LifecycleState    string                    `json:"lifecycleState"`
	Description       *string                   `json:"description,omitempty"`
	Conditions        []suppressionCondWire     `json:"suppressionConditions,omitempty"`
}

AlarmSuppressionWire is the AlarmSuppression and AlarmSuppressionSummary representation.

type AlarmWire

type AlarmWire struct {
	TimeCreated    time.Time                 `json:"timeCreated"`
	TimeUpdated    time.Time                 `json:"timeUpdated"`
	Suppression    *SuppressionWire          `json:"suppression,omitempty"`
	InSubtree      *bool                     `json:"metricCompartmentIdInSubtree,omitempty"`
	PerDimension   *bool                     `json:"isNotificationsPerMetricDimensionEnabled,omitempty"`
	FreeformTags   map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags    map[string]map[string]any `json:"definedTags,omitempty"`
	RuleName       *string                   `json:"ruleName,omitempty"`
	NotifVersion   *string                   `json:"notificationVersion,omitempty"`
	NotifTitle     *string                   `json:"notificationTitle,omitempty"`
	EvalSlack      *string                   `json:"evaluationSlackDuration,omitempty"`
	AlarmSummary   *string                   `json:"alarmSummary,omitempty"`
	ID             string                    `json:"id"`
	Name           string                    `json:"displayName"`
	CompartmentID  string                    `json:"compartmentId"`
	MetricComp     string                    `json:"metricCompartmentId"`
	Namespace      string                    `json:"namespace"`
	ResourceGroup  string                    `json:"resourceGroup,omitempty"`
	Query          string                    `json:"query"`
	Resolution     string                    `json:"resolution"`
	Pending        string                    `json:"pendingDuration"`
	Severity       string                    `json:"severity"`
	Body           string                    `json:"body,omitempty"`
	MessageFormat  string                    `json:"messageFormat"`
	Repeat         string                    `json:"repeatNotificationDuration,omitempty"`
	LifecycleState string                    `json:"lifecycleState"`
	Destinations   []string                  `json:"destinations"`
	Overrides      []jsontext.Value          `json:"overrides,omitempty"`
	Enabled        bool                      `json:"isEnabled"`
}

AlarmWire is the Alarm response shape.

type ConfigProvider

type ConfigProvider interface {
	GetOCIMonitoringSettings() Settings
}

ConfigProvider extracts OCI Monitoring configuration from the AppContext Config.

type CreateAlarmIn

type CreateAlarmIn struct {
	Tags
	RetryToken    string           `json:"-"`
	InSubtree     *bool            `json:"metricCompartmentIdInSubtree"`
	PerDimension  *bool            `json:"isNotificationsPerMetricDimensionEnabled"`
	Enabled       *bool            `json:"isEnabled"`
	Suppression   *SuppressionWire `json:"suppression"`
	ResourceGroup *string          `json:"resourceGroup"`
	Resolution    *string          `json:"resolution"`
	Pending       *string          `json:"pendingDuration"`
	Body          *string          `json:"body"`
	MessageFormat *string          `json:"messageFormat"`
	Repeat        *string          `json:"repeatNotificationDuration"`
	RuleName      *string          `json:"ruleName"`
	NotifVersion  *string          `json:"notificationVersion"`
	NotifTitle    *string          `json:"notificationTitle"`
	EvalSlack     *string          `json:"evaluationSlackDuration"`
	AlarmSummary  *string          `json:"alarmSummary"`
	Name          string           `json:"displayName"`
	Compartment   string           `json:"compartmentId"`
	MetricComp    string           `json:"metricCompartmentId"`
	Namespace     string           `json:"namespace"`
	Query         string           `json:"query"`
	Severity      string           `json:"severity"`
	Destinations  []string         `json:"destinations"`
	Overrides     []jsontext.Value `json:"overrides"`
}

CreateAlarmIn is the CreateAlarm request body.

type CreateSuppressionIn

type CreateSuppressionIn struct {
	Tags
	From        *time.Time             `json:"timeSuppressFrom"`
	Until       *time.Time             `json:"timeSuppressUntil"`
	Target      *suppressionTargetWire `json:"alarmSuppressionTarget"`
	Name        *string                `json:"displayName"`
	Description *string                `json:"description"`
	Dimensions  map[string]string      `json:"dimensions"`
	RetryToken  string                 `json:"-"`
	Level       string                 `json:"level"`
	Conditions  []suppressionCondWire  `json:"suppressionConditions"`
}

CreateSuppressionIn is the CreateAlarmSuppression request body.

type DatapointIn

type DatapointIn struct {
	Timestamp *time.Time `json:"timestamp"`
	Value     *float64   `json:"value"`
	Count     *int       `json:"count,omitempty"`
}

DatapointIn is one posted datapoint.

type DimState

type DimState struct {
	Since  time.Time         `json:"since"`
	Dims   map[string]string `json:"dimensions"`
	Status string            `json:"status"`
}

DimState is the last transition of one metric stream of an alarm.

type DimensionStatesIn

type DimensionStatesIn struct {
	DimensionFilters map[string]string `json:"dimensionFilters"`
	Status           string            `json:"status"`
}

DimensionStatesIn is the RetrieveDimensionStates request body.

type DimensionStatesWire

type DimensionStatesWire struct {
	AlarmID      string              `json:"alarmId"`
	Items        []dimStateEntryWire `json:"items"`
	Enabled      bool                `json:"isEnabled"`
	PerDimension bool                `json:"isNotificationsPerMetricDimensionEnabled"`
}

DimensionStatesWire is the AlarmDimensionStatesCollection body.

type FailedMetric

type FailedMetric struct {
	Message    string       `json:"message"`
	MetricData MetricDataIn `json:"metricData"`
}

FailedMetric describes a rejected metric stream.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	Port        int
	EnforceAuth bool
	// contains filtered or unexported fields
}

Handler serves OCI Monitoring: alarms, metric ingestion and metric queries.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a Handler; callers override Port and EnforceAuth from Settings.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name for metrics.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the addressed resource id for metrics.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists the supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler for all OCIMonitoring requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority is irrelevant because RouteMatcher never matches.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all in-memory state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher never matches: OCIMonitoring runs on its own listener.

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context)

Shutdown stops the listener and the sweeper.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker binds the dedicated listener synchronously so a port conflict is returned to the caller.

func (*Handler) Trusted

func (h *Handler) Trusted() echo.HandlerFunc

Trusted returns a handler that skips request-signature verification, for the in-process dashboard proxy.

type HistoryEntry

type HistoryEntry struct {
	Timestamp          time.Time `json:"timestamp"`
	TimestampTriggered time.Time `json:"timestampTriggered"`
	From               string    `json:"from,omitempty"`
	To                 string    `json:"to"`
	Summary            string    `json:"summary"`
}

HistoryEntry records one alarm state change.

type HistoryFilter

type HistoryFilter struct {
	From, To *time.Time
	Type     string
}

HistoryFilter narrows GetAlarmHistory.

type InMemoryBackend

type InMemoryBackend struct {
	Auth *ociauth.Registry
	// contains filtered or unexported fields
}

InMemoryBackend holds every metric stream and alarm under one lock.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) ChangeAlarmCompartment

func (b *InMemoryBackend) ChangeAlarmCompartment(id, ifMatch, compartment, retryToken string) error

ChangeAlarmCompartment moves an alarm to another compartment.

func (*InMemoryBackend) Compartments

func (b *InMemoryBackend) Compartments() []string

Compartments lists the distinct compartments that hold alarms or metric streams.

func (*InMemoryBackend) CreateAlarm

func (b *InMemoryBackend) CreateAlarm(in CreateAlarmIn) (AlarmWire, string, error)

CreateAlarm validates and stores an alarm; it starts OK.

func (*InMemoryBackend) CreateAlarmSuppression

func (b *InMemoryBackend) CreateAlarmSuppression(in CreateSuppressionIn) (AlarmSuppressionWire, string, error)

CreateAlarmSuppression stores a suppression of one alarm or of a compartment's alarms.

func (*InMemoryBackend) DeleteAlarm

func (b *InMemoryBackend) DeleteAlarm(id, ifMatch string) error

DeleteAlarm removes an alarm.

func (*InMemoryBackend) DeleteAlarmSuppression

func (b *InMemoryBackend) DeleteAlarmSuppression(id, ifMatch string) error

DeleteAlarmSuppression marks a suppression DELETED; it stays readable and in the history.

func (*InMemoryBackend) GetAlarm

func (b *InMemoryBackend) GetAlarm(id string) (AlarmWire, string, error)

GetAlarm returns one alarm and its etag.

func (*InMemoryBackend) GetAlarmHistory

func (b *InMemoryBackend) GetAlarmHistory(id string, f HistoryFilter, o ListOpts) (AlarmHistoryWire, string, error)

func (*InMemoryBackend) GetAlarmSuppression

func (b *InMemoryBackend) GetAlarmSuppression(id string) (AlarmSuppressionWire, string, error)

GetAlarmSuppression returns one suppression, including a deleted one.

func (*InMemoryBackend) ListAlarmSuppressions

func (b *InMemoryBackend) ListAlarmSuppressions(
	f SuppressionFilter,
	o ListOpts,
) (page.Page[AlarmSuppressionWire], error)

ListAlarmSuppressions lists suppressions by alarm or by compartment.

func (*InMemoryBackend) ListAlarms

ListAlarms lists the alarms of a compartment.

func (*InMemoryBackend) ListAlarmsStatus

func (b *InMemoryBackend) ListAlarmsStatus(f AlarmFilter, o ListOpts) (page.Page[AlarmStatusWire], error)

ListAlarmsStatus lists the evaluation status of the alarms of a compartment.

func (*InMemoryBackend) ListMetrics

func (b *InMemoryBackend) ListMetrics(
	compartment string, in ListMetricsIn, pageToken string, limit int,
) (page.Page[MetricWire], error)

ListMetrics lists the metric definitions of a compartment.

func (*InMemoryBackend) PostMetricData

func (b *InMemoryBackend) PostMetricData(in PostMetricDataIn) (PostMetricDataOut, error)

PostMetricData stores the datapoints of every valid stream.

func (*InMemoryBackend) RemoveAlarmSuppression

func (b *InMemoryBackend) RemoveAlarmSuppression(alarmID, ifMatch string) error

RemoveAlarmSuppression clears the suppression property of an alarm.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a snapshot.

func (*InMemoryBackend) RetrieveDimensionStates

func (b *InMemoryBackend) RetrieveDimensionStates(
	alarmID string,
	in DimensionStatesIn,
	o ListOpts,
) (DimensionStatesWire, string, error)

RetrieveDimensionStates lists the current status of each metric stream of an alarm.

func (*InMemoryBackend) SetClock

func (b *InMemoryBackend) SetClock(now func() time.Time)

SetClock injects the time source used for datapoint validation, evaluation and retention.

func (*InMemoryBackend) SetCompartmentTree

func (b *InMemoryBackend) SetCompartmentTree(tenancy string, within func(id, ancestor string) bool)

SetCompartmentTree wires subtree matching against the compartment hierarchy; the subtree flag is only accepted for the tenancy root.

func (*InMemoryBackend) SetPublisher

func (b *InMemoryBackend) SetPublisher(p Publisher)

SetPublisher wires alarm notification delivery to a Notifications backend.

func (*InMemoryBackend) SetStreamPublisher

func (b *InMemoryBackend) SetStreamPublisher(p StreamPublisher, check func(streamID string) bool)

SetStreamPublisher wires alarm delivery to Streaming destinations; check validates a destination stream.

func (*InMemoryBackend) SetTagLookup

func (b *InMemoryBackend) SetTagLookup(fn ocitags.Lookup)

SetTagLookup wires defined-tag validation against a tag namespace source (OCI Identity); nil accepts any namespace.

func (*InMemoryBackend) SetTopicChecker

func (b *InMemoryBackend) SetTopicChecker(c TopicChecker)

SetTopicChecker wires validation of alarm destinations against a Notifications backend.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state, including registered API keys.

func (*InMemoryBackend) SummarizeAlarmSuppressionHistory

func (b *InMemoryBackend) SummarizeAlarmSuppressionHistory(
	alarmID string,
	in SuppressionHistoryIn,
	o ListOpts,
) (page.Page[SuppressionHistoryItemWire], error)

SummarizeAlarmSuppressionHistory lists when suppressions affected the alarm, including deleted ones.

func (*InMemoryBackend) SummarizeMetricsData

func (b *InMemoryBackend) SummarizeMetricsData(compartment string, in SummarizeIn) ([]MetricDataWire, error)

SummarizeMetricsData aggregates stored datapoints with the MQL statistic of the query.

func (*InMemoryBackend) Sweep

func (b *InMemoryBackend) Sweep(ctx context.Context)

Sweep drops datapoints past retention, then evaluates every alarm and delivers the notifications it raised.

func (*InMemoryBackend) UpdateAlarm

func (b *InMemoryBackend) UpdateAlarm(id, ifMatch string, in UpdateAlarmIn) (AlarmWire, string, error)

UpdateAlarm changes the supplied fields of an alarm.

type ListMetricsIn

type ListMetricsIn struct {
	DimensionFilters map[string]string `json:"dimensionFilters"`
	Name             *string           `json:"name"`
	Namespace        *string           `json:"namespace"`
	ResourceGroup    *string           `json:"resourceGroup"`
	SortBy           string            `json:"sortBy"`
	SortOrder        string            `json:"sortOrder"`
	GroupBy          []string          `json:"groupBy"`
	Subtree          bool              `json:"-"`
}

ListMetricsIn is the ListMetrics request body.

type ListOpts

type ListOpts struct {
	SortBy string
	Order  string
	Page   string
	Limit  int
}

ListOpts carries the shared list query parameters.

type MQL

type MQL struct {
	Pred     *predicate
	Metric   string
	Stat     string
	Filters  []dimFilter
	GroupBy  []string
	Interval time.Duration
	Quantile float64
	Grouped  bool
}

MQL is a parsed Monitoring Query Language expression.

func ParseMQL

func ParseMQL(src string) (*MQL, error)

ParseMQL parses `Metric[interval]{filters}.groupBy(dims).stat() [predicate]`.

type MetricDataIn

type MetricDataIn struct {
	Dimensions    map[string]string `json:"dimensions"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	ResourceGroup *string           `json:"resourceGroup,omitempty"`
	Namespace     string            `json:"namespace"`
	CompartmentID string            `json:"compartmentId"`
	Name          string            `json:"name"`
	Datapoints    []DatapointIn     `json:"datapoints"`
}

MetricDataIn is one posted metric stream.

type MetricDataWire

type MetricDataWire struct {
	Dimensions           map[string]string `json:"dimensions"`
	Metadata             map[string]string `json:"metadata,omitempty"`
	Namespace            string            `json:"namespace"`
	CompartmentID        string            `json:"compartmentId"`
	Name                 string            `json:"name"`
	ResourceGroup        string            `json:"resourceGroup,omitempty"`
	Resolution           string            `json:"resolution"`
	AggregatedDatapoints []aggregatedWire  `json:"aggregatedDatapoints"`
}

MetricDataWire is one aggregated series of a SummarizeMetricsData response.

type MetricWire

type MetricWire struct {
	Dimensions    map[string]string `json:"dimensions,omitempty"`
	Name          string            `json:"name,omitempty"`
	Namespace     string            `json:"namespace,omitempty"`
	ResourceGroup string            `json:"resourceGroup,omitempty"`
	CompartmentID string            `json:"compartmentId"`
}

MetricWire is one ListMetrics item.

type Point

type Point struct {
	T time.Time `json:"t"`
	V float64   `json:"v"`
	N int       `json:"n"`
}

Point is one stored datapoint.

type PostMetricDataIn

type PostMetricDataIn struct {
	BatchAtomicity string         `json:"batchAtomicity"`
	MetricData     []MetricDataIn `json:"metricData"`
}

PostMetricDataIn is the PostMetricData request body.

type PostMetricDataOut

type PostMetricDataOut struct {
	FailedMetrics      []FailedMetric `json:"failedMetrics,omitempty"`
	FailedMetricsCount int            `json:"failedMetricsCount"`
}

PostMetricDataOut is the PostMetricData response body.

type Provider

type Provider struct{}

Provider implements service.Provider for OCI Monitoring. It runs on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.

func (*Provider) Init

Init creates the backend and handler; the port is bound in StartWorker.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the service provider name.

type Publisher

type Publisher func(ctx context.Context, topicID, title, body string, asJSON bool) error

Publisher delivers an alarm notification to a Notifications topic.

type Settings

type Settings struct {
	Port int `` //nolint:lll // config struct tags are intentionally verbose
	/* 234-byte string literal not displayed */
	EnforceAuth bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 226-byte string literal not displayed */
}

Settings holds service-level configuration, embedded in the root CLI as CLI.OCIMonitoring.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns the settings used when no ConfigProvider is available.

type Stream

type Stream struct {
	Dimensions    map[string]string `json:"dimensions"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	Namespace     string            `json:"namespace"`
	CompartmentID string            `json:"compartmentId"`
	Name          string            `json:"name"`
	ResourceGroup string            `json:"resourceGroup,omitempty"`
	Points        []Point           `json:"points"`
}

Stream is a unique metric stream: namespace, compartment, name, resource group and dimensions.

type StreamPublisher

type StreamPublisher func(ctx context.Context, streamID string, value []byte) error

StreamPublisher puts one alarm message on a Streaming stream.

type SummarizeIn

type SummarizeIn struct {
	StartTime     *time.Time `json:"startTime"`
	EndTime       *time.Time `json:"endTime"`
	ResourceGroup *string    `json:"resourceGroup"`
	Namespace     string     `json:"namespace"`
	Query         string     `json:"query"`
	Resolution    string     `json:"resolution"`
	Subtree       bool       `json:"-"`
}

SummarizeIn is the SummarizeMetricsData request body.

type SuppressionCond

type SuppressionCond struct {
	Type       string `json:"type"`
	Recurrence string `json:"recurrence"`
	Duration   string `json:"duration"`
}

SuppressionCond is one precondition of an alarm suppression; only RECURRENCE exists.

type SuppressionFilter

type SuppressionFilter struct {
	AlarmID, Name, State, Level, Compartment, TargetType string
	Subtree, All                                         bool
}

SuppressionFilter narrows ListAlarmSuppressions.

type SuppressionHistoryIn

type SuppressionHistoryIn struct {
	Dimensions map[string]string `json:"dimensions"`
	From       *time.Time        `json:"timeSuppressFromGreaterThanOrEqualTo"`
	Before     *time.Time        `json:"timeSuppressFromLessThan"`
}

SuppressionHistoryIn is the SummarizeAlarmSuppressionHistory request body.

type SuppressionHistoryItemWire

type SuppressionHistoryItemWire struct {
	TimeEffectiveFrom  time.Time             `json:"timeEffectiveFrom"`
	TimeEffectiveUntil time.Time             `json:"timeEffectiveUntil"`
	Target             suppressionTargetWire `json:"alarmSuppressionTarget"`
	Dimensions         map[string]string     `json:"dimensions,omitempty"`
	SuppressionID      string                `json:"suppressionId"`
	Level              string                `json:"level"`
	DisplayName        string                `json:"displayName"`
	Description        *string               `json:"description,omitempty"`
	Conditions         []suppressionCondWire `json:"suppressionConditions,omitempty"`
}

SuppressionHistoryItemWire is one AlarmSuppressionHistoryItem.

type SuppressionSpec

type SuppressionSpec struct {
	From        time.Time `json:"timeSuppressFrom"`
	Until       time.Time `json:"timeSuppressUntil"`
	Description string    `json:"description,omitempty"`
}

SuppressionSpec is the alarm suppression window.

type SuppressionWire

type SuppressionWire struct {
	TimeSuppressFrom  time.Time `json:"timeSuppressFrom"`
	TimeSuppressUntil time.Time `json:"timeSuppressUntil"`
	Description       string    `json:"description,omitempty"`
}

SuppressionWire is the alarm suppression window.

type Tags

type Tags struct {
	FreeformTags map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags  map[string]map[string]any `json:"definedTags,omitempty"`
}

Tags are the shared freeform and defined tag sets of a resource.

type TopicChecker

type TopicChecker func(topicID string) bool

TopicChecker reports whether a Notifications topic exists.

type UpdateAlarmIn

type UpdateAlarmIn struct {
	Tags
	Name          *string          `json:"displayName"`
	Compartment   *string          `json:"compartmentId"`
	MetricComp    *string          `json:"metricCompartmentId"`
	InSubtree     *bool            `json:"metricCompartmentIdInSubtree"`
	Namespace     *string          `json:"namespace"`
	ResourceGroup *string          `json:"resourceGroup"`
	Query         *string          `json:"query"`
	Resolution    *string          `json:"resolution"`
	Pending       *string          `json:"pendingDuration"`
	Severity      *string          `json:"severity"`
	Body          *string          `json:"body"`
	PerDimension  *bool            `json:"isNotificationsPerMetricDimensionEnabled"`
	MessageFormat *string          `json:"messageFormat"`
	Destinations  []string         `json:"destinations"`
	Repeat        *string          `json:"repeatNotificationDuration"`
	Suppression   *SuppressionWire `json:"suppression"`
	Enabled       *bool            `json:"isEnabled"`
	RuleName      *string          `json:"ruleName"`
	NotifVersion  *string          `json:"notificationVersion"`
	NotifTitle    *string          `json:"notificationTitle"`
	EvalSlack     *string          `json:"evaluationSlackDuration"`
	AlarmSummary  *string          `json:"alarmSummary"`
	Overrides     []jsontext.Value `json:"overrides"`
}

UpdateAlarmIn is the UpdateAlarm request body.

Jump to

Keyboard shortcuts

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