sentry

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sentry is Sentry as a source of production alerts: an issue alert rule whose action is kōjō's internal integration sends a webhook signed with the integration's Client Secret, and kōjō reads the alert's issue through Sentry's API with a token of the same integration.

Sentry's documentation: https://docs.sentry.io/organization/integrations/integration-platform/webhooks/ and https://docs.sentry.io/api/events/retrieve-an-issue/.

Index

Constants

View Source
const (
	// HeaderSignature is the hex HMAC-SHA256 of the body under the
	// integration's Client Secret.
	HeaderSignature = "Sentry-Hook-Signature"
	// HeaderResource names what the webhook is about: installation,
	// event_alert, issue, metric_alert, error, comment and more.
	HeaderResource = "Sentry-Hook-Resource"
	// HeaderRequestID is unique per delivery.
	HeaderRequestID = "Request-ID"
)

Headers of a Sentry webhook.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Source)

Option changes how New builds the source.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets the HTTP client of API calls.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets the logger.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source is one Sentry organization.

func New

func New(cfg config.Sentry, opts ...Option) (*Source, error)

New returns the Sentry source of a kojo.yaml section.

func (*Source) Check

func (s *Source) Check(ctx context.Context) error

Check implements alerts.Source: the token reads its organization.

func (*Source) Enrich

func (s *Source) Enrich(ctx context.Context, a *alerts.Alert) error

Enrich implements alerts.Source: the issue's short ID, page, status, event and user counts, and when it was first and last seen.

func (*Source) Name

func (s *Source) Name() string

Name implements alerts.Source.

func (*Source) ParseWebhook

func (s *Source) ParseWebhook(r *http.Request, body []byte) (*alerts.Delivery, error)

ParseWebhook implements alerts.Source. The signature is checked before anything is read, over the exact bytes Sentry signed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL