Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Data interface{} `json:"data"` When int64 `json:"when"` // unix timestamp }
Event is a single event.
type HttpMonitoring ¶
type HttpMonitoring struct {
// contains filtered or unexported fields
}
The monitoring server with API to add events.
func NewHttpMonitoring ¶
func NewHttpMonitoring(config HttpMonitoringConfig, logger log.Logger) (*HttpMonitoring, error)
func (*HttpMonitoring) AddEvent ¶
func (m *HttpMonitoring) AddEvent(name string, value interface{}) error
AddEvent adds an event with the current timestamp. It overwrites the previous event of the same name (if existing).
func (*HttpMonitoring) GetEvent ¶
func (m *HttpMonitoring) GetEvent(name string) *Event
GetEvent returns a registered event value.
func (*HttpMonitoring) ListenHttp ¶
func (m *HttpMonitoring) ListenHttp(ctx context.Context) error
Starts to serve monitoring data on the configured address. This call is blocking.
func (*HttpMonitoring) ServeHTTP ¶
func (m *HttpMonitoring) ServeHTTP(writer http.ResponseWriter, req *http.Request)
Respond with monitoring data to an HTTP request. Only needed if you want to integrate the monitoring package into another HTTP server (instead of calling HttpMonitoring.ListenHttp() ).
type HttpMonitoringConfig ¶
type MonitoringHttpResponse ¶
Click to show internal directories.
Click to hide internal directories.