opencensus

package
v0.0.0-...-2537f40 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKey = "opencensus-request-span"
	Namespace  = "github.com/starvn/sonic/telemetry/opencensus"
)

Variables

Functions

func BackendFactory

func BackendFactory(bf proxy.BackendFactory) proxy.BackendFactory

func GetAggregatedPathForBackendMetrics

func GetAggregatedPathForBackendMetrics(cfg *config.Backend) func(r *http.Request) string

func GetAggregatedPathForMetrics

func GetAggregatedPathForMetrics(cfg *config.EndpointConfig) func(r *http.Request) string

func HTTPRequestExecutor

func HTTPRequestExecutor(clientFactory transport.HTTPClientFactory) transport.HTTPRequestExecutor

func HTTPRequestExecutorFromConfig

func HTTPRequestExecutorFromConfig(clientFactory transport.HTTPClientFactory, cfg *config.Backend) 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)

func RequestAttrs

func RequestAttrs(r *http.Request) []trace.Attribute

func ResponseAttrs

func ResponseAttrs(resp *http.Response) []trace.Attribute

func SpanNameFromURL

func SpanNameFromURL(req *http.Request) string

func TraceStatus

func TraceStatus(httpStatusCode int, statusLine string) trace.Status

Types

type Config

type Config struct {
	SampleRate      int            `json:"sample_rate"`
	ReportingPeriod int            `json:"reporting_period"`
	EnabledLayers   *EnabledLayers `json:"enabled_layers"`
	Exporters       Exporters      `json:"exporters"`
}

type DataDogConfig

type DataDogConfig struct {
	Namespace              string                 `json:"namespace"`
	Service                string                 `json:"service"`
	TraceAddr              string                 `json:"trace_address"`
	StatsAddr              string                 `json:"stats_address"`
	Tags                   []string               `json:"tags"`
	GlobalTags             map[string]interface{} `json:"global_tags"`
	DisableCountPerBuckets bool                   `json:"disable_count_per_buckets"`
}

type EnabledLayers

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

type EndpointExtraConfig

type EndpointExtraConfig struct {
	PathAggregation string `json:"path_aggregation"`
}

type ExporterFactory

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

type Exporters

type Exporters struct {
	InfluxDB    *InfluxDBConfig    `json:"influxdb"`
	Zipkin      *ZipkinConfig      `json:"zipkin"`
	Jaeger      *JaegerConfig      `json:"jaeger"`
	Prometheus  *PrometheusConfig  `json:"prometheus"`
	Logger      *struct{}          `json:"logger"`
	Xray        *XrayConfig        `json:"xray"`
	Stackdriver *StackdriverConfig `json:"stackdriver"`
	Ocagent     *OcagentConfig     `json:"ocagent"`
	DataDog     *DataDogConfig     `json:"datadog"`
	ExtraConfig config.ExtraConfig `json:"extra_config"`
}

type InfluxDBConfig

type InfluxDBConfig 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"`
}

type JaegerConfig

type JaegerConfig struct {
	Endpoint       string `json:"endpoint"`
	ServiceName    string `json:"service_name"`
	BufferMaxCount int    `json:"buffer_max_count"`
}

type OcagentConfig

type OcagentConfig struct {
	Address            string            `json:"address"`
	ServiceName        string            `json:"service_name"`
	Headers            map[string]string `json:"headers"`
	Insecure           bool              `json:"insecure"`
	Reconnection       string            `json:"reconnection"`
	EnaableCompression bool              `json:"enable_compression"`
}

type PrometheusConfig

type PrometheusConfig struct {
	Namespace     string `json:"namespace"`
	Port          int    `json:"port"`
	HostTag       bool   `json:"tag_host"`
	PathTag       bool   `json:"tag_path"`
	MethodTag     bool   `json:"tag_method"`
	StatusCodeTag bool   `json:"tag_statuscode"`
}

type StackdriverConfig

type StackdriverConfig struct {
	ProjectID     string            `json:"project_id"`
	MetricPrefix  string            `json:"metric_prefix"`
	DefaultLabels map[string]string `json:"default_labels"`
}

type Transport

type Transport struct {
	Base            http.RoundTripper
	Propagation     propagation.HTTPFormat
	StartOptions    trace.StartOptions
	GetStartOptions func(*http.Request) trace.StartOptions
	FormatSpanName  func(*http.Request) string
	NewClientTrace  func(*http.Request, *trace.Span) *httptrace.ClientTrace
	// contains filtered or unexported fields
}

func (*Transport) CancelRequest

func (t *Transport) CancelRequest(req *http.Request)

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

type XrayConfig

type XrayConfig 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"`
}

type ZipkinConfig

type ZipkinConfig struct {
	CollectorURL string `json:"collector_url"`
	ServiceName  string `json:"service_name"`
	IP           string `json:"ip"`
	Port         int    `json:"port"`
}

Directories

Path Synopsis
exporter
router
gin
mux

Jump to

Keyboard shortcuts

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