Update README with branded header and documentation links
- Add centered logo and title with product branding - Add links to product website and documentation - Add badges for package manager and license - Add Other SDKs table with cross-references - Add Support section with dev@ironservices.io email - Update repository links to git.marketally.com 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6c48eaa977
commit
3853a739cc
302
README.md
302
README.md
|
|
@ -1,33 +1,60 @@
|
|||
# IronTelemetry SDK for Go
|
||||
<p align="center">
|
||||
<a href="https://irontelemetry.com">
|
||||
<img src="https://irontelemetry.com/logo.png" alt="IronTelemetry" width="120" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
Error monitoring and crash reporting SDK for Go applications. Capture exceptions, track user journeys, and get insights to fix issues faster.
|
||||
<h1 align="center">IronTelemetry SDK for Go</h1>
|
||||
|
||||
[](https://pkg.go.dev/github.com/IronServices/irontelemetry-go)
|
||||
[](https://goreportcard.com/report/github.com/IronServices/irontelemetry-go)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
<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 github.com/IronServices/irontelemetry-go
|
||||
go get git.marketally.com/ironservices/irontelemetry-go
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Basic Exception Capture
|
||||
### Initialize the SDK
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
irontelemetry "github.com/IronServices/irontelemetry-go"
|
||||
irontelemetry "git.marketally.com/ironservices/irontelemetry-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Initialize with your DSN
|
||||
client, err := irontelemetry.New(irontelemetry.Options{
|
||||
DSN: "https://pk_live_xxx@irontelemetry.com",
|
||||
})
|
||||
|
|
@ -35,66 +62,22 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
// Capture exceptions
|
||||
if err := doSomething(); err != nil {
|
||||
client.CaptureException(err)
|
||||
}
|
||||
}
|
||||
|
||||
func doSomething() error {
|
||||
return errors.New("something went wrong")
|
||||
}
|
||||
```
|
||||
|
||||
### Journey Tracking
|
||||
|
||||
Track user journeys to understand the context of errors:
|
||||
### Capture Errors
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
irontelemetry "github.com/IronServices/irontelemetry-go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
client, _ := irontelemetry.New(irontelemetry.Options{
|
||||
DSN: "https://pk_live_xxx@irontelemetry.com",
|
||||
})
|
||||
defer client.Close()
|
||||
|
||||
// Start a journey
|
||||
journey := client.StartJourney("Checkout Flow")
|
||||
journey.SetUser("user-123", "user@example.com", "John Doe")
|
||||
|
||||
// Track steps
|
||||
step := journey.StartStep("Validate Cart", irontelemetry.CategoryBusiness)
|
||||
if err := validateCart(); err != nil {
|
||||
step.Fail(err)
|
||||
journey.Fail(err)
|
||||
client.CaptureException(err)
|
||||
return
|
||||
}
|
||||
step.Complete()
|
||||
|
||||
step = journey.StartStep("Process Payment", irontelemetry.CategoryBusiness)
|
||||
if err := processPayment(); err != nil {
|
||||
step.Fail(err)
|
||||
journey.Fail(err)
|
||||
client.CaptureException(err)
|
||||
return
|
||||
}
|
||||
step.Complete()
|
||||
|
||||
journey.Complete()
|
||||
if err := doSomething(); err != nil {
|
||||
client.CaptureException(err)
|
||||
}
|
||||
```
|
||||
|
||||
Or use the helper method:
|
||||
### 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()
|
||||
|
|
@ -105,18 +88,22 @@ if err != nil {
|
|||
return
|
||||
}
|
||||
|
||||
err = journey.RunStep("Process Payment", irontelemetry.CategoryBusiness, func() error {
|
||||
return processPayment()
|
||||
})
|
||||
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
|
||||
|
|
@ -124,179 +111,32 @@ client, err := irontelemetry.New(irontelemetry.Options{
|
|||
DSN: "https://pk_live_xxx@irontelemetry.com",
|
||||
Environment: "production",
|
||||
AppVersion: "1.2.3",
|
||||
SampleRate: 1.0, // 100% of events
|
||||
Debug: false,
|
||||
SampleRate: 1.0,
|
||||
BeforeSend: func(event *irontelemetry.TelemetryEvent) *irontelemetry.TelemetryEvent {
|
||||
// Filter or modify events
|
||||
if strings.Contains(event.Message, "expected") {
|
||||
return nil // Drop the event
|
||||
}
|
||||
return event
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
### Configuration Options
|
||||
## Documentation
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `DSN` | string | required | Your Data Source Name |
|
||||
| `Environment` | string | "production" | Environment name |
|
||||
| `AppVersion` | string | "0.0.0" | Application version |
|
||||
| `SampleRate` | float64 | 1.0 | Sample rate (0.0 to 1.0) |
|
||||
| `MaxBreadcrumbs` | int | 100 | Max breadcrumbs to keep |
|
||||
| `Debug` | bool | false | Enable debug logging |
|
||||
| `BeforeSend` | func | nil | Hook to filter/modify events |
|
||||
| `EnableOfflineQueue` | bool | true | Enable offline queue |
|
||||
| `MaxOfflineQueueSize` | int | 500 | Max offline queue size |
|
||||
For complete documentation, visit [irontelemetry.com/docs](https://irontelemetry.com/docs).
|
||||
|
||||
## Features
|
||||
## Other SDKs
|
||||
|
||||
- **Automatic Stack Traces**: Full stack traces captured with every exception
|
||||
- **Journey Tracking**: Track user flows and correlate errors with context
|
||||
- **Breadcrumbs**: Leave a trail of events leading up to an error
|
||||
- **User Context**: Associate errors with specific users
|
||||
- **Tags & Extras**: Add custom metadata to your events
|
||||
- **Context Support**: Full context.Context support for cancellation
|
||||
- **Thread-Safe**: All operations are safe for concurrent use
|
||||
| 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) |
|
||||
|
||||
## Breadcrumbs
|
||||
## Support
|
||||
|
||||
```go
|
||||
// Add simple breadcrumbs
|
||||
client.AddBreadcrumb("User clicked checkout button", irontelemetry.CategoryUI)
|
||||
client.AddBreadcrumb("Payment API called", irontelemetry.CategoryHTTP)
|
||||
|
||||
// With level
|
||||
client.AddBreadcrumbWithLevel(
|
||||
"User logged in",
|
||||
irontelemetry.CategoryAuth,
|
||||
irontelemetry.SeverityInfo,
|
||||
)
|
||||
|
||||
// With data
|
||||
client.AddBreadcrumbWithData(
|
||||
"API request completed",
|
||||
irontelemetry.CategoryHTTP,
|
||||
irontelemetry.SeverityInfo,
|
||||
map[string]any{
|
||||
"url": "/api/checkout",
|
||||
"statusCode": 200,
|
||||
"duration": 150,
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
### Breadcrumb Categories
|
||||
|
||||
```go
|
||||
irontelemetry.CategoryUI // User interface interactions
|
||||
irontelemetry.CategoryHTTP // HTTP requests
|
||||
irontelemetry.CategoryNavigation // Page/route navigation
|
||||
irontelemetry.CategoryConsole // Console output
|
||||
irontelemetry.CategoryAuth // Authentication events
|
||||
irontelemetry.CategoryBusiness // Business logic events
|
||||
irontelemetry.CategoryNotification // Notification events
|
||||
irontelemetry.CategoryCustom // Custom events
|
||||
```
|
||||
|
||||
## Severity Levels
|
||||
|
||||
```go
|
||||
irontelemetry.SeverityDebug
|
||||
irontelemetry.SeverityInfo
|
||||
irontelemetry.SeverityWarning
|
||||
irontelemetry.SeverityError
|
||||
irontelemetry.SeverityFatal
|
||||
```
|
||||
|
||||
## User Context
|
||||
|
||||
```go
|
||||
// Simple user ID
|
||||
client.SetUserByID("user-123")
|
||||
|
||||
// With email
|
||||
client.SetUserWithEmail("user-123", "user@example.com")
|
||||
|
||||
// Full user object
|
||||
client.SetUser(&irontelemetry.User{
|
||||
ID: "user-123",
|
||||
Email: "user@example.com",
|
||||
Name: "John Doe",
|
||||
Data: map[string]any{
|
||||
"plan": "premium",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
## Tags and Extra Data
|
||||
|
||||
```go
|
||||
// Set individual tags
|
||||
client.SetTag("release", "v1.2.3")
|
||||
client.SetTag("server", "prod-1")
|
||||
|
||||
// Set multiple tags
|
||||
client.SetTags(map[string]string{
|
||||
"release": "v1.2.3",
|
||||
"server": "prod-1",
|
||||
})
|
||||
|
||||
// Set extra data
|
||||
client.SetExtra("request_id", "abc-123")
|
||||
client.SetExtras(map[string]any{
|
||||
"request_id": "abc-123",
|
||||
"user_agent": "Mozilla/5.0...",
|
||||
})
|
||||
```
|
||||
|
||||
## Context Support
|
||||
|
||||
All capture methods support context for cancellation:
|
||||
|
||||
```go
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
result := client.CaptureExceptionWithContext(ctx, err)
|
||||
if !result.Success {
|
||||
log.Printf("Failed to send event: %s", result.Error)
|
||||
}
|
||||
```
|
||||
|
||||
## HTTP Middleware Example
|
||||
|
||||
```go
|
||||
func TelemetryMiddleware(client *irontelemetry.Client) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
client.AddBreadcrumbWithData(
|
||||
"HTTP Request",
|
||||
irontelemetry.CategoryHTTP,
|
||||
irontelemetry.SeverityInfo,
|
||||
map[string]any{
|
||||
"method": r.Method,
|
||||
"url": r.URL.String(),
|
||||
},
|
||||
)
|
||||
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
client.CaptureException(fmt.Errorf("panic: %v", err))
|
||||
panic(err) // Re-panic
|
||||
}
|
||||
}()
|
||||
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Go 1.21+
|
||||
- **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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue