Zum Hauptinhalt springen

Sentry Smart-Home-Integration, kostenlos und Open Source

Sentry-Integration für Gladys Assistant

Your Sentry projects: unresolved issues, errors per hour, new issue and error spike scenes.

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

Follow the projects of your Sentry organization in Gladys: unresolved issues, errors of the last hour and of the last 24 hours, the newest issue, and start a scene on a new issue or an error spike. Works with sentry.io (US or EU data storage) and with a self-hosted Sentry. Read only: Gladys never changes anything in Sentry.

Unofficial integration, not affiliated with Sentry. It has never been tested with a real Sentry organization: it is written from the official Sentry API documentation and tested against a simulated Sentry. Reports are welcome.

What you need​

  • A Sentry organization, on sentry.io or self-hosted.
  • A personal token: in Sentry, User settings, Personal Tokens, Create New Token, with the read scopes org:read and event:read only (no write scope is needed). An organization token (sntrys_…) is limited to releases and cannot read issues.

Configuration​

  • Auth token: kept by Gladys in its database, never shown again, sent only to the Sentry chosen below, in the Authorization header. It never appears in the logs, the status, nor the files of the integration.
  • Where is your Sentry?: sentry.io, United States (sentry.io), sentry.io, European Union (de.sentry.io: check Settings, General, Data Storage Location of your organization), or Self-hosted Sentry.
  • Self-hosted Sentry URL (self-hosted only): https://sentry.example.com, with a path if Sentry sits behind a reverse proxy (https://example.com/sentry). The certificate must be one a browser accepts (a self-signed certificate is not supported yet). Plain http:// is accepted only for a private IP address of your network (http://192.168.1.5:9000): elsewhere the token would cross the Internet in clear.
  • Organization slug: the short name in your Sentry addresses (https://<slug>.sentry.io or /organizations/<slug>/).
  • Projects (optional): the slugs of the projects to follow, separated by commas, 20 at most. Empty: the first 20 projects of the organization, in slug order (the status says how many are left out).
  • Refresh: every 5, 10 (default), 15, 30 or 60 minutes.
  • Error spike threshold: 100 errors in the last hour by default (10 to 1,000,000).

Press Test the connection: it reads the project list once (at most once a minute) and says how many projects the token can see.

Devices​

Each followed project appears in the Discovery tab; add the ones you want. Features (read only):

  • Unresolved issues: the unresolved issues seen in the last 90 days, as Sentry estimates them (its X-Hits total). At its cap (1,000 on sentry.io), or when Sentry gives no total and there are more than 100, the value is not published: a count only known as "at least" is never shown as exact.
  • Errors in the last hour: the accepted errors of the current hour, plus the share of the previous hour still inside the last 60 minutes.
  • Errors in the last 24 h: the last 24 hourly buckets of Sentry, the oldest by its share still inside the last 24 hours.
  • Newest issue: the title of the most recent unresolved issue (- when there is none).

Scene triggers​

  • New Sentry issue: a new unresolved issue, first seen less than 2 hours ago by Sentry's clock (Sentry dates an issue by its first event, as the application's clock gave it: an application clock more than an hour late may hide a new issue). Each reading looks at the 100 newest unresolved issues and remembers 200 ids per project. Filters: the project, the levels. Variables: project name, issue title, short id, level, link. Never at the first reading of a project (the issues already there are not "new"); the reference is kept, so a restart neither repeats an issue nor loses one first seen less than 2 hours before. Five issues per project and per reading at most (a burst only starts five scenes).
  • Sentry error spike: a project counts, in the last hour, at least the threshold and three times its usual hour (the mean of the complete hours before the last two, 22 at most). Once per spike: it fires again only after the errors went under half the threshold. Not at the first reading, nor after a long gap without readings (2 intervals). Variables: project name, errors in the last hour, usual errors per hour, threshold.

Scenes start up to one refresh interval after the fact.

Requests and limits​

