Golang APM

Get the most out of Middleware OpsAI for your Go applications by using the Middleware Golang SDK (version 1.7.0 or newer) and Gin Middleware (version 1.0.0 or newer).

🚀 Key Features

  • Captures exception and error details automatically
  • Works with popular Go frameworks like Gin
  • Function code recording for all files
  • Library file detection for better error tracking

🛠️ APM Setup

  1. Install the Middleware packages:

  2. Initialize the tracker at the top of your main file:

⚡ Exception Code Capturing

The SDK automatically captures:

  • Exception types and messages
  • Stack traces with line numbers
  • Function names and bodies
  • File paths and line ranges
  • Library file detection (for files in /go/src, /go/pkg/mod, vendor, and third_party directories)

⚙️ VCS Metadata Configuration (Recommended)

To help Middleware suggest fixes and even open GitHub pull requests for you, it's important to send version control (VCS) information along with your error data.

  • Set these environment variables before starting your app:

    • This lets Middleware know exactly which version of your code is running, so it can suggest the right fix and even create a solution PR for you.

📚 Resources