sentry

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sentry implements the Sentry API connector. It populates `incidents` for repos configured in xray.toml whose Sentry project slug is mapped to a repo slug under [connectors.sentry.projects].

Endpoints used:

  • GET /organizations/{org}/ (Ping)
  • GET /projects/{org}/{project-slug}/issues/?... (Extract)

All requests authenticate via the `Authorization: Bearer <token>` header.

Simplifications versus the spec:

  • ResolvedAt is set to issue.lastSeen only when issue.status == "resolved". Sentry does not consistently expose a dedicated resolved-at timestamp on the issues list payload; lastSeen is the closest neutral signal. When the issue is not resolved the field is left nil.
  • ReleaseRef is taken from issue.firstRelease.shortVersion (falling back to firstRelease.version) as returned by the issues list endpoint. The connector does not fan out to GET /issues/{id}/ to expand release details; this avoids a per-issue request multiplier on large extractions at the cost of leaving ReleaseRef empty when firstRelease is absent from the list response.
  • AcknowledgedAt is always nil. Sentry has no native acknowledge concept distinct from status transitions; the canonical column is reserved for trackers (e.g. PagerDuty integrations) that surface it.
  • DeployID and CommitSHA are left empty. They are resolved later from ReleaseRef by the cross-cutting M10 pass that joins release identifiers across connectors.
  • IsRegression is a heuristic: true when issue.isUnhandled is true or when the lowercased issue message / culprit contains the substring "regression". Sentry's own regression flag is exposed on issue detail payloads, not on every list shape, so this remains a best-effort signal rather than a faithful mirror.
  • CulpritRef is the raw issue.culprit string. Sentry attributes this itself from event telemetry; the connector does not synthesise one when absent.

Window filter: an issue is emitted when its firstSeen falls inside the configured extraction window. Issues whose firstSeen predates the window are not emitted even if they had activity inside the window; this keeps the connector's behaviour predictable across re-runs.

Index

Constants

View Source
const DefaultBaseURL = "https://sentry.io/api/0"

DefaultBaseURL is the Sentry v0 API base URL.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Token        string
	Organization string
	Projects     map[string]string
	BaseURL      string
}

Config is the connector's input. BaseURL is exposed only for tests.

type Connector

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

Connector implements connector.Connector against the Sentry v0 API.

func New

func New(cfg config.SentryConn, log *slog.Logger) (*Connector, error)

New builds a Connector wired to the rate-limit transport. The token is the only authentication Sentry v0 exposes for these endpoints; an empty token is accepted at construction time and surfaced as a 401 at Ping.

func (*Connector) Extract

Extract walks every configured (sentry-slug -> repo-slug) entry that points at the given repo and emits one `incidents` row per Sentry issue whose firstSeen falls inside the window. Repos absent from the mapping produce zero rows and a successful (empty) provenance entry.

func (*Connector) Name

func (c *Connector) Name() string

Name returns the stable connector name used in `source` columns and the manifest's `extraction_provenance` entries.

func (*Connector) Ping

func (c *Connector) Ping(ctx context.Context) error

Ping performs a read-only authentication check against the configured Sentry organisation. Used by `xray check`. A 401 is fatal; the token is rejected outright. Other non-2xx responses are surfaced verbatim.

Jump to

Keyboard shortcuts

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