zobservability

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

Observability Package

A comprehensive observability system for Go applications providing unified tracing, metrics, and error tracking with support for multiple providers including OpenTelemetry, SigNoz, and Sentry.

Table of Contents

Architecture

Core Components
zobservability/
├── observer.go              # Main Observer interface
├── config.go               # Configuration structures
├── constants.go            # Provider and attribute constants
├── metrics.go              # Metrics interfaces
├── metrics_config.go       # Metrics configuration
├── metrics_factory.go      # Metrics provider factory
├── metrics_opentelemetry.go # OpenTelemetry metrics implementation
├── metrics_noop.go         # No-op metrics for testing
├── helpers.go              # Utility functions
├── transaction.go          # Transaction interface
├── span.go                 # Span interface
├── event.go               # Event interface
├── noop.go                # No-op observer implementation
├── factory/               # Observer factory
│   └── factory.go
├── providers/             # Provider implementations
│   ├── signoz/
│   └── sentry/
└── examples/              # Usage examples
    └── metrics_example.go
Key Interfaces
  1. Observer - Main interface for all observability operations
  2. MetricsProvider - Interface for metrics operations (counters, gauges, histograms)
  3. Transaction - Interface for distributed tracing transactions
  4. Span - Interface for tracing spans
  5. Event - Interface for error and message capture

Features

Unified Observability
  • Single interface for tracing, metrics, and error tracking
  • Provider-agnostic design with pluggable backends
  • Consistent API across all providers
Multiple Providers
  • OpenTelemetry - Industry standard for metrics and tracing
  • SigNoz - Open-source observability platform
  • Sentry - Error tracking and performance monitoring
  • No-op - For testing and development
Flexible Metrics
  • Push Mode - Automatic periodic export to backends
  • Endpoint Mode - On-demand metrics via HTTP endpoints
  • Support for Counters, Gauges, and Histograms
  • Custom labels and dimensions
Advanced Configuration
  • Environment-specific settings
  • Custom headers and authentication
  • Batch processing configuration
  • Resource attribute customization
Tracing Exclusions
  • Selective tracing with method exclusion support
  • Performance optimization for high-frequency endpoints
  • Reduce noise from health checks and metrics endpoints
External API Monitoring
  • Automatic detection and monitoring of external service calls

Quick Start

1. Basic Setup
import (
    "github.com/zondax/golem/pkg/zobservability"
    "github.com/zondax/golem/pkg/zobservability/factory"
)

// Initialize observer
config := &zobservability.Config{
    Provider:    zobservability.ProviderSigNoz,
    Enabled:     true,
    Environment: "production",
    Release:     "v1.0.0",
    Address:     "http://signoz:4317",
}

observer, err := factory.NewObserver(config, "my-service")
if err != nil {
    log.Fatal(err)
}
defer observer.Close()
2. Using Metrics
// Get metrics provider
metrics := observer.GetMetrics()

// Register metrics (safe to call multiple times)
metrics.RegisterCounter("api_requests_total", "Total API requests", []string{"method", "status"})
metrics.RegisterHistogram("request_duration_seconds", "Request duration", []string{"endpoint"}, nil)

// Record metrics
metrics.IncrementCounter("api_requests_total", map[string]string{
    "method": "GET",
    "status": "200",
})

start := time.Now()
// ... your business logic ...
metrics.RecordDuration("request_duration_seconds", time.Since(start), map[string]string{
    "endpoint": "/api/users",
})
3. Using Tracing
// Start a transaction
tx := observer.StartTransaction(ctx, "user-registration")
defer tx.Finish(zobservability.TransactionOK)

// Add context
tx.SetTag("user_id", "12345")
tx.SetTag("plan", "premium")

// Start a span
ctx, span := observer.StartSpan(tx.Context(), "validate-email")
defer span.Finish()

// Capture events
observer.CaptureMessage(ctx, "Email validation started", zobservability.LevelInfo)

// Handle errors
if err != nil {
    observer.CaptureException(ctx, err)
    tx.Finish(zobservability.TransactionError)
    return err
}

Configuration

YAML Configuration
zobservability:
  provider: "opentelemetry"
  enabled: true
  environment: "production"
  release: "1.0.0"
  debug: false
  address: "localhost:4317"
  sample_rate: 1.0
  middleware:
    capture_errors: true
  tracing_exclusions:  # Optional: List of operations/endpoints to exclude from tracing
    # Direct operation names
    - "HealthCheck"
    - "Ping"
    - "GetMetrics"
    # gRPC methods (full path)
    - "/grpc.health.v1.Health/Check"
    - "/grpc.health.v1.Health/Watch"
    - "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo"
    # HTTP routes
    - "/health"
    - "/metrics"
    - "/api/v1/health"
  metrics:
    enabled: true
    provider: "opentelemetry"
    opentelemetry:
      endpoint: "localhost:4317"
      insecure: false
      service_name: "my-service"
      service_version: "1.0.0"
      environment: "production"
      export_mode: "push"
      push_interval: "30s"
      headers:
        "authorization": "Bearer token"
  custom_config:
    insecure: "false"
    batch_profile: "production"
Environment-Specific Configurations
Development
zobservability:
  provider: "opentelemetry"
  enabled: true
  environment: "development"
  address: "localhost:4317"
  debug: true
  sample_rate: 1.0
  metrics:
    opentelemetry:
      export_mode: "endpoint"  # For debugging
      insecure: true
  custom_config:
    insecure: "true"
    batch_profile: "development"
Production
zobservability:
  provider: "signoz"
  enabled: true
  environment: "production"
  address: "ingest.eu.signoz.cloud:443"
  debug: false
  sample_rate: 0.1
  metrics:
    opentelemetry:
      export_mode: "push"      # Automatic export
      push_interval: "30s"
      insecure: false
  custom_config:
    header_signoz-access-token: "your-token"
    batch_profile: "production"

Providers

OpenTelemetry

The default provider supporting industry-standard observability.

Features:

  • OTLP gRPC and HTTP export
  • Automatic resource detection
  • Configurable batch processing
  • Custom headers support

Configuration:

zobservability:
  provider: "opentelemetry"
  address: "localhost:4317"
  custom_config:
    insecure: "true"
    batch_profile: "development"
SigNoz

Open-source observability platform with advanced features.

Features:

  • Native OpenTelemetry support
  • Custom batch profiles
  • Advanced resource configuration
  • Authentication via headers

Configuration:

zobservability:
  provider: "signoz"
  address: "ingest.eu.signoz.cloud:443"
  custom_config:
    header_signoz-access-token: "your-token"
    batch_profile: "production"
    insecure: "false"
Sentry

Error tracking and performance monitoring.

Features:

  • Error capture and grouping
  • Performance monitoring
  • Release tracking
  • User context

Configuration:

zobservability:
  provider: "sentry"
  address: "https://your-dsn@sentry.io/project"
  release: "1.0.0"
  sample_rate: 0.1

Metrics System

Export Modes
Push Mode ("push")

Automatically exports metrics at regular intervals.

When to use:

  • Production environments
  • Continuous monitoring
  • Low-latency applications

Configuration:

metrics:
  opentelemetry:
    export_mode: "push"
    push_interval: "30s"

Advantages:

  • Automatic and consistent
  • Lower application latency
  • No manual intervention required
Endpoint Mode ("endpoint")

Exports metrics on-demand via HTTP endpoints.

When to use:

  • Development and debugging
  • Prometheus scraping
  • Custom export timing

Configuration:

metrics:
  opentelemetry:
    export_mode: "endpoint"

Advantages:

  • Full control over export timing
  • Compatible with Prometheus
  • Ideal for debugging
Metric Types
Counters

Monotonically increasing values (requests, errors, etc.)

// Register
metrics.RegisterCounter("api_requests_total", "Total API requests", []string{"method", "status"})

// Use
metrics.IncrementCounter("api_requests_total", map[string]string{
    "method": "GET",
    "status": "200",
})
Gauges

Values that can increase or decrease (memory usage, active connections)

// Register
metrics.RegisterGauge("active_connections", "Active database connections", []string{"database"})

// Use
metrics.SetGauge("active_connections", 42.0, map[string]string{
    "database": "postgres",
})
Histograms

Distribution of values (request duration, response sizes)

// Register
metrics.RegisterHistogram("request_duration_seconds", "Request duration", []string{"endpoint"}, nil)

// Use
metrics.RecordDuration("request_duration_seconds", time.Since(start), map[string]string{
    "endpoint": "/api/events",
})

Tracing & Error Tracking

Transactions

Represent top-level operations in your application.

// Start transaction
transaction := observer.StartTransaction(ctx, "user_service.create_user")
defer transaction.Finish()

// Set transaction context
transaction.SetTag("user.email", email)
transaction.SetUser(zobservability.User{
    ID:    userID,
    Email: email,
})

// Handle errors
if err != nil {
    transaction.SetStatus(zobservability.SpanStatusError)
    observer.CaptureException(ctx, err)
}
Spans

Represent individual operations within transactions.

// Start span
ctx, span := observer.StartSpan(ctx, "database.create_user")
defer span.Finish()

// Add context
span.SetTag("db.statement", "INSERT INTO users...")
span.SetTag("db.table", "users")

