telemetry

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSpanAttributes

func AddSpanAttributes(span trace.Span, attributes map[string]interface{})

AddSpanAttributes añade atributos a un span existente

func CreateSpanAttributes

func CreateSpanAttributes(attributes map[string]interface{}) []attribute.KeyValue

CreateSpanAttributes crea atributos comunes para spans

Types

type OpenTelemetryConfig

type OpenTelemetryConfig struct {
	ServiceName    string
	ServiceVersion string
	Environment    string

	// Tracing configuration
	TracingEnabled     bool
	TracingEndpoint    string
	TracingSampleRatio float64

	// Metrics configuration
	MetricsEnabled  bool
	MetricsEndpoint string
	MetricsInterval time.Duration

	// Logging configuration
	LogsEnabled  bool
	LogsEndpoint string

	// Resource attributes
	DeploymentEnvironment string
	ServiceNamespace      string
	ServiceInstanceID     string

	// Propagation
	Propagators []string
}

OpenTelemetryConfig configuración para OpenTelemetry

func DefaultOpenTelemetryConfig

func DefaultOpenTelemetryConfig() *OpenTelemetryConfig

DefaultOpenTelemetryConfig retorna configuración por defecto

type OpenTelemetryProvider

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

OpenTelemetryProvider gestiona la configuración de OpenTelemetry

func NewOpenTelemetryProvider

func NewOpenTelemetryProvider(config *OpenTelemetryConfig, logger logger.Logger) (*OpenTelemetryProvider, error)

NewOpenTelemetryProvider crea un nuevo proveedor de OpenTelemetry

func (*OpenTelemetryProvider) GetMeter

func (p *OpenTelemetryProvider) GetMeter() metric.Meter

GetMeter retorna el meter

func (*OpenTelemetryProvider) GetTracer

func (p *OpenTelemetryProvider) GetTracer() trace.Tracer

GetTracer retorna el tracer

func (*OpenTelemetryProvider) RecordBusinessEvent

func (p *OpenTelemetryProvider) RecordBusinessEvent(ctx context.Context, eventType, tenantID string)

RecordBusinessEvent registra un evento de negocio

func (*OpenTelemetryProvider) RecordCacheOperation

func (p *OpenTelemetryProvider) RecordCacheOperation(ctx context.Context, operation string, duration time.Duration, hit bool)

RecordCacheOperation registra una operación de cache

func (*OpenTelemetryProvider) RecordDatabaseOperation

func (p *OpenTelemetryProvider) RecordDatabaseOperation(ctx context.Context, operation, table string, duration time.Duration)

RecordDatabaseOperation registra una operación de base de datos

func (*OpenTelemetryProvider) RecordError

func (p *OpenTelemetryProvider) RecordError(ctx context.Context, errorType, service string)

RecordError registra un error

func (*OpenTelemetryProvider) RecordHTTPRequest

func (p *OpenTelemetryProvider) RecordHTTPRequest(ctx context.Context, method, path, status string, duration time.Duration, tenantID string)

RecordHTTPRequest registra una request HTTP

func (*OpenTelemetryProvider) SetActiveConnections

func (p *OpenTelemetryProvider) SetActiveConnections(ctx context.Context, count int64)

SetActiveConnections actualiza el gauge de conexiones activas

func (*OpenTelemetryProvider) SetGoroutineCount

func (p *OpenTelemetryProvider) SetGoroutineCount(ctx context.Context, count int64)

SetGoroutineCount actualiza el contador de goroutines

func (*OpenTelemetryProvider) SetMemoryUsage

func (p *OpenTelemetryProvider) SetMemoryUsage(ctx context.Context, bytes int64)

SetMemoryUsage actualiza el gauge de uso de memoria

func (*OpenTelemetryProvider) Shutdown

func (p *OpenTelemetryProvider) Shutdown(ctx context.Context) error

Shutdown cierra el proveedor de OpenTelemetry

func (*OpenTelemetryProvider) StartSpan

func (p *OpenTelemetryProvider) StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpan inicia un nuevo span

Jump to

Keyboard shortcuts

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