rum

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 28 Imported by: 0

README

Rum

Parity grade: B · SDK aws-sdk-go-v2/service/rum@v1.38.4 · last audited 2026-10-18 (acf0513c8)

Coverage

Metric Value
PARITY entries audited 20 (20 ok)
Feature families 3 (3 ok)
Known gaps 9
Structural gaps (can't be emulated) 2
Deferred items 0
Resource leaks clean
Known gaps
  • Evidently destinations: destinations and their metric definitions are stored but no events are published to Evidently (no Evidently service)
  • PutRumEvents: the app monitor resource policy and its rum:alias condition are stored but not enforced
  • DeobfuscationConfiguration: source map settings are stored; stack traces are never unminified
  • Default metrics: Telemetries (errors, performance, http) do not gate the default metric set
  • BatchCreateRumMetricDefinitions: the per-item ErrorCode values (ValidationException, ServiceQuotaExceededException) are assumptions, the SDK does not enumerate them
  • GetAppMonitorData: the TimeRange unit is not stated by the SDK; seconds and milliseconds are both accepted
  • AccessDeniedException and ThrottlingException: never raised; no IAM or throttling is modeled
  • ResourceGroupsTaggingAPI: app monitor tags are not exposed through the tagging API
  • CloudFormation: AWS::RUM::AppMonitor is not provisioned by the CloudFormation emulator
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • Country filter and CountryCode dimension: the service derives countryCode from the sender IP, there is no GeoIP source; only a countryCode already present in event metadata matches
  • Cognito authorization of PutRumEvents: guest-role credentials from an identity pool cannot be issued here, so any signed caller may send events

More

Documentation

Overview

Package rum emulates Amazon CloudWatch RUM: app monitors, the PutRumEvents data plane, raw event queries, metric destinations and definitions, resource policies and tags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMonitor

type AppMonitor struct {
	Created        time.Time         `json:"created"`
	LastModified   time.Time         `json:"lastModified"`
	Tags           map[string]string `json:"tags"`
	Config         *MonitorConfig    `json:"config,omitempty"`
	SourceMaps     *SourceMaps       `json:"sourceMaps,omitempty"`
	ID             string            `json:"id"`
	Name           string            `json:"name"`
	Account        string            `json:"account"`
	Region         string            `json:"region"`
	Platform       string            `json:"platform"`
	Domain         string            `json:"domain,omitempty"`
	CustomEvents   string            `json:"customEvents"`
	Policy         string            `json:"policy,omitempty"`
	PolicyRevision string            `json:"policyRevision,omitempty"`
	DomainList     []string          `json:"domainList,omitempty"`
	CwLogEnabled   bool              `json:"cwLogEnabled"`
	Active         bool              `json:"active"`
}

AppMonitor is a stored CloudWatch RUM app monitor.

type CreateMonitorInput

type CreateMonitorInput struct {
	Config       *MonitorConfig
	CustomEvents *wireCustomEvents
	SourceMaps   *wireSourceMaps
	Tags         map[string]string
	CwLogEnabled *bool
	Name         string
	Platform     string
	Domain       string
	DomainList   []string
}

CreateMonitorInput holds CreateAppMonitor parameters.

type Destination

type Destination struct {
	AppID          string `json:"appId"`
	Destination    string `json:"destination"`
	DestinationARN string `json:"destinationArn,omitempty"`
	IAMRoleARN     string `json:"iamRoleArn,omitempty"`
}

Destination is a metrics destination of one app monitor.

type Event

type Event struct {
	Key       string  `json:"key"`
	AppID     string  `json:"appId"`
	Raw       string  `json:"raw"`
	Type      string  `json:"type"`
	Browser   string  `json:"browser,omitempty"`
	Device    string  `json:"device,omitempty"`
	OS        string  `json:"os,omitempty"`
	Page      string  `json:"page,omitempty"`
	Country   string  `json:"country,omitempty"`
	Timestamp float64 `json:"timestamp"`
	Seq       int64   `json:"seq"`
}

Event is one stored RUM telemetry event.

type Handler

type Handler struct {
	Backend *InMemoryBackend
	// contains filtered or unexported fields
}

Handler serves the CloudWatch RUM REST-JSON control and data plane.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

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

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

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

ChaosRegions lists the regions this handler serves.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

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 app monitor name or ID for metrics.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations lists every routed operation.

func (*Handler) Handler

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

Handler returns the Echo handler.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

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

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

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

RouteMatcher matches signed "rum" requests (or the SDK user agent) with a known path shape.

func (*Handler) Snapshot

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

Snapshot implements persistence.Persistable.

type InMemoryBackend

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

InMemoryBackend is the RUM state; one coarse lock guards every table.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) BatchCreateRumMetricDefinitions

func (b *InMemoryBackend) BatchCreateRumMetricDefinitions(
	ctx context.Context, app, dest, destARN string, reqs []WireMetricRequest,
) ([]WireMetricDef, []WireCreateError, error)

BatchCreateRumMetricDefinitions creates the valid definitions and reports the rest as errors.

func (*InMemoryBackend) BatchDeleteRumMetricDefinitions

func (b *InMemoryBackend) BatchDeleteRumMetricDefinitions(
	ctx context.Context, app, dest, destARN string, ids []string,
) ([]string, []WireDeleteError, error)

BatchDeleteRumMetricDefinitions deletes the definitions that exist and reports the rest as errors.

func (*InMemoryBackend) BatchGetRumMetricDefinitions

func (b *InMemoryBackend) BatchGetRumMetricDefinitions(
	ctx context.Context, app, dest, destARN, token string, maxResults int,
) (page.Page[WireMetricDef], error)

BatchGetRumMetricDefinitions pages the definitions of one destination.

func (*InMemoryBackend) CreateAppMonitor

func (b *InMemoryBackend) CreateAppMonitor(ctx context.Context, in CreateMonitorInput) (string, error)

CreateAppMonitor creates an app monitor and returns its ID.

func (*InMemoryBackend) DeleteAppMonitor

func (b *InMemoryBackend) DeleteAppMonitor(ctx context.Context, name string) error

DeleteAppMonitor removes an app monitor with its events, destinations and metric definitions.

func (*InMemoryBackend) DeleteResourcePolicy

func (b *InMemoryBackend) DeleteResourcePolicy(ctx context.Context, name, revision string) (string, error)

DeleteResourcePolicy removes the policy and returns the revision that was deleted.

func (*InMemoryBackend) DeleteRumMetricsDestination

func (b *InMemoryBackend) DeleteRumMetricsDestination(ctx context.Context, app, dest, destARN string) error

DeleteRumMetricsDestination removes a destination and the metric definitions sent to it.

func (*InMemoryBackend) GetAppMonitorData

func (b *InMemoryBackend) GetAppMonitorData(
	ctx context.Context, name string, tr *TimeRange, filters []QueryFilter, token string, maxResults int,
) (page.Page[string], error)

GetAppMonitorData returns the stored raw events within the time range that match every filter.

func (*InMemoryBackend) GetResourcePolicy

func (b *InMemoryBackend) GetResourcePolicy(ctx context.Context, name string) (string, string, error)

GetResourcePolicy returns the policy and revision of an app monitor.

func (*InMemoryBackend) ListAppMonitors

func (b *InMemoryBackend) ListAppMonitors(
	ctx context.Context, token string, maxResults int,
) (page.Page[WireSummary], error)

ListAppMonitors pages the caller's app monitors.

func (*InMemoryBackend) ListRumMetricsDestinations

func (b *InMemoryBackend) ListRumMetricsDestinations(
	ctx context.Context, app, token string, maxResults int,
) (page.Page[WireDestination], error)

ListRumMetricsDestinations pages the destinations of an app monitor.

func (*InMemoryBackend) ListTagsForResource

func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resourceARN string) (map[string]string, error)

ListTagsForResource returns the tags of an app monitor.

func (*InMemoryBackend) PutResourcePolicy