// Handle errors
if err != nil {
    span.SetStatus(zobservability.SpanStatusError)
    span.SetTag("error", true)
}
Error Capture
// Capture exceptions
observer.CaptureException(ctx, err, zobservability.WithLevel(zobservability.LevelError))

// Capture messages
observer.CaptureMessage(ctx, "User login failed", zobservability.LevelWarning)

Tracing Exclusions

The tracing exclusions feature allows you to selectively exclude specific methods or operations from being traced. This is particularly useful for:

  • High-frequency endpoints: Health checks, metrics endpoints that would generate excessive trace data
  • Performance optimization: Reduce overhead on operations that don't need monitoring
  • Noise reduction: Keep your traces focused on business-critical operations
Configuration

Add the tracing_exclusions list to your configuration:

zobservability:
  provider: "signoz"
  enabled: true
  tracing_exclusions:
    - "HealthCheck"           # Exclude health check endpoints
    - "Ping"                  # Exclude ping/heartbeat endpoints
    - "GetMetrics"            # Exclude metrics collection
    - "db.query.select_health" # Exclude specific database queries
    - "cache.get"             # Exclude cache operations
How It Works

When a method name matches an entry in the tracing_exclusions list:

  • The method returns a no-op transaction or span that performs no operations
  • No trace data is sent to the observability backend
  • Child spans of excluded transactions are also excluded
  • The method continues to execute normally, just without tracing
Usage Example
// Configuration with exclusions
config := &zobservability.Config{
    Provider: zobservability.ProviderSigNoz,
    Enabled: true,
    TracingExclusions: []string{
        "HealthCheck",
        "GetMetrics",
        "cache.get",
    },
}

observer, _ := factory.NewObserver(config, "my-service")

// This transaction will be excluded (no-op)
tx1 := observer.StartTransaction(ctx, "HealthCheck")
tx1.SetTag("key", "value") // No-op, does nothing
tx1.Finish(zobservability.TransactionOK) // No-op, does nothing

// This transaction will be traced normally
tx2 := observer.StartTransaction(ctx, "ProcessOrder")
tx2.SetTag("order_id", "12345") // Actually sets the tag
tx2.Finish(zobservability.TransactionOK) // Sends trace to backend

// Spans work the same way
_, span1 := observer.StartSpan(ctx, "cache.get") // Excluded (no-op)
span1.Finish() // No-op

_, span2 := observer.StartSpan(ctx, "db.query.insert") // Traced normally
span2.Finish() // Sends span to backend
Best Practices
  1. Be Specific: Use exact method names to avoid accidentally excluding important operations
  2. Case Sensitive: Method names are case-sensitive - "HealthCheck" is different from "healthcheck"
  3. No Wildcards: The current implementation requires exact matches (no regex or wildcards)
  4. Document Exclusions: Keep a list of excluded methods in your documentation for debugging purposes
  5. Monitor Impact: Periodically review excluded methods to ensure you're not missing important data

External API Monitoring

The External API Monitoring feature automatically detects and categorizes external service calls in SigNoz. This provides visibility into all external dependencies and their performance characteristics.

How It Works

External API Monitoring leverages OpenTelemetry semantic conventions to automatically detect external API calls. When properly configured, SigNoz will automatically categorize calls based on these attributes:

  • net.peer.name: Domain or host of the external service (e.g., "api.stripe.com")
  • http.url: Complete URL of the request (e.g., "https://api.stripe.com/v1/charges")
  • http.target: Path portion of the URL (e.g., "/v1/charges")
  • rpc.system: RPC system identifier (e.g., "grpc")
Automatic Instrumentation
HTTP Calls

HTTP calls are automatically instrumented when using the zhttpclient package:

// HTTP client is automatically instrumented with OpenTelemetry
httpClient := zhttpclient.New(zhttpclient.Config{
    Timeout: 30 * time.Second,
})

// This call will automatically appear in SigNoz External API Monitoring
resp, err := httpClient.NewRequest().
    SetURL("https://api.stripe.com/v1/charges").
    SetHeaders(map[string]string{
        "Authorization": "Bearer sk_test_...",
    }).
    Get(ctx)
gRPC Calls

gRPC calls are automatically instrumented when using the configured interceptors:

// gRPC client with OpenTelemetry interceptor
dialOpts := []grpc.DialOption{
    grpc.WithStatsHandler(interceptors.NewOTelClientHandler(otelConfig)),
}

conn, err := grpc.NewClient(target, dialOpts...)
client := pb.NewServiceClient(conn)

// This call will automatically appear in SigNoz External API Monitoring
response, err := client.GetData(ctx, request)

Usage Examples

Complete Service Example
type UserService struct {
    observer zobservability.Observer
    repo     UserRepository
}

func (s *UserService) CreateUser(ctx context.Context, req *CreateUserRequest) (*User, error) {
    // Start transaction
    transaction := s.observer.StartTransaction(ctx, "user_service.create_user")
    defer transaction.Finish()

    // Get metrics
    metrics := s.observer.GetMetrics()
    
    // Register metrics (safe to call multiple times)
    metrics.RegisterCounter("user_operations_total", "Total user operations", []string{"operation", "status"})
    metrics.RegisterHistogram("user_operation_duration_seconds", "User operation duration", []string{"operation"}, nil)
    
    start := time.Now()
    
    // Record operation start
    metrics.IncrementCounter("user_operations_total", map[string]string{
        "operation": "create",
        "status":    "started",
    })
    
    defer func() {
        status := "success"
        if err != nil {
            status = "error"
            transaction.SetStatus(zobservability.SpanStatusError)
            s.observer.CaptureException(ctx, err)
        }
        
        // Record final metrics
        metrics.RecordDuration("user_operation_duration_seconds", time.Since(start), map[string]string{
            "operation": "create",
        })
        metrics.IncrementCounter("user_operations_total", map[string]string{
            "operation": "create",
            "status":    status,
        })
    }()
    
    // Validate input
    if err := req.Validate(); err != nil {
        return nil, fmt.Errorf("invalid request: %w", err)
    }
    
    // Database operation with span
    ctx, span := s.observer.StartSpan(ctx, "database.create_user")
    span.SetTag("db.table", "users")
    defer span.Finish()
    
    user, err := s.repo.Create(ctx, req)
    if err != nil {
        span.SetStatus(zobservability.SpanStatusError)
        return nil, err
    }
    
    // Set transaction context
    transaction.SetTag("user.id", user.ID)
    transaction.SetUser(zobservability.User{
        ID:    user.ID,
        Email: user.Email,
    })
    
    return user, nil
}
Middleware Integration
func ObservabilityMiddleware(observer zobservability.Observer) gin.HandlerFunc {
    return func(c *gin.Context) {
        // Start transaction
        transaction := observer.StartTransaction(c.Request.Context(), 
            fmt.Sprintf("%s %s", c.Request.Method, c.FullPath()))
        defer transaction.Finish()
        
        // Set request context
        transaction.SetTag("http.method", c.Request.Method)
        transaction.SetTag("http.url", c.Request.URL.String())
        
        // Process request
        c.Next()
        
        // Set response context
        transaction.SetTag("http.status_code", c.Writer.Status())
        
        if c.Writer.Status() >= 400 {
            transaction.SetStatus(zobservability.SpanStatusError)
        }
    }
}

Best Practices

1. Metric Naming
// Good - descriptive with units
"api_requests_total"
"request_duration_seconds"
"memory_usage_bytes"

// Bad - unclear or missing units
"requests"
"duration"
"memory"
2. Label Usage
// Good - consistent labels
metrics.IncrementCounter("api_requests_total", map[string]string{
    "method":   "GET",
    "endpoint": "/api/users",
    "status":   "200",
})

// Bad - inconsistent or high cardinality
metrics.IncrementCounter("api_requests_total", map[string]string{
    "user_id": "12345", // High cardinality!
    "Method":  "GET",   // Inconsistent casing
})
3. Error Handling
// Good - structured error capture
if err != nil {
    observer.CaptureException(ctx, err, 
        zobservability.WithLevel(zobservability.LevelError),
        zobservability.WithTag("component", "user_service"),
        zobservability.WithTag("operation", "create_user"),
    )
    return nil, err
}
4. Resource Management
// Good - proper cleanup
observer, err := factory.NewObserver(config, serviceName)
if err != nil {
    return err
}
defer observer.Close() // Always close!

// Good - span cleanup
ctx, span := observer.StartSpan(ctx, "operation")
defer span.Finish() // Always finish spans!
5. Configuration Management
// Good - environment-specific config
func getObservabilityConfig(env string) *zobservability.Config {
    config := &zobservability.Config{
        Provider:    "opentelemetry",
        Enabled:     true,
        Environment: env,
    }
    
    switch env {
    case "production":
        config.Address = "ingest.signoz.cloud:443"
        config.SampleRate = 0.1
        config.Debug = false
    case "development":
        config.Address = "localhost:4317"
        config.SampleRate = 1.0
        config.Debug = true
    }
    
    return config
}

Troubleshooting

Common Issues
1. Metrics Not Appearing
# Check configuration
Verify endpoint is correct
Confirm export_mode is "push" for automatic export
Check authentication headers
Verify network connectivity

# Debug steps
- Enable debug mode: debug: true
- Check logs for export errors
- Test with endpoint mode for manual export
2. High Memory Usage
# Optimize batch configuration
Reduce batch_timeout
Lower max_export_batch_size
Increase export frequency

# Configuration example
custom_config:
  batch_profile: "low_memory"
3. Connection Errors
# Check network and security
Verify endpoint URL and port
Check TLS/SSL settings (insecure flag)
Validate authentication tokens
Test network connectivity

# Debug configuration
custom_config:
  insecure: "true"  # For development only
  debug: "true"
4. Performance Issues
# Optimize for performance
Reduce sample_rate in production
Use appropriate batch_profile
Minimize high-cardinality labels
Use async export modes

# Production configuration
sample_rate: 0.1
custom_config:
  batch_profile: "production"
Debug Configuration
# Maximum debugging
zobservability:
  provider: "opentelemetry"
  debug: true
  sample_rate: 1.0
  metrics:
    opentelemetry:
      export_mode: "endpoint"
      insecure: true
  custom_config:
    insecure: "true"
    batch_profile: "development"
Monitoring Health
// Check observer health
if err := observer.GetMetrics().Start(); err != nil {
    log.Errorf("Metrics provider failed to start: %v", err)
}

// Monitor export success
metrics.RegisterCounter("zobservability_exports_total", "Total exports", []string{"status"})

For more information, see the examples directory and provider-specific documentation in providers/.

Documentation

Index

Constants

View Source
const (
	ProviderSentry = "sentry"
	ProviderSigNoz = "signoz"
)

Provider constants

View Source
const (
	PropagationW3C      = "w3c"
	PropagationB3       = "b3"
	PropagationB3Single = "b3-single"
	PropagationJaeger   = "jaeger"
)

Propagation format constants

View Source
const (
	EnvironmentProduction  = "production"
	EnvironmentDevelopment = "development"
	EnvironmentStaging     = "staging"
	EnvironmentLocal       = "local"
)

Environment constants for observability configuration

View Source
const (
	TagOperation = "operation"
	TagService   = "service"
	TagComponent = "component"
	TagLayer     = "layer"
	TagMethod    = "method"

	LayerService    = "service"
	LayerRepository = "repository"
)

Common tag keys for spans and transactions

View Source
const (
	ResourceServiceName    = "service.name"
	ResourceServiceVersion = "service.version"
	ResourceServiceType    = "service.type"
	ResourceTargetService  = "target.service"
	ResourceEnvironment    = "deployment.environment"
	ResourceLanguage       = "library.language"
	ResourceHostName       = "host.name"
	ResourceProcessPID     = "process.pid"
)

OpenTelemetry Resource attribute keys - these are standard across all providers

View Source
const (
	// Network attributes for external API detection
	SpanAttributeNetPeerName = "net.peer.name" // Domain or host of the external service (e.g., "api.stripe.com")
	SpanAttributeHTTPURL     = "http.url"      // Complete URL of the request (e.g., "https://api.stripe.com/v1/charges")
	SpanAttributeHTTPTarget  = "http.target"   // Path portion of the URL (e.g., "/v1/charges")
	SpanAttributeHTTPMethod  = "http.method"   // HTTP method (GET, POST, etc.)
	SpanAttributeHTTPScheme  = "http.scheme"   // HTTP scheme (http, https)
	SpanAttributeHTTPHost    = "http.host"     // HTTP host header value

	// gRPC attributes for external service calls
	SpanAttributeRPCSystem = "rpc.system" // RPC system identifier (e.g., "grpc")

	// Response attributes
	SpanAttributeHTTPStatusCode    = "http.status_code"     // HTTP response status code
	SpanAttributeRPCGRPCStatusCode = "rpc.grpc.status_code" // gRPC status code
)

External API Monitoring attributes (SigNoz semantic conventions) These attributes are used by SigNoz to automatically detect and categorize external API calls

View Source
const (
	// RPC system values
	RPCSystemGRPC = "grpc"
	RPCSystemHTTP = "http"

	// HTTP schemes
	HTTPSchemeHTTP  = "http"
	HTTPSchemeHTTPS = "https"
)

External API categorization values

View Source
const (
	UserAttributeID       = "user.id"
	UserAttributeEmail    = "user.email"
	UserAttributeUsername = "user.username"
)

User attribute keys

View Source
const (
	FingerprintAttribute = "fingerprint"
	FingerprintSeparator = ","
)

Fingerprint attribute key

View Source
const (
	TransactionSuccessMessage   = ""
	TransactionFailureMessage   = "transaction failed"
	TransactionCancelledMessage = "transaction cancelled"
)

Transaction status messages

View Source
const (
	// Export modes
	OTelExportModePush     = "push"
	OTelExportModeEndpoint = "endpoint"

	// Default intervals
	DefaultPushInterval  = 30 * time.Second
	DefaultBatchTimeout  = 5 * time.Second
	DefaultExportTimeout = 30 * time.Second
)

Constants for OpenTelemetry metrics configuration

View Source
const (
	ResourceLanguageGo = "go"
)

OpenTelemetry Resource attribute values

View Source
const (
	SpanAttributeLevel = "level"
)

OpenTelemetry Span attribute keys

Variables

This section is empty.

Functions

func GetHostname added in v0.26.0

func GetHostname() string

GetHostname returns the hostname - now ALWAYS included for service identification Hostname is crucial for: - Multi-server deployments (identifying which server handled the request) - Load balancer debugging (tracking requests across instances) - Performance analysis (comparing server performance) - Incident response (knowing exactly which server had issues)

Uses sync.Once to ensure hostname detection only happens once per process lifecycle

Types

type Config

type Config struct {
	Provider          string            `yaml:"provider" mapstructure:"provider"`
	Enabled           bool              `yaml:"enabled" mapstructure:"enabled"` // Enable/disable observability
	Environment       string            `yaml:"environment" mapstructure:"environment"`
	Release           string            `yaml:"release" mapstructure:"release"`
	Debug             bool              `yaml:"debug" mapstructure:"debug"`
	Address           string            `yaml:"address" mapstructure:"address"`         // Common endpoint/address/dsn for providers
	SampleRate        float64           `yaml:"sample_rate" mapstructure:"sample_rate"` // Common sampling rate
	Middleware        MiddlewareConfig  `yaml:"middleware" mapstructure:"middleware"`
	Metrics           MetricsConfig     `yaml:"metrics" mapstructure:"metrics"`                       // Metrics configuration
	Propagation       PropagationConfig `yaml:"propagation" mapstructure:"propagation"`               // Trace propagation configuration
	CustomConfig      map[string]string `yaml:"custom_config" mapstructure:"custom_config"`           // Provider-specific configuration
	TracingExclusions []string          `yaml:"tracing_exclusions" mapstructure:"tracing_exclusions"` // methods to exclude from tracing
}

Config holds configuration for all observability features (tracing, logging, metrics)

func (*Config) SetDefaults

func (c *Config) SetDefaults()

func (Config) Validate

func (c Config) Validate() error

type Event

type Event interface {
	SetLevel(level Level)
	SetTags(tags map[string]string)
	SetTag(key, value string)
	SetUser(id, email, username string)
	SetFingerprint(fingerprint []string)
	SetError(err error)
	Capture()
}

type EventOption

type EventOption interface {
	ApplyEvent(Event)
}

func WithEventError

func WithEventError(err error) EventOption

func WithEventFingerprint

func WithEventFingerprint(fingerprint []string) EventOption

func WithEventLevel

func WithEventLevel(level Level) EventOption

func WithEventTag

func WithEventTag(key, value string) EventOption

func WithEventTags

func WithEventTags(tags map[string]string) EventOption

func WithEventUser

func WithEventUser(id, email, username string) EventOption

type EventSpanBuilder

type EventSpanBuilder struct {
	*SpanBuilder
	// contains filtered or unexported fields
}

EventSpanBuilder creates spans with layer prefix in operation name for better visibility

func NewEventSpanBuilder

func NewEventSpanBuilder(observer Observer, operation, layer string) *EventSpanBuilder

NewEventSpanBuilder creates a new event span builder with layer prefix in operation name

type Level

type Level int

Level represents the severity level of an event

const (
	// LevelDebug represents debug level events
	LevelDebug Level = iota
	// LevelInfo represents informational events
	LevelInfo
	// LevelWarning represents warning events
	LevelWarning
	// LevelError represents error events
	LevelError
	// LevelFatal represents fatal events
	LevelFatal
)

func (Level) String

func (l Level) String() string

String implements the Stringer interface

type MetricDefinition

type MetricDefinition struct {
	Name       string
	Help       string
	Type       MetricType
	LabelNames []string
	Buckets    []float64 // Only used for histograms
}

MetricDefinition defines a metric to be registered

type MetricType

type MetricType int

MetricType represents the type of metric

const (
	MetricTypeCounter MetricType = iota
	MetricTypeGauge
	MetricTypeHistogram
)

type MetricsConfig

type MetricsConfig struct {
	Enabled       bool                       `yaml:"enabled" mapstructure:"enabled"`
	Provider      string                     `yaml:"provider" mapstructure:"provider"`           // Use MetricsProviderType constants
	Path          string                     `yaml:"path" mapstructure:"path"`                   // Metrics endpoint path (legacy)
	Port          int                        `yaml:"port" mapstructure:"port"`                   // Metrics server port (legacy)
	OpenTelemetry OpenTelemetryMetricsConfig `yaml:"opentelemetry" mapstructure:"opentelemetry"` // OpenTelemetry specific config
}

MetricsConfig holds configuration for metrics

