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 ¶
- type AppMonitor
- type CreateMonitorInput
- type Destination
- type Event
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) BatchCreateRumMetricDefinitions(ctx context.Context, app, dest, destARN string, reqs []WireMetricRequest) ([]WireMetricDef, []WireCreateError, error)
- func (b *InMemoryBackend) BatchDeleteRumMetricDefinitions(ctx context.Context, app, dest, destARN string, ids []string) ([]string, []WireDeleteError, error)
- func (b *InMemoryBackend) BatchGetRumMetricDefinitions(ctx context.Context, app, dest, destARN, token string, maxResults int) (page.Page[WireMetricDef], error)
- func (b *InMemoryBackend) CreateAppMonitor(ctx context.Context, in CreateMonitorInput) (string, error)
- func (b *InMemoryBackend) DeleteAppMonitor(ctx context.Context, name string) error
- func (b *InMemoryBackend) DeleteResourcePolicy(ctx context.Context, name, revision string) (string, error)
- func (b *InMemoryBackend) DeleteRumMetricsDestination(ctx context.Context, app, dest, destARN string) error
- func (b *InMemoryBackend) GetAppMonitorData(ctx context.Context, name string, tr *TimeRange, filters []QueryFilter, ...) (page.Page[string], error)
- func (b *InMemoryBackend) GetResourcePolicy(ctx context.Context, name string) (string, string, error)
- func (b *InMemoryBackend) ListAppMonitors(ctx context.Context, token string, maxResults int) (page.Page[WireSummary], error)
- func (b *InMemoryBackend) ListRumMetricsDestinations(ctx context.Context, app, token string, maxResults int) (page.Page[WireDestination], error)
- func (b *InMemoryBackend) ListTagsForResource(ctx context.Context, resourceARN string) (map[string]string, error)
- func (b *InMemoryBackend) PutResourcePolicy(ctx context.Context, name, doc, revision string) (string, string, error)
- func (b *InMemoryBackend) PutRumEvents(ctx context.Context, in *PutEventsInput) error
- func (b *InMemoryBackend) PutRumMetricsDestination(ctx context.Context, app, dest, destARN, roleARN string) error
- func (b *InMemoryBackend) Region() string
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetLogSink(s LogSink)
- func (b *InMemoryBackend) SetMetricEmitter(e cwmetric.Emitter)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(ctx context.Context, resourceARN string, add map[string]string) error
- func (b *InMemoryBackend) UntagResource(ctx context.Context, resourceARN string, keys []string) error
- func (b *InMemoryBackend) UpdateAppMonitor(ctx context.Context, in UpdateMonitorInput) error
- func (b *InMemoryBackend) UpdateRumMetricDefinition(ctx context.Context, app, dest, destARN, id string, r WireMetricRequest) error
- type LogEvent
- type LogSink
- type MetricDef
- type MonitorConfig
- type Provider
- type PutEventsInput
- type QueryFilter
- type SourceMaps
- type TimeRange
- type UpdateMonitorInput
- type WireCreateError
- type WireDeleteError
- type WireDestination
- type WireMetricDef
- type WireMetricRequest
- type WireRumEvent
- type WireSummary
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 (*Handler) ChaosOperations ¶
ChaosOperations lists the fault-injectable operations.
func (*Handler) ChaosRegions ¶
ChaosRegions lists the regions this handler serves.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase service name for fault rules.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns the app monitor name or ID for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists every routed operation.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher matches signed "rum" requests (or the SDK user agent) with a known path shape.
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) 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 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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler.
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 ¶
QueryFilter is the QueryFilter structure of GetAppMonitorData.
type SourceMaps ¶
SourceMaps is the JavaScript source map deobfuscation setting.
type TimeRange ¶
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.