sentry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package sentry provides Console status providers backed by Sentry's API. Provider reports the health of a Sentry project from its current unresolved issue count (GET /api/0/projects/{org}/{project}/issues/?query=is:unresolved). The count is accurate up to one page (100) and saturates beyond that.

It satisfies the status.Provider interface structurally (Name + Check), so it does not import the status package and adds no coupling beyond core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option configures a Provider.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the Sentry API base URL (testing / self-hosted).

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets the HTTP client.

func WithToken

func WithToken(t string) Option

WithToken sets the default auth token.

type Provider

type Provider struct {
	// Token is the default Sentry auth token, used when a component does not set
	// "auth_token". Typically sourced from the SENTRY_AUTH_TOKEN env var.
	Token string
	// BaseURL is the Sentry API base URL; defaults to Sentry's. Overridable for
	// testing or a self-hosted instance.
	BaseURL string
	// HTTP issues the API request. If nil, a client with a sane timeout is used.
	HTTP *http.Client
}

Provider checks a Sentry project's health from its unresolved issue count. The number of currently unresolved issues maps to a health state.

It reads its target from core.Component.Config:

org             required; the Sentry organization slug
project         required; the Sentry project slug
auth_token      optional; overrides the provider's default token
degraded_count  optional; issue count at/above which state is degraded (default 1)
down_count      optional; issue count at/above which state is down (default 10)
timeout         optional; API call timeout as a Go duration, default "10s"

State mapping (count = number of currently unresolved issues, capped at 100):

count < degraded_count                  -> StateOperational
degraded_count <= count < down_count    -> StateDegraded
count >= down_count                     -> StateDown
API/network failure or non-2xx          -> StateDown
no org / project / token                -> StateUnknown (configuration gap)

func New

func New(opts ...Option) *Provider

New builds a Provider from options.

func (*Provider) Check

func (p *Provider) Check(ctx context.Context, comp core.Component) core.Check

Check fetches the project's unresolved issues and maps their count to a health state.

func (*Provider) Name

func (p *Provider) Name() string

Name identifies the provider.

Jump to

Keyboard shortcuts

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