func DefaultMetricsConfig

func DefaultMetricsConfig() MetricsConfig

DefaultMetricsConfig returns default metrics configuration

func (MetricsConfig) Validate

func (c MetricsConfig) Validate() error

Validate validates the metrics configuration

type MetricsProvider

type MetricsProvider interface {
	// Counter operations
	IncrementCounter(ctx context.Context, name string, labels map[string]string) error
	AddCounter(ctx context.Context, name string, value float64, labels map[string]string) error

	// Gauge operations
	SetGauge(ctx context.Context, name string, value float64, labels map[string]string) error
	AddGauge(ctx context.Context, name string, value float64, labels map[string]string) error

	// Histogram operations
	RecordHistogram(ctx context.Context, name string, value float64, labels map[string]string) error

	// Timer operations
	RecordDuration(ctx context.Context, name string, duration time.Duration, labels map[string]string) error

	// Metric registration
	RegisterCounter(name, help string, labelNames []string) error
	RegisterGauge(name, help string, labelNames []string) error
	RegisterHistogram(name, help string, labelNames []string, buckets []float64) error

	// Lifecycle
	Start() error
	Stop() error
	Name() string
}

MetricsProvider defines the interface for metrics operations Trace correlation is handled transparently when context is available

func NewMetricsProvider

func NewMetricsProvider(name string, config MetricsConfig) (MetricsProvider, error)

NewMetricsProvider creates a new metrics provider based on the configuration

func NewNoopMetricsProvider

func NewNoopMetricsProvider(name string) MetricsProvider

NewNoopMetricsProvider creates a new no-operation metrics provider

func NewOpenTelemetryMetricsProvider

func NewOpenTelemetryMetricsProvider(name string, config MetricsConfig) (MetricsProvider, error)

NewOpenTelemetryMetricsProvider creates a new OpenTelemetry metrics provider

type MetricsProviderType

type MetricsProviderType string

MetricsProviderType represents the type of metrics provider

const (
	MetricsProviderOpenTelemetry MetricsProviderType = "opentelemetry"
	MetricsProviderNoop          MetricsProviderType = "noop"
)

type MiddlewareConfig

type MiddlewareConfig struct {
	CaptureErrors bool `yaml:"capture_errors" mapstructure:"capture_errors"`
}

type MockEvent

type MockEvent struct {
	mock.Mock
}

MockEvent is an autogenerated mock type for the Event type

func NewMockEvent

func NewMockEvent(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockEvent

NewMockEvent creates a new instance of MockEvent. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockEvent) Capture

func (_m *MockEvent) Capture()

Capture provides a mock function with no fields

func (*MockEvent) EXPECT

func (_m *MockEvent) EXPECT() *MockEvent_Expecter

func (*MockEvent) SetError

func (_m *MockEvent) SetError(err error)

SetError provides a mock function with given fields: err

func (*MockEvent) SetFingerprint

func (_m *MockEvent) SetFingerprint(fingerprint []string)

SetFingerprint provides a mock function with given fields: fingerprint

func (*MockEvent) SetLevel

func (_m *MockEvent) SetLevel(level Level)

SetLevel provides a mock function with given fields: level

func (*MockEvent) SetTag

func (_m *MockEvent) SetTag(key string, value string)

SetTag provides a mock function with given fields: key, value

func (*MockEvent) SetTags

func (_m *MockEvent) SetTags(tags map[string]string)

SetTags provides a mock function with given fields: tags

func (*MockEvent) SetUser

func (_m *MockEvent) SetUser(id string, email string, username string)

SetUser provides a mock function with given fields: id, email, username

type MockEventOption

type MockEventOption struct {
	mock.Mock
}

MockEventOption is an autogenerated mock type for the EventOption type

func NewMockEventOption

func NewMockEventOption(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockEventOption

NewMockEventOption creates a new instance of MockEventOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockEventOption) ApplyEvent

func (_m *MockEventOption) ApplyEvent(_a0 Event)

ApplyEvent provides a mock function with given fields: _a0

func (*MockEventOption) EXPECT

type MockEventOption_ApplyEvent_Call

type MockEventOption_ApplyEvent_Call struct {
	*mock.Call
}

MockEventOption_ApplyEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyEvent'

func (*MockEventOption_ApplyEvent_Call) Return

func (*MockEventOption_ApplyEvent_Call) Run

func (*MockEventOption_ApplyEvent_Call) RunAndReturn

type MockEventOption_Expecter

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

func (*MockEventOption_Expecter) ApplyEvent

func (_e *MockEventOption_Expecter) ApplyEvent(_a0 interface{}) *MockEventOption_ApplyEvent_Call

ApplyEvent is a helper method to define mock.On call

  • _a0 Event

type MockEvent_Capture_Call

type MockEvent_Capture_Call struct {
	*mock.Call
}

MockEvent_Capture_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Capture'

func (*MockEvent_Capture_Call) Return

func (*MockEvent_Capture_Call) Run

func (_c *MockEvent_Capture_Call) Run(run func()) *MockEvent_Capture_Call

func (*MockEvent_Capture_Call) RunAndReturn

func (_c *MockEvent_Capture_Call) RunAndReturn(run func()) *MockEvent_Capture_Call

type MockEvent_Expecter

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

func (*MockEvent_Expecter) Capture

Capture is a helper method to define mock.On call

func (*MockEvent_Expecter) SetError

func (_e *MockEvent_Expecter) SetError(err interface{}) *MockEvent_SetError_Call

SetError is a helper method to define mock.On call

  • err error

func (*MockEvent_Expecter) SetFingerprint

func (_e *MockEvent_Expecter) SetFingerprint(fingerprint interface{}) *MockEvent_SetFingerprint_Call

SetFingerprint is a helper method to define mock.On call

  • fingerprint []string

func (*MockEvent_Expecter) SetLevel

func (_e *MockEvent_Expecter) SetLevel(level interface{}) *MockEvent_SetLevel_Call

SetLevel is a helper method to define mock.On call

  • level Level

func (*MockEvent_Expecter) SetTag

func (_e *MockEvent_Expecter) SetTag(key interface{}, value interface{}) *MockEvent_SetTag_Call

SetTag is a helper method to define mock.On call

  • key string
  • value string

func (*MockEvent_Expecter) SetTags

func (_e *MockEvent_Expecter) SetTags(tags interface{}) *MockEvent_SetTags_Call

SetTags is a helper method to define mock.On call

  • tags map[string]string

func (*MockEvent_Expecter) SetUser

func (_e *MockEvent_Expecter) SetUser(id interface{}, email interface{}, username interface{}) *MockEvent_SetUser_Call

SetUser is a helper method to define mock.On call

  • id string
  • email string
  • username string

type MockEvent_SetError_Call

type MockEvent_SetError_Call struct {
	*mock.Call
}

MockEvent_SetError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetError'

func (*MockEvent_SetError_Call) Return

func (*MockEvent_SetError_Call) Run

func (_c *MockEvent_SetError_Call) Run(run func(err error)) *MockEvent_SetError_Call

func (*MockEvent_SetError_Call) RunAndReturn

func (_c *MockEvent_SetError_Call) RunAndReturn(run func(error)) *MockEvent_SetError_Call

type MockEvent_SetFingerprint_Call

type MockEvent_SetFingerprint_Call struct {
	*mock.Call
}

MockEvent_SetFingerprint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFingerprint'

func (*MockEvent_SetFingerprint_Call) Return

func (*MockEvent_SetFingerprint_Call) Run

func (_c *MockEvent_SetFingerprint_Call) Run(run func(fingerprint []string)) *MockEvent_SetFingerprint_Call

func (*MockEvent_SetFingerprint_Call) RunAndReturn

type MockEvent_SetLevel_Call

type MockEvent_SetLevel_Call struct {
	*mock.Call
}

MockEvent_SetLevel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLevel'

func (*MockEvent_SetLevel_Call) Return

func (*MockEvent_SetLevel_Call) Run

func (_c *MockEvent_SetLevel_Call) Run(run func(level Level)) *MockEvent_SetLevel_Call

func (*MockEvent_SetLevel_Call) RunAndReturn

func (_c *MockEvent_SetLevel_Call) RunAndReturn(run func(Level)) *MockEvent_SetLevel_Call

type MockEvent_SetTag_Call

type MockEvent_SetTag_Call struct {
	*mock.Call
}

MockEvent_SetTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTag'

func (*MockEvent_SetTag_Call) Return

func (*MockEvent_SetTag_Call) Run

func (_c *MockEvent_SetTag_Call) Run(run func(key string, value string)) *MockEvent_SetTag_Call

func (*MockEvent_SetTag_Call) RunAndReturn

func (_c *MockEvent_SetTag_Call) RunAndReturn(run func(string, string)) *MockEvent_SetTag_Call

type MockEvent_SetTags_Call

type MockEvent_SetTags_Call struct {
	*mock.Call
}

MockEvent_SetTags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTags'

func (*MockEvent_SetTags_Call) Return

func (*MockEvent_SetTags_Call) Run

func (_c *MockEvent_SetTags_Call) Run(run func(tags map[string]string)) *MockEvent_SetTags_Call

func (*MockEvent_SetTags_Call) RunAndReturn

func (_c *MockEvent_SetTags_Call) RunAndReturn(run func(map[string]string)) *MockEvent_SetTags_Call

type MockEvent_SetUser_Call

type MockEvent_SetUser_Call struct {
	*mock.Call
}

MockEvent_SetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetUser'

func (*MockEvent_SetUser_Call) Return

func (*MockEvent_SetUser_Call) Run

func (_c *MockEvent_SetUser_Call) Run(run func(id string, email string, username string)) *MockEvent_SetUser_Call

func (*MockEvent_SetUser_Call) RunAndReturn

func (_c *MockEvent_SetUser_Call) RunAndReturn(run func(string, string, string)) *MockEvent_SetUser_Call

type MockMetricsProvider

type MockMetricsProvider struct {
	mock.Mock
}

MockMetricsProvider is an autogenerated mock type for the MetricsProvider type

func NewMockMetricsProvider

func NewMockMetricsProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockMetricsProvider

NewMockMetricsProvider creates a new instance of MockMetricsProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockMetricsProvider) AddToCounter

func (_m *MockMetricsProvider) AddToCounter(ctx context.Context, name string, value float64, labels map[string]string) error

AddToCounter provides a mock function with given fields: ctx, name, value, labels

func (*MockMetricsProvider) AddToGauge

func (_m *MockMetricsProvider) AddToGauge(ctx context.Context, name string, value float64, labels map[string]string) error

AddToGauge provides a mock function with given fields: ctx, name, value, labels

func (*MockMetricsProvider) EXPECT

func (*MockMetricsProvider) IncrementCounter

func (_m *MockMetricsProvider) IncrementCounter(ctx context.Context, name string, labels map[string]string) error

IncrementCounter provides a mock function with given fields: ctx, name, labels

func (*MockMetricsProvider) Name

func (_m *MockMetricsProvider) Name() string

Name provides a mock function with no fields

func (*MockMetricsProvider) RecordDuration

func (_m *MockMetricsProvider) RecordDuration(ctx context.Context, name string, duration time.Duration, labels map[string]string) error

RecordDuration provides a mock function with given fields: ctx, name, duration, labels

func (*MockMetricsProvider) RecordHistogram

func (_m *MockMetricsProvider) RecordHistogram(ctx context.Context, name string, value float64, labels map[string]string) error

RecordHistogram provides a mock function with given fields: ctx, name, value, labels

func (*MockMetricsProvider) RegisterCounter

func (_m *MockMetricsProvider) RegisterCounter(name string, help string, labelNames []string) error

RegisterCounter provides a mock function with given fields: name, help, labelNames

func (*MockMetricsProvider) RegisterGauge

func (_m *MockMetricsProvider) RegisterGauge(name string, help string, labelNames []string) error

RegisterGauge provides a mock function with given fields: name, help, labelNames

func (*MockMetricsProvider) RegisterHistogram

func (_m *MockMetricsProvider) RegisterHistogram(name string, help string, labelNames []string, buckets []float64) error

RegisterHistogram provides a mock function with given fields: name, help, labelNames, buckets

func (*MockMetricsProvider) SetGauge

func (_m *MockMetricsProvider) SetGauge(ctx context.Context, name string, value float64, labels map[string]string) error

SetGauge provides a mock function with given fields: ctx, name, value, labels

func (*MockMetricsProvider) Start

func (_m *MockMetricsProvider) Start() error

Start provides a mock function with no fields

func (*MockMetricsProvider) Stop

func (_m *MockMetricsProvider) Stop() error

Stop provides a mock function with no fields

type MockMetricsProvider_AddToCounter_Call

type MockMetricsProvider_AddToCounter_Call struct {
	*mock.Call
}

MockMetricsProvider_AddToCounter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddToCounter'

func (*MockMetricsProvider_AddToCounter_Call) Return

func (*MockMetricsProvider_AddToCounter_Call) Run

func (*MockMetricsProvider_AddToCounter_Call) RunAndReturn

type MockMetricsProvider_AddToGauge_Call

type MockMetricsProvider_AddToGauge_Call struct {
	*mock.Call
}

MockMetricsProvider_AddToGauge_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddToGauge'

func (*MockMetricsProvider_AddToGauge_Call) Return

func (*MockMetricsProvider_AddToGauge_Call) Run

func (*MockMetricsProvider_AddToGauge_Call) RunAndReturn

type MockMetricsProvider_Expecter

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

func (*MockMetricsProvider_Expecter) AddToCounter

func (_e *MockMetricsProvider_Expecter) AddToCounter(ctx interface{}, name interface{}, value interface{}, labels interface{}) *MockMetricsProvider_AddToCounter_Call

AddToCounter is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • value float64
  • labels map[string]string

func (*MockMetricsProvider_Expecter) AddToGauge

func (_e *MockMetricsProvider_Expecter) AddToGauge(ctx interface{}, name interface{}, value interface{}, labels interface{}) *MockMetricsProvider_AddToGauge_Call

AddToGauge is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • value float64
  • labels map[string]string

func (*MockMetricsProvider_Expecter) IncrementCounter

func (_e *MockMetricsProvider_Expecter) IncrementCounter(ctx interface{}, name interface{}, labels interface{}) *MockMetricsProvider_IncrementCounter_Call

IncrementCounter is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • labels map[string]string

func (*MockMetricsProvider_Expecter) Name

Name is a helper method to define mock.On call

func (*MockMetricsProvider_Expecter) RecordDuration

func (_e *MockMetricsProvider_Expecter) RecordDuration(ctx interface{}, name interface{}, duration interface{}, labels interface{}) *MockMetricsProvider_RecordDuration_Call

RecordDuration is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • duration time.Duration
  • labels map[string]string

func (*MockMetricsProvider_Expecter) RecordHistogram

func (_e *MockMetricsProvider_Expecter) RecordHistogram(ctx interface{}, name interface{}, value interface{}, labels interface{}) *MockMetricsProvider_RecordHistogram_Call

RecordHistogram is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • value float64
  • labels map[string]string

func (*MockMetricsProvider_Expecter) RegisterCounter

func (_e *MockMetricsProvider_Expecter) RegisterCounter(name interface{}, help interface{}, labelNames interface{}) *MockMetricsProvider_RegisterCounter_Call

RegisterCounter is a helper method to define mock.On call

  • name string
  • help string
  • labelNames []string

func (*MockMetricsProvider_Expecter) RegisterGauge

func (_e *MockMetricsProvider_Expecter) RegisterGauge(name interface{}, help interface{}, labelNames interface{}) *MockMetricsProvider_RegisterGauge_Call

RegisterGauge is a helper method to define mock.On call

  • name string
  • help string
  • labelNames []string

func (*MockMetricsProvider_Expecter) RegisterHistogram

func (_e *MockMetricsProvider_Expecter) RegisterHistogram(name interface{}, help interface{}, labelNames interface{}, buckets interface{}) *MockMetricsProvider_RegisterHistogram_Call

RegisterHistogram is a helper method to define mock.On call

  • name string
  • help string
  • labelNames []string
  • buckets []float64

func (*MockMetricsProvider_Expecter) SetGauge

func (_e *MockMetricsProvider_Expecter) SetGauge(ctx interface{}, name interface{}, value interface{}, labels interface{}) *MockMetricsProvider_SetGauge_Call

SetGauge is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • value float64
  • labels map[string]string

func (*MockMetricsProvider_Expecter) Start

Start is a helper method to define mock.On call

func (*MockMetricsProvider_Expecter) Stop

Stop is a helper method to define mock.On call

type MockMetricsProvider_IncrementCounter_Call

type MockMetricsProvider_IncrementCounter_Call struct {
	*mock.Call
}

MockMetricsProvider_IncrementCounter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IncrementCounter'

func (*MockMetricsProvider_IncrementCounter_Call) Return

func (*MockMetricsProvider_IncrementCounter_Call) Run

func (*MockMetricsProvider_IncrementCounter_Call) RunAndReturn

type MockMetricsProvider_Name_Call

type MockMetricsProvider_Name_Call struct {
	*mock.Call
}

MockMetricsProvider_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*MockMetricsProvider_Name_Call) Return

func (*MockMetricsProvider_Name_Call) Run

func (*MockMetricsProvider_Name_Call) RunAndReturn

type MockMetricsProvider_RecordDuration_Call

type MockMetricsProvider_RecordDuration_Call struct {
	*mock.Call
}

MockMetricsProvider_RecordDuration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RecordDuration'

func (*MockMetricsProvider_RecordDuration_Call) Return

func (*MockMetricsProvider_RecordDuration_Call) Run

func (*MockMetricsProvider_RecordDuration_Call) RunAndReturn

type MockMetricsProvider_RecordHistogram_Call

type MockMetricsProvider_RecordHistogram_Call struct {
	*mock.Call
}

MockMetricsProvider_RecordHistogram_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RecordHistogram'

func (*MockMetricsProvider_RecordHistogram_Call) Return

func (*MockMetricsProvider_RecordHistogram_Call) Run

func (*MockMetricsProvider_RecordHistogram_Call) RunAndReturn

type MockMetricsProvider_RegisterCounter_Call

type MockMetricsProvider_RegisterCounter_Call struct {
	*mock.Call
}

MockMetricsProvider_RegisterCounter_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterCounter'

func (*MockMetricsProvider_RegisterCounter_Call) Return

func (*MockMetricsProvider_RegisterCounter_Call) Run

