Documentation
¶
Index ¶
Constants ¶
View Source
const ( WebsocketNotificationReceiptTimeMetric = "notification_websocket_receipt_time" SMTPNotificationReceiptTimeMetric = "notification_smtp_receipt_time" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SessionToken authenticates the runner as PreCreatedUser.
SessionToken string `json:"-"`
// PreCreatedUser is the existing user to run as. It must already hold any
// role needed to receive the notifications under test. Only ID, Username and
// Email are used.
PreCreatedUser codersdk.User `json:"-"`
// NotificationTimeout is how long to wait for notifications after triggering.
NotificationTimeout time.Duration `json:"notification_timeout"`
// DialTimeout is how long to wait for websocket connection.
DialTimeout time.Duration `json:"dial_timeout"`
// IsTemplateAdmin marks a runner that watches for and counts notifications.
// Regular users leave it false and only hold a websocket connection open.
IsTemplateAdmin bool `json:"-"`
// ExpectedDeletions is how many TemplateTemplateDeleted notifications a
// template admin waits for (one per template deletion). It is ignored unless
// IsTemplateAdmin is set, in which case it must be at least 1.
ExpectedDeletions int `json:"-"`
Metrics *Metrics `json:"-"`
// DialBarrier ensures all runners are connected before notifications are triggered.
DialBarrier *sync.WaitGroup `json:"-"`
// ReceivingWatchBarrier is the barrier for receiving users. Regular users wait on this to disconnect after receiving users complete.
ReceivingWatchBarrier *sync.WaitGroup `json:"-"`
// SMTPApiUrl is the URL of the SMTP mock HTTP API
SMTPApiURL string `json:"smtp_api_url"`
// SMTPRequestTimeout is the timeout for SMTP requests.
SMTPRequestTimeout time.Duration `json:"smtp_request_timeout"`
// SMTPHttpClient is the HTTP client for SMTP requests.
SMTPHttpClient *http.Client `json:"-"`
}
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(reg prometheus.Registerer) *Metrics
func (*Metrics) RecordLatency ¶
func (m *Metrics) RecordLatency(latency time.Duration, notificationID string, notificationType NotificationType)
type NotificationType ¶
type NotificationType string
const ( NotificationTypeWebsocket NotificationType = "websocket" NotificationTypeSMTP NotificationType = "smtp" )
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) GetMetrics ¶
Click to show internal directories.
Click to hide internal directories.