pyroscope - Performance Profiling

Overview

The pyroscope module provides integration with Pyroscope for production monitoring and performance profiling.

Functions

load()

Load Pyroscope server address and start profiling.

func load(address string)

Parameters:

  • address - Pyroscope server address

Behavior:

  • Starts Pyroscope client
  • Configures profiling for the application

Example:

pyroscope.load("http://localhost:4040")

Usage Patterns

Application Integration

func main() {
    // Start profiling
    pyroscope.load("http://localhost:4040")
    
    // Application code
    runApplication()
}

Production Monitoring

func setupMonitoring() {
    address := os.Getenv("PYROSCOPE_ADDRESS")
    if address == "" {
        address = "http://localhost:4040"
    }
    
    pyroscope.load(address)
    
    log.Info("Pyroscope profiling enabled")
}

Best Practices

Configuration

// Good: Configure Pyroscope address
address := os.Getenv("PYROSCOPE_ADDRESS")
if address == "" {
    address = "http://localhost:4040"
}

// Good: Handle connection errors
pyroscope.load(address)
// Connection errors are logged