-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Publisher which directly supports GCP ErrorReporting.
- Loading branch information
1 parent
169fe0b
commit 4846ee8
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package errorreports | ||
|
||
import ( | ||
"cloud.google.com/go/errorreporting" | ||
) | ||
|
||
// Error can be used to build a `errorreporting.Entry`. | ||
type Error interface { | ||
error | ||
|
||
// ReportingEntry uses the saved error information to build | ||
// an `errorreporting.Entry`. | ||
ReportingEntry() *errorreporting.Entry | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package publisher | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/otto-de/sherlock-microservice/pkg/gcp/errorreports" | ||
) | ||
|
||
type Option struct { | ||
orderingKey string | ||
} | ||
|
||
func WithOrderingKey(orderingKey string) Option { | ||
return Option{ | ||
orderingKey: orderingKey, | ||
} | ||
} | ||
|
||
type Publisher[EV any] interface { | ||
// Publish publishes an Event to Target. | ||
Publish(ctx context.Context, event *EV, opts ...Option) errorreports.Error | ||
} |