webhooks

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CtxSecretTokenKey = "secret_token"
View Source
const (
	SignatureHeader = "X-VS-Signature"
)

Variables

View Source
var (
	EventStartCount = stats.Int64(
		"webhooks/event/start/total",
		"Number of events started",
		stats.UnitDimensionless,
	)

	EventStartCountView = &view.View{
		Name:        "webhooks/event/start/total",
		Description: "Number of events started",
		TagKeys:     []tag.Key{eventSource, eventType},
		Measure:     EventStartCount,
		Aggregation: view.Count(),
	}

	// Counts all end events
	// Timings may not be available due to what some EventSources expose through
	// their APIs, and/or start event may not be present in the span store.
	// Because of this keep track of all event end requests.
	EventEndCount = stats.Int64(
		"webhooks/event/end/total",
		"Number of events ended",
		stats.UnitDimensionless,
	)

	EventEndCountView = &view.View{
		Name:        "webhooks/event/end/total",
		Description: "Number of events started",
		TagKeys:     []tag.Key{eventSource, eventType, eventErr},
		Measure:     EventEndCount,
		Aggregation: view.Count(),
	}

	EventLatencyMs = stats.Float64(
		"webhooks/event/duration",
		"The latency in milliseconds",
		"ms",
	)

	EventLatencyView = &view.View{
		Name:        "webhooks/event/duration",
		Description: "Duration of events",
		TagKeys:     []tag.Key{eventSource, eventType, eventErr},
		Measure:     EventLatencyMs,
		Aggregation: view.Distribution(
			0,
			1.8e+6,
			3.6e+6,
			1.08e+7,
			2.16e+7,
			4.32e+7,
			8.64e+7,
			2.592e+8,
			6.048e+8,
			1.21e+9,
			1.814e+9,
			2.628e+9,
		),
	}
)

Functions

This section is empty.

Types

type Tracers

type Tracers interface {
	RequestScoped(r *http.Request, es eventsources.EventSource) (opentracing.Tracer, io.Closer, error)
}

type Webhook

type Webhook struct {
	EventSource eventsources.EventSource
	Tracers     Tracers
	Spans       traces.SpanStore
}

func New

func New(
	es eventsources.EventSource,
	tracers Tracers,
	spans traces.SpanStore,
) (*Webhook, error)

func (*Webhook) Handler

func (wh *Webhook) Handler(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL