Documentation ¶
Index ¶
- func Wrap(h RequestHandler, logChannels LogChannels) http.Handler
- type CapturedEvent
- type Event
- type EventCapture
- type LogChannels
- type Metric
- type Option
- func AddHistogramBucketSpec(name string, buckets []float64) Option
- func Empty() Option
- func Named(systemName string, app string) Option
- func SendMetricsToAppInsights() Option
- func WithAppInsightsInstrumentationKey(instrumentationKey string) Option
- func WithAppInsightsSecretPath(path string, v vault.SecretsManager) Option
- func WithCapture(c EventCapture) Option
- func WithWriter(w io.Writer) Option
- type OptionsCollector
- type RequestHandler
- type RoundTrip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wrap ¶ added in v0.0.8
func Wrap(h RequestHandler, logChannels LogChannels) http.Handler
Wrap the handler so that it can be presented as http.Handler. The wrapper will automatically set the correct Prometheus metrics for each handled request.
Types ¶
type CapturedEvent ¶ added in v1.0.0
type CapturedEvent struct { // SinkType either AppInsights or Metric. SinkType string // Type Type string // Event is the actual event that would have been sent. Event interface{} }
CapturedEvent
type Event ¶
Event is raised when something interesting happens in the application. Consists of a name an a map of key/value pairs.
type EventCapture ¶ added in v1.0.0
type EventCapture interface {
Capture(*CapturedEvent)
}
EventCapture is able to capture events. This is mostly useful in testing scenarios when one wishes to verify that the expected events are logged.
type LogChannels ¶ added in v1.0.0
type LogChannels struct { // CountChan increases the named Prometheus counter. CountChan chan Metric // GaugeChan increases the named Prometheus gauge. GaugeChan chan Metric // HistogramChan observes the named Prometheus histogram. HistogramChan chan Metric // ErrorChan sends the error to Application Insights. ErrorChan chan error // EventChan sends the event to Application Insights. EventChan chan Event // DebugChan prints a debug message to the console. DebugChan chan string }
LogChannels a set of channels used for communicating events, metrics, errors and other telemetry types to the logger.
type Option ¶ added in v0.0.9
type Option func(*OptionsCollector)
Option specifies options for configuring the logging.
func AddHistogramBucketSpec ¶ added in v1.0.0
AddHistogramBucketSpec is used to specify which Prometheus histogram buckets to use for the histogram with the given name. Each element in the slice is the upper inclusive bound of a bucket.
func Empty ¶ added in v1.0.0
func Empty() Option
Empty if used logs will not be sent to application insights, and also not to Prometheus.
func Named ¶ added in v1.0.0
Named lets clients set the name of the system and application. This value will be included in all logs.
func SendMetricsToAppInsights ¶ added in v1.0.0
func SendMetricsToAppInsights() Option
SendMetricsToAppInsights will send metrics to Application Insights (as well as registering it as a Prometheus metric.
func WithAppInsightsInstrumentationKey ¶ added in v1.0.0
WithAppInsightsInstrumentationKey sets the instrumentation key for application insights directly.
func WithAppInsightsSecretPath ¶ added in v1.0.0
func WithAppInsightsSecretPath(path string, v vault.SecretsManager) Option
WithAppInsightsSecretPath lets clients set the Vault path to the secret containing the instrumentation key needed in order to write logs to application insights.
func WithCapture ¶ added in v1.0.0
func WithCapture(c EventCapture) Option
WithCapture all event of all types are sent to this instance if set. This feature is mostly intended for testing purposes.
func WithWriter ¶ added in v0.0.9
WithWriter lets clients set a writer which will receive logging events (in addition to the events being written to the standard destinations).
type OptionsCollector ¶ added in v0.0.9
type OptionsCollector struct {
// contains filtered or unexported fields
}
OptionsCollector collects all options before they are set.
type RequestHandler ¶ added in v0.0.8
RequestHandler the instance that is responsible for the business logic to be performed as a result of the incoming http request. Clients wishing t