monitoringexporter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSensitiveKey

func IsSensitiveKey(key string) bool

func NewMetricReader

func NewMetricReader(ctx context.Context, cfg Config) (sdkmetric.Reader, error)

NewMetricReader creates an OTLP/HTTP metric reader for remote monitoring.

func NewTraceExporter

func NewTraceExporter(ctx context.Context, cfg Config) (sdktrace.SpanExporter, error)

NewTraceExporter creates an OTLP/HTTP trace exporter for remote monitoring.

func RedactFields

func RedactFields(fields logrus.Fields) map[string]interface{}

func RedactString

func RedactString(value string) string

func RedactValue

func RedactValue(value interface{}) interface{}

Types

type Config

type Config struct {
	DSN       string
	PublicKey string
	ProjectID string
	Endpoint  string
	Timeout   time.Duration
}

Config describes the optional remote monitoring telemetry sink.

func FromDSN

func FromDSN(dsn string) (Config, bool, error)

func FromEnv

func FromEnv() (Config, bool, error)

FromEnv returns the monitoring exporter config from environment variables. Missing DSN is not an error; it means remote export is disabled.

func ParseDSN

func ParseDSN(raw string) (Config, error)

ParseDSN parses a remote monitoring DSN: https://<write-key>@<host>/<project-id>

func (Config) Headers

func (c Config) Headers() map[string]string

func (Config) OTLPSignalURL

func (c Config) OTLPSignalURL(signal string) string

func (Config) SignalURL

func (c Config) SignalURL(signal string) string

type LogHook

type LogHook struct {
	// contains filtered or unexported fields
}

LogHook asynchronously forwards sanitized logrus entries to remote monitoring.

func InstallLogHook

func InstallLogHook(cfg Config) *LogHook

func NewLogHook

func NewLogHook(cfg Config) *LogHook

func (*LogHook) Fire

func (h *LogHook) Fire(entry *logrus.Entry) error

func (*LogHook) Levels

func (h *LogHook) Levels() []logrus.Level

func (*LogHook) Shutdown

func (h *LogHook) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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