func (b *InMemoryBackend) PutResourcePolicy(
	ctx context.Context, name, doc, revision string,
) (string, string, error)

PutResourcePolicy attaches or replaces the resource policy of an app monitor.

func (*InMemoryBackend) PutRumEvents

func (b *InMemoryBackend) PutRumEvents(ctx context.Context, in *PutEventsInput) error

PutRumEvents validates and stores a batch of events, then forwards it to CloudWatch Logs and metrics.

func (*InMemoryBackend) PutRumMetricsDestination

func (b *InMemoryBackend) PutRumMetricsDestination(ctx context.Context, app, dest, destARN, roleARN string) error

PutRumMetricsDestination creates or updates a metrics destination.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the default region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every table.

func (*InMemoryBackend) Restore

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

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) SetLogSink

func (b *InMemoryBackend) SetLogSink(s LogSink)

SetLogSink wires CloudWatch Logs delivery for app monitors with CwLogEnabled.

func (*InMemoryBackend) SetMetricEmitter

func (b *InMemoryBackend) SetMetricEmitter(e cwmetric.Emitter)

SetMetricEmitter wires CloudWatch metric delivery for default and custom metrics.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(ctx context.Context, resourceARN string, add map[string]string) error

TagResource adds or replaces tags on an app monitor.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceARN string, keys []string) error

UntagResource removes tags by key.

func (*InMemoryBackend) UpdateAppMonitor

func (b *InMemoryBackend) UpdateAppMonitor(ctx context.Context, in UpdateMonitorInput) error

UpdateAppMonitor changes the supplied parts of an app monitor.

func (*InMemoryBackend) UpdateRumMetricDefinition

func (b *InMemoryBackend) UpdateRumMetricDefinition(
	ctx context.Context, app, dest, destARN, id string, r WireMetricRequest,
) error

UpdateRumMetricDefinition replaces one metric definition.

type LogEvent

type LogEvent struct {
	Message   string
	Timestamp int64
}

LogEvent is one record written to a CloudWatch Logs stream.

type LogSink

type LogSink interface {
	EnsureLogGroup(ctx context.Context, region, group string) error
	PutLogEvents(ctx context.Context, region, group, stream string, events []LogEvent) error
}

LogSink delivers RUM events to CloudWatch Logs when an app monitor has CwLogEnabled.

type MetricDef

type MetricDef struct {
	DimensionKeys  map[string]string `json:"dimensionKeys,omitempty"`
	ID             string            `json:"id"`
	AppID          string            `json:"appId"`
	Destination    string            `json:"destination"`
	DestinationARN string            `json:"destinationArn,omitempty"`
	Name           string            `json:"name"`
	Namespace      string            `json:"namespace,omitempty"`
	EventPattern   string            `json:"eventPattern,omitempty"`
	UnitLabel      string            `json:"unitLabel,omitempty"`
	ValueKey       string            `json:"valueKey,omitempty"`
	Order          int64             `json:"order"`
}

MetricDef is an extended or custom metric definition.

type MonitorConfig

type MonitorConfig struct {
	GuestRoleArn      *string  `json:"GuestRoleArn,omitempty"`
	IdentityPoolID    *string  `json:"IdentityPoolId,omitempty"`
	AllowCookies      *bool    `json:"AllowCookies,omitempty"`
	EnableXRay        *bool    `json:"EnableXRay,omitempty"`
	ExcludedPages     []string `json:"ExcludedPages,omitempty"`
	FavoritePages     []string `json:"FavoritePages,omitempty"`
	IncludedPages     []string `json:"IncludedPages,omitempty"`
	Telemetries       []string `json:"Telemetries,omitempty"`
	SessionSampleRate float64  `json:"SessionSampleRate"`
}

MonitorConfig is the AppMonitorConfiguration structure.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon CloudWatch RUM.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type PutEventsInput