func (*MockMetricsProvider_RegisterCounter_Call) RunAndReturn

type MockMetricsProvider_RegisterGauge_Call

type MockMetricsProvider_RegisterGauge_Call struct {
	*mock.Call
}

MockMetricsProvider_RegisterGauge_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterGauge'

func (*MockMetricsProvider_RegisterGauge_Call) Return

func (*MockMetricsProvider_RegisterGauge_Call) Run

func (*MockMetricsProvider_RegisterGauge_Call) RunAndReturn

type MockMetricsProvider_RegisterHistogram_Call

type MockMetricsProvider_RegisterHistogram_Call struct {
	*mock.Call
}

MockMetricsProvider_RegisterHistogram_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterHistogram'

func (*MockMetricsProvider_RegisterHistogram_Call) Return

func (*MockMetricsProvider_RegisterHistogram_Call) Run

func (*MockMetricsProvider_RegisterHistogram_Call) RunAndReturn

type MockMetricsProvider_SetGauge_Call

type MockMetricsProvider_SetGauge_Call struct {
	*mock.Call
}

MockMetricsProvider_SetGauge_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetGauge'

func (*MockMetricsProvider_SetGauge_Call) Return

func (*MockMetricsProvider_SetGauge_Call) Run

func (*MockMetricsProvider_SetGauge_Call) RunAndReturn

type MockMetricsProvider_Start_Call

type MockMetricsProvider_Start_Call struct {
	*mock.Call
}

MockMetricsProvider_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'

func (*MockMetricsProvider_Start_Call) Return

func (*MockMetricsProvider_Start_Call) Run

func (*MockMetricsProvider_Start_Call) RunAndReturn

type MockMetricsProvider_Stop_Call

type MockMetricsProvider_Stop_Call struct {
	*mock.Call
}

MockMetricsProvider_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'

func (*MockMetricsProvider_Stop_Call) Return

func (*MockMetricsProvider_Stop_Call) Run

func (*MockMetricsProvider_Stop_Call) RunAndReturn

type MockObserver

type MockObserver struct {
	mock.Mock
}

MockObserver is an autogenerated mock type for the Observer type

func NewMockObserver

func NewMockObserver(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockObserver

NewMockObserver creates a new instance of MockObserver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockObserver) CaptureException

func (_m *MockObserver) CaptureException(ctx context.Context, err error, opts ...EventOption)

CaptureException provides a mock function with given fields: ctx, err, opts

func (*MockObserver) CaptureMessage

func (_m *MockObserver) CaptureMessage(ctx context.Context, message string, level Level, opts ...EventOption)

CaptureMessage provides a mock function with given fields: ctx, message, level, opts

func (*MockObserver) Close

func (_m *MockObserver) Close() error

Close provides a mock function with no fields

func (*MockObserver) EXPECT

func (_m *MockObserver) EXPECT() *MockObserver_Expecter

func (*MockObserver) GetConfig

func (_m *MockObserver) GetConfig() Config

GetConfig provides a mock function with no fields

func (*MockObserver) GetMetrics

func (_m *MockObserver) GetMetrics() MetricsProvider

GetMetrics provides a mock function with no fields

func (*MockObserver) StartSpan

func (_m *MockObserver) StartSpan(ctx context.Context, operation string, opts ...SpanOption) (context.Context, Span)

StartSpan provides a mock function with given fields: ctx, operation, opts

func (*MockObserver) StartTransaction

func (_m *MockObserver) StartTransaction(ctx context.Context, name string, opts ...TransactionOption) Transaction

StartTransaction provides a mock function with given fields: ctx, name, opts

type MockObserver_CaptureException_Call

type MockObserver_CaptureException_Call struct {
	*mock.Call
}

MockObserver_CaptureException_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CaptureException'

func (*MockObserver_CaptureException_Call) Return

func (*MockObserver_CaptureException_Call) Run

func (*MockObserver_CaptureException_Call) RunAndReturn

type MockObserver_CaptureMessage_Call

type MockObserver_CaptureMessage_Call struct {
	*mock.Call
}

MockObserver_CaptureMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CaptureMessage'

func (*MockObserver_CaptureMessage_Call) Return

func (*MockObserver_CaptureMessage_Call) Run

func (*MockObserver_CaptureMessage_Call) RunAndReturn

type MockObserver_Close_Call

type MockObserver_Close_Call struct {
	*mock.Call
}

MockObserver_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'

func (*MockObserver_Close_Call) Return

func (*MockObserver_Close_Call) Run

func (_c *MockObserver_Close_Call) Run(run func()) *MockObserver_Close_Call

func (*MockObserver_Close_Call) RunAndReturn

func (_c *MockObserver_Close_Call) RunAndReturn(run func() error) *MockObserver_Close_Call

type MockObserver_Expecter

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

func (*MockObserver_Expecter) CaptureException

func (_e *MockObserver_Expecter) CaptureException(ctx interface{}, err interface{}, opts ...interface{}) *MockObserver_CaptureException_Call

CaptureException is a helper method to define mock.On call

  • ctx context.Context
  • err error
  • opts ...EventOption

func (*MockObserver_Expecter) CaptureMessage

func (_e *MockObserver_Expecter) CaptureMessage(ctx interface{}, message interface{}, level interface{}, opts ...interface{}) *MockObserver_CaptureMessage_Call

CaptureMessage is a helper method to define mock.On call

  • ctx context.Context
  • message string
  • level Level
  • opts ...EventOption

func (*MockObserver_Expecter) Close

Close is a helper method to define mock.On call

func (*MockObserver_Expecter) GetConfig

GetConfig is a helper method to define mock.On call

func (*MockObserver_Expecter) GetMetrics

GetMetrics is a helper method to define mock.On call

func (*MockObserver_Expecter) StartSpan

func (_e *MockObserver_Expecter) StartSpan(ctx interface{}, operation interface{}, opts ...interface{}) *MockObserver_StartSpan_Call

StartSpan is a helper method to define mock.On call

  • ctx context.Context
  • operation string
  • opts ...SpanOption

func (*MockObserver_Expecter) StartTransaction

func (_e *MockObserver_Expecter) StartTransaction(ctx interface{}, name interface{}, opts ...interface{}) *MockObserver_StartTransaction_Call

StartTransaction is a helper method to define mock.On call

  • ctx context.Context
  • name string
  • opts ...TransactionOption

type MockObserver_GetConfig_Call

type MockObserver_GetConfig_Call struct {
	*mock.Call
}

MockObserver_GetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfig'

func (*MockObserver_GetConfig_Call) Return

func (*MockObserver_GetConfig_Call) Run

func (*MockObserver_GetConfig_Call) RunAndReturn

func (_c *MockObserver_GetConfig_Call) RunAndReturn(run func() Config) *MockObserver_GetConfig_Call

type MockObserver_GetMetrics_Call

type MockObserver_GetMetrics_Call struct {
	*mock.Call
}

MockObserver_GetMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMetrics'

func (*MockObserver_GetMetrics_Call) Return

func (*MockObserver_GetMetrics_Call) Run

func (*MockObserver_GetMetrics_Call) RunAndReturn

type MockObserver_StartSpan_Call

type MockObserver_StartSpan_Call struct {
	*mock.Call
}

MockObserver_StartSpan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartSpan'

func (*MockObserver_StartSpan_Call) Return

func (*MockObserver_StartSpan_Call) Run

func (_c *MockObserver_StartSpan_Call) Run(run func(ctx context.Context, operation string, opts ...SpanOption)) *MockObserver_StartSpan_Call

func (*MockObserver_StartSpan_Call) RunAndReturn

type MockObserver_StartTransaction_Call

type MockObserver_StartTransaction_Call struct {
	*mock.Call
}

MockObserver_StartTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartTransaction'

func (*MockObserver_StartTransaction_Call) Return

func (*MockObserver_StartTransaction_Call) Run

func (*MockObserver_StartTransaction_Call) RunAndReturn

type MockSpan

type MockSpan struct {
	mock.Mock
}

MockSpan is an autogenerated mock type for the Span type

func NewMockSpan

func NewMockSpan(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockSpan

NewMockSpan creates a new instance of MockSpan. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockSpan) EXPECT

func (_m *MockSpan) EXPECT() *MockSpan_Expecter

func (*MockSpan) Finish

func (_m *MockSpan) Finish()

Finish provides a mock function with no fields

func (*MockSpan) SetData

func (_m *MockSpan) SetData(key string, value interface{})

SetData provides a mock function with given fields: key, value

func (*MockSpan) SetError

func (_m *MockSpan) SetError(err error, opts ...trace.EventOption)

SetError provides a mock function with given fields: err, opts

func (*MockSpan) SetTag

func (_m *MockSpan) SetTag(key string, value string)

SetTag provides a mock function with given fields: key, value

type MockSpanOption

type MockSpanOption struct {
	mock.Mock
}

MockSpanOption is an autogenerated mock type for the SpanOption type

func NewMockSpanOption

func NewMockSpanOption(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockSpanOption

NewMockSpanOption creates a new instance of MockSpanOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockSpanOption) ApplySpan

func (_m *MockSpanOption) ApplySpan(_a0 Span)

ApplySpan provides a mock function with given fields: _a0

func (*MockSpanOption) EXPECT

type MockSpanOption_ApplySpan_Call

