getsentry / getsentry/sentry-go

Set mechanism type to origin

Open
#1,102 1 comment 0 reactions 0 assignees View on GitHub
Errors Go Good First Issue Improvement
Dominant language
Go
Stars
1.1k
Forks
262
Avg merge
1d 48m
Merged PRs (30d)
7

Description

The SDK has two issues exception mechanisms:
- mechanism type is always `generic`. According to the [spec](https://develop.sentry.dev/sdk/telemetry/errors/#exception-mechanism), type must be non-generic for SDK captures, but we currently don't have a way to distinguish between the two.
- No real API to pass mechanism to the exception.

## Proposed Solution

Add a functional option `ExceptionOption` to `CaptureException`, `Recover`, and `RecoverWithContext` on both Hub and Client, so that we can inject `WithMechanism`:

```go
hub.CaptureException(err, sentry.WithMechanism(&sentry.Mechanism{
Type: "auto.http.go.gin.middleware",
Handled: false,
}))
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.