type PutEventsInput struct {
	AppMonitorDetails *struct {
		ID      string `json:"id"`
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"AppMonitorDetails"`
	UserDetails *struct {
		SessionID string `json:"sessionId"`
		UserID    string `json:"userId"`
	} `json:"UserDetails"`
	BatchID   string         `json:"BatchId"`
	Alias     string         `json:"Alias"`
	AppID     string         `json:"-"`
	RumEvents []WireRumEvent `json:"RumEvents"`
}

PutEventsInput holds PutRumEvents parameters.

type QueryFilter

type QueryFilter struct {
	Name   string   `json:"Name"`
	Values []string `json:"Values"`
}

QueryFilter is the QueryFilter structure of GetAppMonitorData.

type SourceMaps

type SourceMaps struct {
	Status string `json:"Status"`
	S3URI  string `json:"S3Uri,omitempty"`
}

SourceMaps is the JavaScript source map deobfuscation setting.

type TimeRange

type TimeRange struct {
	After  int64 `json:"After"`
	Before int64 `json:"Before"`
}

TimeRange is the TimeRange structure; values are epoch seconds, or milliseconds when above 1e11.

type UpdateMonitorInput

type UpdateMonitorInput struct {
	Config       *MonitorConfig
	CustomEvents *wireCustomEvents
	SourceMaps   *wireSourceMaps
	CwLogEnabled *bool
	Name         string
	Domain       string
	DomainList   []string
}

UpdateMonitorInput holds UpdateAppMonitor parameters; nil fields are unchanged.

type WireCreateError

type WireCreateError struct {
	MetricDefinition WireMetricRequest `json:"MetricDefinition"`
	ErrorCode        string            `json:"ErrorCode"`
	ErrorMessage     string            `json:"ErrorMessage"`
}

WireCreateError reports one metric definition rejected by BatchCreateRumMetricDefinitions.

type WireDeleteError

type WireDeleteError struct {
	MetricDefinitionID string `json:"MetricDefinitionId"`
	ErrorCode          string `json:"ErrorCode"`
	ErrorMessage       string `json:"ErrorMessage"`
}

WireDeleteError reports one metric definition ID rejected by BatchDeleteRumMetricDefinitions.

type WireDestination

type WireDestination struct {
	Destination    string `json:"Destination"`
	DestinationARN string `json:"DestinationArn,omitempty"`
	IAMRoleARN     string `json:"IamRoleArn,omitempty"`
}

WireDestination is the MetricDestinationSummary structure.

type WireMetricDef

type WireMetricDef struct {
	DimensionKeys      map[string]string `json:"DimensionKeys,omitempty"`
	MetricDefinitionID string            `json:"MetricDefinitionId"`
	Name               string            `json:"Name"`
	EventPattern       string            `json:"EventPattern,omitempty"`
	Namespace          string            `json:"Namespace,omitempty"`
	UnitLabel          string            `json:"UnitLabel,omitempty"`
	ValueKey           string            `json:"ValueKey,omitempty"`
}

WireMetricDef is the MetricDefinition structure.

type WireMetricRequest

type WireMetricRequest struct {
	DimensionKeys map[string]string `json:"DimensionKeys,omitempty"`
	Name          string            `json:"Name"`
	EventPattern  string            `json:"EventPattern,omitempty"`
	Namespace     string            `json:"Namespace,omitempty"`
	UnitLabel     string            `json:"UnitLabel,omitempty"`
	ValueKey      string            `json:"ValueKey,omitempty"`
}

WireMetricRequest is the MetricDefinitionRequest structure.

type WireRumEvent

type WireRumEvent struct {
	Details   string  `json:"details"`
	ID        string  `json:"id"`
	Metadata  string  `json:"metadata"`
	Type      string  `json:"type"`
	Timestamp float64 `json:"timestamp"`
}

WireRumEvent is one event of PutRumEvents.

type WireSummary

type WireSummary struct {
	Created      string `json:"Created"`
	ID           string `json:"Id"`
	LastModified string `json:"LastModified"`
	Name         string `json:"Name"`
	Platform     string `json:"Platform"`
	State        string `json:"State"`
}

WireSummary is an entry of ListAppMonitors.

Jump to

Keyboard shortcuts

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