Documentation
¶
Overview ¶
Package telemetry provides a way to collect telemetry from function execution - metrics and traces.
Index ¶
- Constants
- func CleanMetricName(metricName string) string
- func ContextWithTelemeter(ctx context.Context, telemeter *Telemeter) context.Context
- func NewMetricsExporter(ctx context.Context, writer io.Writer, opts *Options) (metric.Exporter, error)
- func NewTraceExporter(ctx context.Context, writer io.Writer, opts *Options) (sdktrace.SpanExporter, error)
- func TraceParentFromContext(ctx context.Context, telemetry *Options) string
- type ErrorMissingEnvVariable
- type Meter
- type Options
- type Telemeter
- type Tracer
Constants ¶
const (
ErrorsCounter = "errors"
)
const (
TraceParentEnv = "TRACEPARENT"
)
Variables ¶
This section is empty.
Functions ¶
func CleanMetricName ¶ added in v0.66.7
CleanMetricName cleans metric name from invalid characters.
func ContextWithTelemeter ¶ added in v0.77.0
ContextWithTelemeter returns a new context with the provided Telemeter attached.
func NewMetricsExporter ¶ added in v0.66.7
func NewMetricsExporter(ctx context.Context, writer io.Writer, opts *Options) (metric.Exporter, error)
NewMetricsExporter - create a new exporter based on the telemetry options.
func NewTraceExporter ¶ added in v0.66.7
func NewTraceExporter(ctx context.Context, writer io.Writer, opts *Options) (sdktrace.SpanExporter, error)
NewTraceExporter creates a new exporter based on the telemetry options.
Types ¶
type ErrorMissingEnvVariable ¶
type ErrorMissingEnvVariable struct {
Vars []string
}
ErrorMissingEnvVariable error for missing environment variable.
func (*ErrorMissingEnvVariable) Error ¶
func (e *ErrorMissingEnvVariable) Error() string
type Meter ¶ added in v0.77.0
type Meter struct {
otelmetric.Meter
// contains filtered or unexported fields
}
func NewMeter ¶ added in v0.77.0
func NewMeter(ctx context.Context, appName, appVersion string, writer io.Writer, opts *Options) (*Meter, error)
NewMeter creates and configures the metrics collection.
type Options ¶ added in v0.77.0
type Options struct {
// TraceExporter is the type of trace exporter to be used.
TraceExporter string
// TraceExporterHTTPEndpoint is the endpoint to which traces will be sent.
TraceExporterHTTPEndpoint string
// TraceParent is used as a parent trace context.
TraceParent string
// MetricExporter is the type of metrics exporter.
MetricExporter string
// TraceExporterInsecureEndpoint is useful for collecting traces locally. If set to true, the exporter will not validate the server certificate.
TraceExporterInsecureEndpoint bool
// MetricExporterInsecureEndpoint is useful for local metrics collection. if set to true, the exporter will not validate the server's certificate.
MetricExporterInsecureEndpoint bool
}
Options are Telemetry options.
type Telemeter ¶ added in v0.77.0
func NewTelemeter ¶ added in v0.77.0
func NewTelemeter(ctx context.Context, appName, appVersion string, writer io.Writer, opts *Options) (*Telemeter, error)
NewTelemeter initializes the telemetry collector.
func TelemeterFromContext ¶ added in v0.77.0
TelemeterFromContext retrieves the Telemeter from the context, or nil if not present.