Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/go-coldbrew/errors
go 1.25.0

require (
github.com/getsentry/raven-go v0.2.0
github.com/getsentry/sentry-go v0.43.0
github.com/go-coldbrew/log v0.2.5
github.com/go-coldbrew/options v0.2.4
github.com/google/uuid v1.6.0
Expand All @@ -14,13 +14,12 @@ require (
)

require (
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.1 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.39.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.33.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/protobuf v1.36.10 // indirect
)
12 changes: 8 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d h1:S2NE3iHSwP0XV47EEXL8mWmRdEfGscSJ+7EgePNgt0s=
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/getsentry/sentry-go v0.43.0 h1:XbXLpFicpo8HmBDaInk7dum18G9KSLcjZiyUKS+hLW4=
github.com/getsentry/sentry-go v0.43.0/go.mod h1:XDotiNZbgf5U8bPDUAfvcFmOnMQQceESxyKaObSssW0=
github.com/go-coldbrew/log v0.2.5 h1:GEa7m6fe2GF7u6LxDT2TUDNS1BzR5kGPU1D8eLIzl0I=
github.com/go-coldbrew/log v0.2.5/go.mod h1:Lrlc9y4H4tykAiekqwFgkufULf4Parh2KnnmbiDmeX4=
github.com/go-coldbrew/options v0.2.4 h1:aGcjQWhXjibRRN1XVc3mzz2IAKxNlVC4+xyhrGnSRKg=
github.com/go-coldbrew/options v0.2.4/go.mod h1:RstwV0WeRJyUN2/P7M0l67LTsLeUfCXkaLU2LrXRx7M=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
Expand Down Expand Up @@ -47,6 +47,8 @@ github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28=
github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -59,6 +61,8 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8
github.com/stvp/rollbar v0.5.1 h1:qvyWbd0RNL5V27MBumqCXlcU7ohmHeEtKX+Czc8oeuw=
github.com/stvp/rollbar v0.5.1/go.mod h1:/fyFC854GgkbHRz/rSsiYc6h84o0G5hxBezoQqRK7Ho=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
44 changes: 22 additions & 22 deletions notifier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ import "github.com/go-coldbrew/errors/notifier"


<a name="Close"></a>
## func [Close](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L425>)
## func [Close](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L466>)

```go
func Close()
```

Close closes the airbrake notifier and flushes the error queue. You should call Close before app shutdown. Close doesn't call os.Exit.
Close closes the airbrake notifier and flushes pending Sentry events. Sentry events are flushed with a 2 second timeout. You should call Close before app shutdown. Close doesn't call os.Exit.

<a name="GetTraceHeaderName"></a>
## func [GetTraceHeaderName](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L87>)
## func [GetTraceHeaderName](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L90>)

```go
func GetTraceHeaderName() string
Expand All @@ -57,7 +57,7 @@ func GetTraceHeaderName() string
GetTraceHeaderName gets the header name for trace id default is x\-trace\-id

<a name="GetTraceId"></a>
## func [GetTraceId](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L482>)
## func [GetTraceId](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L526>)

```go
func GetTraceId(ctx context.Context) string
Expand All @@ -66,7 +66,7 @@ func GetTraceId(ctx context.Context) string
GetTraceId fetches traceID from context if no trace id is found then it will return empty string

<a name="InitAirbrake"></a>
## func [InitAirbrake](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L107>)
## func [InitAirbrake](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L110>)

```go
func InitAirbrake(projectID int64, projectKey string)
Expand All @@ -75,7 +75,7 @@ func InitAirbrake(projectID int64, projectKey string)
InitAirbrake inits airbrake configuration projectID: airbrake project id projectKey: airbrake project key

<a name="InitRollbar"></a>
## func [InitRollbar](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L114>)
## func [InitRollbar](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L117>)

```go
func InitRollbar(token, env string)
Expand All @@ -84,7 +84,7 @@ func InitRollbar(token, env string)
InitRollbar inits rollbar configuration token: rollbar token env: rollbar environment

<a name="InitSentry"></a>
## func [InitSentry](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L122>)
## func [InitSentry](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L125>)

```go
func InitSentry(dsn string)
Expand All @@ -93,7 +93,7 @@ func InitSentry(dsn string)
InitSentry inits sentry configuration dsn: sentry dsn

<a name="Notify"></a>
## func [Notify](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L213>)
## func [Notify](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L235>)

```go
func Notify(err error, rawData ...interface{}) error
Expand All @@ -102,7 +102,7 @@ func Notify(err error, rawData ...interface{}) error
Notify notifies error to airbrake, rollbar and sentry if they are inited and error is not ignored err: error to notify rawData: extra data to notify with error \(can be context.Context, Tags, or any other data\) when rawData is context.Context, it will used to get extra data from loggers.FromContext\(ctx\) and tags from metadata

<a name="NotifyAsync"></a>
## func [NotifyAsync](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L60>)
## func [NotifyAsync](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L63>)

```go
func NotifyAsync(err error, rawData ...interface{}) error
Expand All @@ -111,7 +111,7 @@ func NotifyAsync(err error, rawData ...interface{}) error
NotifyAsync sends an error notification asynchronously with bounded concurrency. If the async notification pool is full, the notification is dropped to prevent goroutine explosion under sustained error bursts. Returns the original error for convenience.

<a name="NotifyOnPanic"></a>
## func [NotifyOnPanic](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L381>)
## func [NotifyOnPanic](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L428>)

```go
func NotifyOnPanic(rawData ...interface{})
Expand All @@ -120,7 +120,7 @@ func NotifyOnPanic(rawData ...interface{})
NotifyOnPanic notifies error to airbrake, rollbar and sentry if they are inited and error is not ignored rawData: extra data to notify with error \(can be context.Context, Tags, or any other data\) when rawData is context.Context, it will used to get extra data from loggers.FromContext\(ctx\) and tags from metadata this function should be called in defer example: defer NotifyOnPanic\(ctx, "some data"\) example: defer NotifyOnPanic\(ctx, "some data", Tags\{"tag1": "value1"\}\)

<a name="NotifyWithExclude"></a>
## func [NotifyWithExclude](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L350>)
## func [NotifyWithExclude](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L397>)

```go
func NotifyWithExclude(err error, rawData ...interface{}) error
Expand All @@ -129,7 +129,7 @@ func NotifyWithExclude(err error, rawData ...interface{}) error
NotifyWithExclude notifies error to airbrake, rollbar and sentry if they are inited and error is not ignored err: error to notify rawData: extra data to notify with error \(can be context.Context, Tags, or any other data\) when rawData is context.Context, it will used to get extra data from loggers.FromContext\(ctx\) and tags from metadata

<a name="NotifyWithLevel"></a>
## func [NotifyWithLevel](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L222>)
## func [NotifyWithLevel](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L244>)

```go
func NotifyWithLevel(err error, level string, rawData ...interface{}) error
Expand All @@ -138,7 +138,7 @@ func NotifyWithLevel(err error, level string, rawData ...interface{}) error
NotifyWithLevel notifies error to airbrake, rollbar and sentry if they are inited and error is not ignored err: error to notify level: error level rawData: extra data to notify with error \(can be context.Context, Tags, or any other data\) when rawData is context.Context, it will used to get extra data from loggers.FromContext\(ctx\) and tags from metadata

<a name="NotifyWithLevelAndSkip"></a>
## func [NotifyWithLevelAndSkip](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L232>)
## func [NotifyWithLevelAndSkip](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L295>)

```go
func NotifyWithLevelAndSkip(err error, skip int, level string, rawData ...interface{}) error
Expand All @@ -147,7 +147,7 @@ func NotifyWithLevelAndSkip(err error, skip int, level string, rawData ...interf
NotifyWithLevelAndSkip notifies error to airbrake, rollbar and sentry if they are inited and error is not ignored err: error to notify skip: skip stack frames when notify error level: error level rawData: extra data to notify with error \(can be context.Context, Tags, or any other data\) when rawData is context.Context, it will used to get extra data from loggers.FromContext\(ctx\) and tags from metadata

<a name="SetEnvironment"></a>
## func [SetEnvironment](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L433>)
## func [SetEnvironment](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L477>)

```go
func SetEnvironment(env string)
Expand All @@ -156,7 +156,7 @@ func SetEnvironment(env string)
SetEnvironment sets the environment. The environment is used to distinguish errors occurring in different

<a name="SetHostname"></a>
## func [SetHostname](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L518>)
## func [SetHostname](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L562>)

```go
func SetHostname(name string)
Expand All @@ -165,7 +165,7 @@ func SetHostname(name string)
SetHostname sets the hostname of the server. The hostname is used to identify the server that logged an error.

<a name="SetMaxAsyncNotifications"></a>
## func [SetMaxAsyncNotifications](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L48>)
## func [SetMaxAsyncNotifications](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L51>)

```go
func SetMaxAsyncNotifications(n int)
Expand All @@ -174,7 +174,7 @@ func SetMaxAsyncNotifications(n int)
SetMaxAsyncNotifications sets the maximum number of concurrent async notification goroutines. When the limit is reached, new async notifications are dropped to prevent goroutine explosion under sustained error bursts. Default is 1000. Can only be called once; subsequent calls are no\-ops.

<a name="SetRelease"></a>
## func [SetRelease](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L446>)
## func [SetRelease](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L490>)

```go
func SetRelease(rel string)
Expand All @@ -183,7 +183,7 @@ func SetRelease(rel string)
SetRelease sets the release tag. The release tag is used to group errors together by release.

<a name="SetServerRoot"></a>
## func [SetServerRoot](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L512>)
## func [SetServerRoot](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L556>)

```go
func SetServerRoot(path string)
Expand All @@ -192,7 +192,7 @@ func SetServerRoot(path string)
SetServerRoot sets the root directory of the project. The root directory is used to trim prefixes from filenames in stack traces.

<a name="SetTraceHeaderName"></a>
## func [SetTraceHeaderName](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L81>)
## func [SetTraceHeaderName](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L84>)

```go
func SetTraceHeaderName(name string)
Expand All @@ -201,7 +201,7 @@ func SetTraceHeaderName(name string)
SetTraceHeaderName sets the header name for trace id default is x\-trace\-id

<a name="SetTraceId"></a>
## func [SetTraceId](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L453>)
## func [SetTraceId](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L497>)

```go
func SetTraceId(ctx context.Context) context.Context
Expand All @@ -210,7 +210,7 @@ func SetTraceId(ctx context.Context) context.Context
SetTraceId updates the traceID based on context values if no trace id is found then it will create one and update the context You should use the context returned by this function instead of the one passed

<a name="UpdateTraceId"></a>
## func [UpdateTraceId](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L502>)
## func [UpdateTraceId](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L546>)

```go
func UpdateTraceId(ctx context.Context, traceID string) context.Context
Expand All @@ -219,7 +219,7 @@ func UpdateTraceId(ctx context.Context, traceID string) context.Context
UpdateTraceId force updates the traced id to provided id if no trace id is found then it will create one and update the context You should use the context returned by this function instead of the one passed

<a name="Tags"></a>
## type [Tags](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L96>)
## type [Tags](<https://github.com/go-coldbrew/errors/blob/main/notifier/notifier.go#L99>)



Expand Down
Loading
Loading