Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPayloadFormatter = PayloadFormatterFunc(func(_ string, payload []byte) string { return string(payload) if !isPrintable(payload) { return "non-printable bytes" } return string(payload) })
DefaultPayloadFormatter is the PayloadFormater used by default. It prints the given payload bytes as is if the bytes are printable, otherwise it prints a message to indicate that the bytes are not printable.
var DefaultResultFormatter = ResultFormatterFunc(func(_ string, result []byte) string { if len(result) == 0 { return "" } if !isPrintable(result) { return "non-printable bytes" } return string(result) })
DefaultResultFormatter is the ResultFormatter used by default. It prints the given result bytes as is if the bytes are printable, otherwise it prints a message to indicate that the bytes are not printable.
Functions ¶
This section is empty.
Types ¶
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
HTTPHandler is a http.Handler for asynqmon application.
func (*HTTPHandler) RootPath ¶
func (h *HTTPHandler) RootPath() string
RootPath returns the root URL path used for asynqmon application. Returned path string does not have the trailing slash.
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Options ¶
type Options struct {
// URL path the handler is responsible for.
// The path is used for the homepage of asynqmon, and every other page is rooted in this subtree.
//
// This field is optional. Default is "/".
RootPath string
// RedisConnOpt specifies the connection to a redis-server or redis-cluster.
//
// This field is required.
ConnOpt *database2.Queries
// PayloadFormatter is used to convert payload bytes to string shown in the UI.
//
// This field is optional.
PayloadFormatter PayloadFormatter
// ResultFormatter is used to convert result bytes to string shown in the UI.
//
// This field is optional.
ResultFormatter ResultFormatter
// PrometheusAddress specifies the address of the Prometheus to connect to.
//
// This field is optional. If this field is set, asynqmon will query the Prometheus server
// to get the time series data about queue metrics and show them in the web UI.
PrometheusAddress string
// Set ReadOnly to true to restrict user to view-only mode.
ReadOnly bool
}
Options is used to configure HTTPHandler.
type PayloadFormatter ¶
type PayloadFormatter interface {
// FormatPayload takes the task's typename and payload and returns a string representation of the payload.
FormatPayload(taskType string, payload []byte) string
}
PayloadFormatter is used to convert payload bytes to a string shown in the UI.
type PayloadFormatterFunc ¶
func (PayloadFormatterFunc) FormatPayload ¶
func (f PayloadFormatterFunc) FormatPayload(taskType string, payload []byte) string
type ResultFormatter ¶
type ResultFormatter interface {
// FormatResult takes the task's typename and result and returns a string representation of the result.
FormatResult(taskType string, result []byte) string
}
ResultFormatter is used to convert result bytes to a string shown in the UI.
type ResultFormatterFunc ¶
func (ResultFormatterFunc) FormatResult ¶
func (f ResultFormatterFunc) FormatResult(taskType string, result []byte) string