package module
v0.0.0-...-845b2cd Latest Latest

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 13 Imported by: 0


KrakenD opencensus

A set of building blocks for instrumenting KakenD gateways

Available middlewares

There are the avaliable middlewares to add to the KrakenD pipes.

  1. Backend
  2. Proxy
  3. Router

Available router flavours

  1. mux Mux based routers and handlers
  2. gin Gin based routers and handlers

Check the examples and the documentation for more details




View Source
const (
	ContextKey = "opencensus-request-span"
	Namespace  = "github_com/devopsfaith/krakend-opencensus"



func BackendFactory

func BackendFactory(bf proxy.BackendFactory) proxy.BackendFactory

func HTTPRequestExecutor

func HTTPRequestExecutor(clientFactory transport.HTTPClientFactory) transport.HTTPRequestExecutor

func IsBackendEnabled

func IsBackendEnabled() bool

func IsPipeEnabled

func IsPipeEnabled() bool

func IsRouterEnabled

func IsRouterEnabled() bool

func Middleware

func Middleware(name string) proxy.Middleware

func NewHTTPClient

func NewHTTPClient(ctx context.Context) *http.Client

func ProxyFactory

func ProxyFactory(pf proxy.Factory) proxy.FactoryFunc

func Register

func Register(ctx context.Context, srvCfg config.ServiceConfig, vs ...*view.View) error

func RegisterExporterFactories

func RegisterExporterFactories(ef ExporterFactory)


type Config

type Config struct {
	SampleRate      int            `json:"sample_rate"`
	ReportingPeriod int            `json:"reporting_period"`
	EnabledLayers   *EnabledLayers `json:"enabled_layers"`
	Exporters       struct {
		InfluxDB *struct {
			Address      string `json:"address"`
			Username     string `json:"username"`
			Password     string `json:"password"`
			Timeout      string `json:"timeout"`
			PingEnabled  bool   `json:"ping"`
			Database     string `json:"db"`
			InstanceName string `json:"service_name"`
			BufferSize   int    `json:"buffer_size"`
		} `json:"influxdb"`
		Zipkin *struct {
			CollectorURL string `json:"collector_url"`
			ServiceName  string `json:"service_name"`
			IP           string `json:"ip"`
			Port         int    `json:"port"`
		} `json:"zipkin"`
		Jaeger *struct {
			Endpoint    string `json:"endpoint"`
			ServiceName string `json:"service_name"`
		} `json:"jaeger"`
		Prometheus *struct {
			Namespace string `json:"namespace"`
			Port      int    `json:"port"`
		} `json:"prometheus"`
		Logger *struct{} `json:"logger"`
		Xray   *struct {
			UseEnv    bool   `json:"use_env"`
			Region    string `json:"region"`
			AccessKey string `json:"access_key_id"`
			SecretKey string `json:"secret_access_key"`
			Version   string `json:"version"`
		} `json:"xray"`
		Stackdriver *struct {
			ProjectID     string            `json:"project_id"`
			MetricPrefix  string            `json:"metric_prefix"`
			DefaultLabels map[string]string `json:"default_labels"`
		} `json:"stackdriver"`
	} `json:"exporters"`

type EnabledLayers

type EnabledLayers struct {
	Router  bool `json:"router"`
	Pipe    bool `json:"pipe"`
	Backend bool `json:"backend"`

type ExporterFactory

type ExporterFactory func(context.Context, Config) (interface{}, error)


Path Synopsis

Jump to

Keyboard shortcuts

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