type MockSpanOption_ApplySpan_Call struct {
	*mock.Call
}

MockSpanOption_ApplySpan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplySpan'

func (*MockSpanOption_ApplySpan_Call) Return

func (*MockSpanOption_ApplySpan_Call) Run

func (*MockSpanOption_ApplySpan_Call) RunAndReturn

type MockSpanOption_Expecter

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

func (*MockSpanOption_Expecter) ApplySpan

func (_e *MockSpanOption_Expecter) ApplySpan(_a0 interface{}) *MockSpanOption_ApplySpan_Call

ApplySpan is a helper method to define mock.On call

  • _a0 Span

type MockSpan_Expecter

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

func (*MockSpan_Expecter) Finish

Finish is a helper method to define mock.On call

func (*MockSpan_Expecter) SetData

func (_e *MockSpan_Expecter) SetData(key interface{}, value interface{}) *MockSpan_SetData_Call

SetData is a helper method to define mock.On call

  • key string
  • value interface{}

func (*MockSpan_Expecter) SetError

func (_e *MockSpan_Expecter) SetError(err interface{}, opts ...interface{}) *MockSpan_SetError_Call

SetError is a helper method to define mock.On call

  • err error
  • opts ...trace.EventOption

func (*MockSpan_Expecter) SetTag

func (_e *MockSpan_Expecter) SetTag(key interface{}, value interface{}) *MockSpan_SetTag_Call

SetTag is a helper method to define mock.On call

  • key string
  • value string

type MockSpan_Finish_Call

type MockSpan_Finish_Call struct {
	*mock.Call
}

MockSpan_Finish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Finish'

func (*MockSpan_Finish_Call) Return

func (*MockSpan_Finish_Call) Run

func (_c *MockSpan_Finish_Call) Run(run func()) *MockSpan_Finish_Call

func (*MockSpan_Finish_Call) RunAndReturn

func (_c *MockSpan_Finish_Call) RunAndReturn(run func()) *MockSpan_Finish_Call

type MockSpan_SetData_Call

type MockSpan_SetData_Call struct {
	*mock.Call
}

MockSpan_SetData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetData'

func (*MockSpan_SetData_Call) Return

func (*MockSpan_SetData_Call) Run

func (_c *MockSpan_SetData_Call) Run(run func(key string, value interface{})) *MockSpan_SetData_Call

func (*MockSpan_SetData_Call) RunAndReturn

func (_c *MockSpan_SetData_Call) RunAndReturn(run func(string, interface{})) *MockSpan_SetData_Call

type MockSpan_SetError_Call

type MockSpan_SetError_Call struct {
	*mock.Call
}

MockSpan_SetError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetError'

func (*MockSpan_SetError_Call) Return

func (*MockSpan_SetError_Call) Run

func (_c *MockSpan_SetError_Call) Run(run func(err error, opts ...trace.EventOption)) *MockSpan_SetError_Call

func (*MockSpan_SetError_Call) RunAndReturn

func (_c *MockSpan_SetError_Call) RunAndReturn(run func(error, ...trace.EventOption)) *MockSpan_SetError_Call

type MockSpan_SetTag_Call

type MockSpan_SetTag_Call struct {
	*mock.Call
}

MockSpan_SetTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTag'

func (*MockSpan_SetTag_Call) Return

func (*MockSpan_SetTag_Call) Run

func (_c *MockSpan_SetTag_Call) Run(run func(key string, value string)) *MockSpan_SetTag_Call

func (*MockSpan_SetTag_Call) RunAndReturn

func (_c *MockSpan_SetTag_Call) RunAndReturn(run func(string, string)) *MockSpan_SetTag_Call

type MockTransaction

type MockTransaction struct {
	mock.Mock
}

MockTransaction is an autogenerated mock type for the Transaction type

func NewMockTransaction

func NewMockTransaction(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTransaction

NewMockTransaction creates a new instance of MockTransaction. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockTransaction) Context

func (_m *MockTransaction) Context() context.Context

Context provides a mock function with no fields

func (*MockTransaction) EXPECT

func (*MockTransaction) Finish

func (_m *MockTransaction) Finish(status TransactionStatus)

Finish provides a mock function with given fields: status

func (*MockTransaction) SetData

func (_m *MockTransaction) SetData(key string, value interface{})

SetData provides a mock function with given fields: key, value

func (*MockTransaction) SetName

func (_m *MockTransaction) SetName(name string)

SetName provides a mock function with given fields: name

func (*MockTransaction) SetTag

func (_m *MockTransaction) SetTag(key string, value string)

SetTag provides a mock function with given fields: key, value

func (*MockTransaction) StartChild

func (_m *MockTransaction) StartChild(operation string, opts ...SpanOption) Span

StartChild provides a mock function with given fields: operation, opts

type MockTransactionOption

type MockTransactionOption struct {
	mock.Mock
}

MockTransactionOption is an autogenerated mock type for the TransactionOption type

func NewMockTransactionOption

func NewMockTransactionOption(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTransactionOption

NewMockTransactionOption creates a new instance of MockTransactionOption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockTransactionOption) ApplyTransaction

func (_m *MockTransactionOption) ApplyTransaction(_a0 Transaction)

ApplyTransaction provides a mock function with given fields: _a0

func (*MockTransactionOption) EXPECT

type MockTransactionOption_ApplyTransaction_Call

type MockTransactionOption_ApplyTransaction_Call struct {
	*mock.Call
}

MockTransactionOption_ApplyTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyTransaction'

func (*MockTransactionOption_ApplyTransaction_Call) Return

func (*MockTransactionOption_ApplyTransaction_Call) Run

func (*MockTransactionOption_ApplyTransaction_Call) RunAndReturn

type MockTransactionOption_Expecter

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

func (*MockTransactionOption_Expecter) ApplyTransaction

func (_e *MockTransactionOption_Expecter) ApplyTransaction(_a0 interface{}) *MockTransactionOption_ApplyTransaction_Call

ApplyTransaction is a helper method to define mock.On call

  • _a0 Transaction

type MockTransaction_Context_Call

type MockTransaction_Context_Call struct {
	*mock.Call
}

MockTransaction_Context_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Context'

func (*MockTransaction_Context_Call) Return

func (*MockTransaction_Context_Call) Run

func (*MockTransaction_Context_Call) RunAndReturn

type MockTransaction_Expecter

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

func (*MockTransaction_Expecter) Context

Context is a helper method to define mock.On call

func (*MockTransaction_Expecter) Finish

func (_e *MockTransaction_Expecter) Finish(status interface{}) *MockTransaction_Finish_Call

Finish is a helper method to define mock.On call

  • status TransactionStatus

func (*MockTransaction_Expecter) SetData

func (_e *MockTransaction_Expecter) SetData(key interface{}, value interface{}) *MockTransaction_SetData_Call

SetData is a helper method to define mock.On call

  • key string
  • value interface{}

func (*MockTransaction_Expecter) SetName

func (_e *MockTransaction_Expecter) SetName(name interface{}) *MockTransaction_SetName_Call

SetName is a helper method to define mock.On call

  • name string

func (*MockTransaction_Expecter) SetTag

func (_e *MockTransaction_Expecter) SetTag(key interface{}, value interface{}) *MockTransaction_SetTag_Call

SetTag is a helper method to define mock.On call

  • key string
  • value string

func (*MockTransaction_Expecter) StartChild

func (_e *MockTransaction_Expecter) StartChild(operation interface{}, opts ...interface{}) *MockTransaction_StartChild_Call

StartChild is a helper method to define mock.On call

  • operation string
  • opts ...SpanOption

type MockTransaction_Finish_Call

type MockTransaction_Finish_Call struct {
	*mock.Call
}

MockTransaction_Finish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Finish'

func (*MockTransaction_Finish_Call) Return

func (*MockTransaction_Finish_Call) Run

func (*MockTransaction_Finish_Call) RunAndReturn

type MockTransaction_SetData_Call

type MockTransaction_SetData_Call struct {
	*mock.Call
}

MockTransaction_SetData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetData'

func (*MockTransaction_SetData_Call) Return

func (*MockTransaction_SetData_Call) Run

func (_c *MockTransaction_SetData_Call) Run(run func(key string, value interface{})) *MockTransaction_SetData_Call

func (*MockTransaction_SetData_Call) RunAndReturn

func (_c *MockTransaction_SetData_Call) RunAndReturn(run func(string, interface{})) *MockTransaction_SetData_Call

type MockTransaction_SetName_Call

type MockTransaction_SetName_Call struct {
	*mock.Call
}

MockTransaction_SetName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetName'

func (*MockTransaction_SetName_Call) Return

func (*MockTransaction_SetName_Call) Run

func (*MockTransaction_SetName_Call) RunAndReturn

type MockTransaction_SetTag_Call

type MockTransaction_SetTag_Call struct {
	*mock.Call
}

MockTransaction_SetTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTag'

func (*MockTransaction_SetTag_Call) Return

func (*MockTransaction_SetTag_Call) Run

func (*MockTransaction_SetTag_Call) RunAndReturn

type MockTransaction_StartChild_Call

type MockTransaction_StartChild_Call struct {
	*mock.Call
}

MockTransaction_StartChild_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartChild'

func (*MockTransaction_StartChild_Call) Return

func (*MockTransaction_StartChild_Call) Run

func (*MockTransaction_StartChild_Call) RunAndReturn

type MockeventOptionFunc

type MockeventOptionFunc struct {
	mock.Mock
}

MockeventOptionFunc is an autogenerated mock type for the eventOptionFunc type

func NewMockeventOptionFunc

func NewMockeventOptionFunc(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockeventOptionFunc

NewMockeventOptionFunc creates a new instance of MockeventOptionFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockeventOptionFunc) EXPECT

func (*MockeventOptionFunc) Execute

func (_m *MockeventOptionFunc) Execute(_a0 Event)

Execute provides a mock function with given fields: _a0

type MockeventOptionFunc_Execute_Call

type MockeventOptionFunc_Execute_Call struct {
	*mock.Call
}

MockeventOptionFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MockeventOptionFunc_Execute_Call) Return

func (*MockeventOptionFunc_Execute_Call) Run

func (*MockeventOptionFunc_Execute_Call) RunAndReturn

type MockeventOptionFunc_Expecter

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

func (*MockeventOptionFunc_Expecter) Execute

func (_e *MockeventOptionFunc_Expecter) Execute(_a0 interface{}) *MockeventOptionFunc_Execute_Call

Execute is a helper method to define mock.On call

  • _a0 Event

type MockspanOptionFunc

type MockspanOptionFunc struct {
	mock.Mock
}

MockspanOptionFunc is an autogenerated mock type for the spanOptionFunc type

func NewMockspanOptionFunc

func NewMockspanOptionFunc(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockspanOptionFunc

NewMockspanOptionFunc creates a new instance of MockspanOptionFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockspanOptionFunc) EXPECT

func (*MockspanOptionFunc) Execute

func (_m *MockspanOptionFunc) Execute(_a0 Span)

Execute provides a mock function with given fields: _a0

type MockspanOptionFunc_Execute_Call

type MockspanOptionFunc_Execute_Call struct {
	*mock.Call
}

MockspanOptionFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MockspanOptionFunc_Execute_Call) Return

func (*MockspanOptionFunc_Execute_Call) Run

func (*MockspanOptionFunc_Execute_Call) RunAndReturn

type MockspanOptionFunc_Expecter

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

func (*MockspanOptionFunc_Expecter) Execute

func (_e *MockspanOptionFunc_Expecter) Execute(_a0 interface{}) *MockspanOptionFunc_Execute_Call

Execute is a helper method to define mock.On call

  • _a0 Span

type MocktransactionOptionFunc

type MocktransactionOptionFunc struct {
	mock.Mock
}

MocktransactionOptionFunc is an autogenerated mock type for the transactionOptionFunc type

func NewMocktransactionOptionFunc

func NewMocktransactionOptionFunc(t interface {
	mock.TestingT
	Cleanup(func())
}) *MocktransactionOptionFunc

NewMocktransactionOptionFunc creates a new instance of MocktransactionOptionFunc. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MocktransactionOptionFunc) EXPECT

func (*MocktransactionOptionFunc) Execute

func (_m *MocktransactionOptionFunc) Execute(_a0 Transaction)

Execute provides a mock function with given fields: _a0

type MocktransactionOptionFunc_Execute_Call

type MocktransactionOptionFunc_Execute_Call struct {
	*mock.Call
}

MocktransactionOptionFunc_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MocktransactionOptionFunc_Execute_Call) Return

func (*MocktransactionOptionFunc_Execute_Call) Run

func (*MocktransactionOptionFunc_Execute_Call) RunAndReturn

type MocktransactionOptionFunc_Expecter

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

func (*MocktransactionOptionFunc_Expecter) Execute

Execute is a helper method to define mock.On call

  • _a0 Transaction

type Observer

type Observer interface {
	// Tracing operations
	StartTransaction(ctx context.Context, name string, opts ...TransactionOption) Transaction
	StartSpan(ctx context.Context, operation string, opts ...SpanOption) (context.Context, Span)
	CaptureException(ctx context.Context, err error, opts ...EventOption)
	CaptureMessage(ctx context.Context, message string, level Level, opts ...EventOption)

	// Metrics operations
	GetMetrics() MetricsProvider

	// Configuration and lifecycle
	GetConfig() Config
	ForceFlush(ctx context.Context) error
	Close() error
}

Observer defines the main interface for observability operations

func NewNoopObserver

func NewNoopObserver() Observer

NewNoopObserver creates a new no-op observer that does nothing

type OpenTelemetryMetricsConfig

type OpenTelemetryMetricsConfig struct {
	Endpoint       string            `yaml:"endpoint" mapstructure:"endpoint"`
	Insecure       bool              `yaml:"insecure" mapstructure:"insecure"`
	ServiceName    string            `yaml:"service_name" mapstructure:"service_name"`
	ServiceVersion string            `yaml:"service_version" mapstructure:"service_version"`
	Environment    string            `yaml:"environment" mapstructure:"environment"`
	Hostname       string            `yaml:"hostname" mapstructure:"hostname"`
	Headers        map[string]string `yaml:"headers" mapstructure:"headers"`
	Protocol       string            `yaml:"protocol" mapstructure:"protocol"` // "grpc" (default) or "http"

	// Export configuration
	ExportMode    string        `yaml:"export_mode" mapstructure:"export_mode"`       // "push" or "endpoint"
	PushInterval  time.Duration `yaml:"push_interval" mapstructure:"push_interval"`   // For push mode
	BatchTimeout  time.Duration `yaml:"batch_timeout" mapstructure:"batch_timeout"`   // Batch timeout
	ExportTimeout time.Duration `yaml:"export_timeout" mapstructure:"export_timeout"` // Export timeout
}

OpenTelemetryMetricsConfig holds OpenTelemetry-specific metrics configuration

func DefaultOpenTelemetryMetricsConfig

func DefaultOpenTelemetryMetricsConfig() OpenTelemetryMetricsConfig

DefaultOpenTelemetryMetricsConfig returns default OpenTelemetry metrics configuration

func (OpenTelemetryMetricsConfig) Validate

func (c OpenTelemetryMetricsConfig) Validate() error

Validate validates the OpenTelemetry metrics configuration

type PropagationConfig added in v0.26.0

type PropagationConfig struct {
	Formats []string `yaml:"formats" mapstructure:"formats"` // ["w3c", "b3", "b3-single", "jaeger"]
}

PropagationConfig controls trace propagation formats

type Span

type Span interface {
	SetTag(key, value string)
	SetData(key string, value interface{})
	SetError(err error, opts ...trace.EventOption)
	Finish()
}

Span represents a unit of work or operation within a transaction

func StartServiceSpan

func StartServiceSpan(ctx context.Context, observer Observer, operation, service string) (context.Context, Span)

StartServiceSpan creates a span for service layer with common tags

type SpanBuilder

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

SpanBuilder helps build spans with common patterns

func NewSpanBuilder

func NewSpanBuilder(observer Observer, operation string) *SpanBuilder

NewSpanBuilder creates a new span builder

func (*SpanBuilder) Start

func (sb *SpanBuilder) Start(ctx context.Context) (context.Context, Span)

Start creates and starts the span with all configured options

func (*SpanBuilder) WithComponent

func (sb *SpanBuilder) WithComponent(component string) *SpanBuilder

WithComponent adds a component tag to the span

func (*SpanBuilder) WithLayer

func (sb *SpanBuilder) WithLayer(layer string) *SpanBuilder

WithLayer adds a layer tag to the span

func (*SpanBuilder) WithOperation

func (sb *SpanBuilder) WithOperation(operation string) *SpanBuilder

WithOperation adds an operation tag to the span

func (*SpanBuilder) WithService

func (sb *SpanBuilder) WithService(service string) *SpanBuilder

WithService adds a service tag to the span

func (*SpanBuilder) WithTag

func (sb *SpanBuilder) WithTag(key, value string) *SpanBuilder

WithTag adds a custom tag to the span

type SpanOption

type SpanOption interface {
	ApplySpan(Span)
}

SpanOption configures a span

func WithSpanData

func WithSpanData(key string, value interface{}) SpanOption

WithSpanData adds data to the span

func WithSpanError

func WithSpanError(err error) SpanOption

WithSpanError marks the span as failed with an error

func WithSpanTag

func WithSpanTag(key, value string) SpanOption

WithSpanTag adds a tag to the span

type Transaction

type Transaction interface {
	Context() context.Context
	SetName(name string)
	SetTag(key, value string)
	SetData(key string, value interface{})
	StartChild(operation string, opts ...SpanOption) Span
	Finish(status TransactionStatus)
}

Transaction represents a logical operation that can contain multiple spans

type TransactionOption

type TransactionOption interface {
	ApplyTransaction(Transaction)
}

TransactionOption configures a transaction

func WithTransactionData

func WithTransactionData(key string, value interface{}) TransactionOption

WithTransactionData adds data to the transaction

func WithTransactionTag

func WithTransactionTag(key, value string) TransactionOption

WithTransactionTag adds a tag to the transaction

type TransactionStatus

type TransactionStatus string

TransactionStatus represents the final status of a transaction

const (
	// TransactionOK indicates a successful transaction
	TransactionOK TransactionStatus = "ok"
	// TransactionError indicates a failed transaction
	TransactionError TransactionStatus = "error"
	// TransactionCancelled indicates a cancelled transaction
	TransactionCancelled TransactionStatus = "cancelled"
)

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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