irontelemetry-go/README.md

144 lines
4.0 KiB
Markdown

<p align="center">
<a href="https://irontelemetry.com">
<img src="https://irontelemetry.com/logo.png" alt="IronTelemetry" width="120" />
</a>
</p>
<h1 align="center">IronTelemetry SDK for Go</h1>
<p align="center">
<strong>Error monitoring and crash reporting for Go applications</strong>
</p>
<p align="center">
<a href="https://pkg.go.dev/git.marketally.com/ironservices/irontelemetry-go"><img src="https://pkg.go.dev/badge/git.marketally.com/ironservices/irontelemetry-go.svg" alt="Go Reference"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
</p>
<p align="center">
<a href="https://irontelemetry.com">Website</a>
<a href="https://irontelemetry.com/docs">Documentation</a>
<a href="https://irontelemetry.com/docs/go">Go Guide</a>
<a href="https://git.marketally.com/ironservices">Git</a>
</p>
---
**IronTelemetry** helps you capture exceptions, track user journeys, and get actionable insights to fix issues faster. Built for developers who want simple, powerful error monitoring without the complexity.
## Features
- **Panic Recovery** - Automatically capture panics with full stack traces
- **Error Capture** - Report errors with context and metadata
- **Journey Tracking** - Understand what users did before an error occurred
- **Breadcrumbs** - Add context with custom breadcrumbs
- **Context Support** - Full context.Context support for cancellation
- **Thread-Safe** - All operations are safe for concurrent use
- **Zero Dependencies** - Minimal external dependencies
## Installation
```bash
go get git.marketally.com/ironservices/irontelemetry-go
```
## Quick Start
### Initialize the SDK
```go
package main
import (
"log"
irontelemetry "git.marketally.com/ironservices/irontelemetry-go"
)
func main() {
client, err := irontelemetry.New(irontelemetry.Options{
DSN: "https://pk_live_xxx@irontelemetry.com",
})
if err != nil {
log.Fatal(err)
}
defer client.Close()
}
```
### Capture Errors
```go
if err := doSomething(); err != nil {
client.CaptureException(err)
}
```
### Track User Journeys
```go
journey := client.StartJourney("Checkout Flow")
journey.SetUser("user-123", "user@example.com", "John Doe")
err := journey.RunStep("Validate Cart", irontelemetry.CategoryBusiness, func() error {
return validateCart()
})
if err != nil {
journey.Fail(err)
client.CaptureException(err)
return
}
journey.Complete()
```
### Add Breadcrumbs
```go
client.AddBreadcrumb("User clicked checkout button", irontelemetry.CategoryUI)
client.AddBreadcrumb("Payment API called", irontelemetry.CategoryHTTP)
```
## HTTP Middleware
```go
http.Handle("/", irontelemetry.HTTPHandler(client, myHandler))
```
## Configuration
```go
client, err := irontelemetry.New(irontelemetry.Options{
DSN: "https://pk_live_xxx@irontelemetry.com",
Environment: "production",
AppVersion: "1.2.3",
SampleRate: 1.0,
BeforeSend: func(event *irontelemetry.TelemetryEvent) *irontelemetry.TelemetryEvent {
return event
},
})
```
## Documentation
For complete documentation, visit [irontelemetry.com/docs](https://irontelemetry.com/docs).
## Other SDKs
| Platform | Package |
|----------|---------|
| JavaScript/TypeScript | [@ironservices/telemetry](https://git.marketally.com/ironservices/irontelemetry-js) |
| .NET | [IronTelemetry.Client](https://git.marketally.com/ironservices/irontelemetry-dotnet) |
| Python | [irontelemetry](https://git.marketally.com/ironservices/irontelemetry-python) |
| Java | [irontelemetry-java](https://git.marketally.com/ironservices/irontelemetry-java) |
| Rust | [irontelemetry](https://git.marketally.com/ironservices/irontelemetry-rust) |
## Support
- **Documentation**: [irontelemetry.com/docs](https://irontelemetry.com/docs)
- **Email**: dev@ironservices.io
- **Issues**: [git.marketally.com/ironservices/irontelemetry-go/issues](https://git.marketally.com/ironservices/irontelemetry-go/issues)
## License
MIT License - see [LICENSE](LICENSE) for details.