telemetry

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNoopTracer

func NewNoopTracer(name string) trace.Tracer

Types

type BytesMapAttributes

type BytesMapAttributes interface {
	Exec() []attribute.KeyValue
}

func UseBytesMapAttributes

func UseBytesMapAttributes(prefix string, bytesMap []byte, excludeKeys map[string]int8) BytesMapAttributes

type Exporter

type Exporter interface {
	traceSdk.SpanExporter

	Init() error
	SpanProcessorType() SpanProcessor
}

func NewDatadogExporterUseAgent

func NewDatadogExporterUseAgent(host, port string) Exporter

func NewDatadogExporterUseEndpointUrl

func NewDatadogExporterUseEndpointUrl(address string) Exporter

func NewExporterStandardGrpcWithCustomURL

func NewExporterStandardGrpcWithCustomURL(fullUrl string) Exporter

func NewExporterStandardWithCustomHost

func NewExporterStandardWithCustomHost(host string) Exporter

func NewExporterStandardWithCustomPath

func NewExporterStandardWithCustomPath(path string) Exporter

func NewExporterStandardWithCustomURL

func NewExporterStandardWithCustomURL(fullUrl string) Exporter

func NewZipkinExporter

func NewZipkinExporter(url, logName string) Exporter

type ExporterProvider

type ExporterProvider string
const (
	ExporterStandard ExporterProvider = "standard"
	ExporterZipkin   ExporterProvider = "zipkin"
	ExporterDatadog  ExporterProvider = "datadog"
)

func (ExporterProvider) String

func (t ExporterProvider) String() string

type Manager

type Manager interface {
	Init() error
	MustInit() Manager
	Enabled() bool
	Tracer() trace.Tracer

	// NewTracer returns a Tracer with the given name and options. If a Tracer for
	// the given name and options does not exist it is created, otherwise the
	// existing Tracer is returned.
	//
	// If name is empty, DefaultTracerName is used instead.
	//
	// This method is safe to be called concurrently.
	NewTracer(name string, opts ...trace.TracerOption) trace.Tracer

	// ForceFlush immediately exports all spans that have not yet been exported for
	// all the registered span processors.
	ForceFlush(ctx context.Context) error
	// Shutdown shuts down the span processors in the order they were registered.
	Shutdown(ctx context.Context) error
}

func NewNoop

func NewNoop() Manager

func NewTelemetryManager

func NewTelemetryManager(env, serviceName, serviceVersion string, enabled bool, exporters ...Exporter) Manager

type Metric

type Metric interface {
	MetricActions

	IncrSuccess(metricName string)
	IncrFail(metricName string, err error)
	DecrSuccess(metricName string)
	DecrFail(metricName string, err error)

	IncrHTTP(method, metricName string, httpStatusCode int)
	DecrHTTP(method, metricName string, httpStatusCode int)

	Incr(metricName string, tags []string)
	Decr(metricName string, tags []string)

	Key() string
	Name() string
	MustInit() Metric
}

Metric Interface. All methods SHOULD be safe for concurrent use.

func NewDatadogMetrics

func NewDatadogMetrics(key, name string, log logger.Manager, opts ...MetricOption[*metricDataDog]) Metric

type MetricActions

type MetricActions interface {
	Count(metricName string, value int64, tags []string)
	Gauge(metricName string, value float64, tags []string)
	Histogram(metricName string, value float64, tags []string)
	Distribution(metricName string, value float64, tags []string)
}

type MetricOption

type MetricOption[T any] func(T)

func MetricDatadogWithAgentAddress

func MetricDatadogWithAgentAddress(address string) MetricOption[*metricDataDog]

func MetricDatadogWithEnv

func MetricDatadogWithEnv(env string) MetricOption[*metricDataDog]

func MetricDatadogWithSampleRate

func MetricDatadogWithSampleRate(sampleRate float64) MetricOption[*metricDataDog]

type MetricProvider

type MetricProvider string
const (
	MetricDatadog MetricProvider = "datadog"
	MetricOTLP    MetricProvider = "otlp"
)

func (MetricProvider) String

func (t MetricProvider) String() string

type MetricPushAction

type MetricPushAction interface {
	Push(tags ...string)
}

func NewMetricActionNoop

func NewMetricActionNoop(log logger.Manager) MetricPushAction

type MetricResponseCode

type MetricResponseCode string
const (
	MetricResponseCodeBase    MetricResponseCode = "response_code"
	MetricResponseCodeSuccess MetricResponseCode = MetricResponseCodeBase + ":200"
	MetricResponseCodeFail    MetricResponseCode = MetricResponseCodeBase + ":500"
)

func (MetricResponseCode) String

func (v MetricResponseCode) String() string

type MetricsManager

type MetricsManager interface {
	StartBy(provider, name string) MetricPushAction
	Start(name string) MetricPushAction
	StartDefault(name string) MetricPushAction
	Enabled() bool

	MetricActions

	MustInit() MetricsManager
}

func NewMetricNoop

func NewMetricNoop() MetricsManager

func NewMetricsManager

func NewMetricsManager(log logger.Manager, serviceName string, metrics ...Metric) MetricsManager

type SpanProcessor

type SpanProcessor string
const (
	SpanProcessorBatch        SpanProcessor = "batch"
	SpanProcessorSimple       SpanProcessor = "simple"
	SpanProcessorSimpleCustom SpanProcessor = "simple_custom"
)

Jump to

Keyboard shortcuts

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