Each round sends two requests per project (its issues, its error counts), one at a time, plus the project list once an hour (and at the next round after a Scan). With 20 projects every 10 minutes, that is about 240 requests an hour. Sentry advises against frequent polling: keep the interval long if you follow many projects.

  • Sentry's rate limit headers are read: when no request is left in Sentry's window, the next one waits for the reset (10 s at most, else the rest of the round waits for the next round, starting where it stopped).
  • HTTP 429: every request waits until the reset Sentry gives (X-Sentry-Rate-Limit-Reset, or a Retry-After if one comes), else 1 minute doubling while it lasts; 1 minute at least, 6 hours at most. HTTP 5xx: the project concerned is spaced out like any failure; when two projects or the project list fail in the same round, every request waits the same way. The pause is kept across a restart; the test button does not send during it.
  • A failing reading of one project (HTTP 5xx, 403, 404, an unexpected answer) is tried again at the next round, then every 2, 4, 8... rounds (an hour at most); the other projects go on, and the next round starts after a project that caused a pause.
  • Answers are bounded in size (2 MB for the project list) and in time (15 s); redirects are never followed (the token would go along).
  • A restart (or Gladys reconnecting) never reads sooner than the interval: the time of the last round is kept in /data.

Errors​

  • Sentry refused the token (HTTP 401) on the project list: nothing is sent again, even after a restart, until you save a new token in the configuration or a press of Test the connection succeeds. A 401 on the issues or the counts of one project is not taken as a refusal: the project list is asked again at the next round, and only its answer decides.
  • HTTP 403 on the project list: the token lacks a scope (org:read, event:read).
  • HTTP 404: wrong organization slug, or the wrong region (US / EU).
  • Redirect not followed: often the wrong region, or an http URL that redirects to https.

Privacy​

Gladys keeps in /data only the time of the last round, a pause asked by Sentry, the ids and first-seen dates of the newest issues (for the new issue trigger) and, after a refusal, 8 bits of a salted fingerprint of the refused configuration (too little to help guess a token; erased by a success). Issue titles stay in Gladys (device states, scene variables): they may quote data of your applications.

Konfigurationseinstellungen​

Diese Einstellungen fragt Sentry in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
How it workssectionNeinGladys reads your Sentry organization (sentry.io in the US or the EU, or a self-hosted Sentry) through the official Sentry API, with an auth token, read only. Each project becomes a Gladys device (Discovery tab): unresolved issues, errors of the last hour and of the last 24 hours, title of the newest issue. Two scene triggers: "New Sentry issue" and "Sentry error spike". Create a personal token in Sentry, User settings, Personal Tokens, with the read scopes org:read and event:read only. Unofficial integration, not affiliated with Sentry.
Auth tokensecretJaA personal token with the read scopes org:read and event:read (no write scope is needed). Kept by Gladys in its database, never shown again, sent only to the Sentry of the region below, in the Authorization header.
Where is your Sentry?selectJaThe data storage location of your sentry.io organization (Settings, General: "Data Storage Location"), or your own Sentry.
Self-hosted Sentry URLstringNeinOnly for a self-hosted Sentry: its address, https (a certificate a browser accepts). Plain http only to a private IP address of your network.
Organization slugstringJaThe short name of your organization in the Sentry addresses (https://<slug>.sentry.io or /organizations/<slug>/).
Projects (optional)stringNeinSlugs of the projects to follow, separated by commas, 20 at most. Empty: the first 20 projects of the organization, in slug order.
RefreshselectJaHow often Gladys reads Sentry: two requests per project, plus the project list once an hour. Sentry advises against frequent polling: 5 minutes at the fastest.
Error spike thresholdnumberNein"Sentry error spike" fires when a project counts at least this many errors in the last hour, and at least three times its usual hour (the mean of the complete hours before the last two). Whole number, 10 to 1000000.

So installierst du Sentry in Gladys​

  1. Öffne in Gladys Integrationen: Sentry erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/lm1lc3n7/gladys-sentry:0.1.1) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/LM1LC3N7/gladys-sentry.

Sentry benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

Sentry ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von LM1LC3N7 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