Skip to content

Latest commit

 

History

History
261 lines (190 loc) · 7.44 KB

File metadata and controls

261 lines (190 loc) · 7.44 KB

Client-Kit: SDK Integration Tool

Automatisiertes Tool zur Integration des Sentry SDK in deine Anwendungen.

Features

  • Remote Installation - Direkt aus dem Git-Repo ausführbar, kein Klonen nötig
  • API-Modus - Automatisches Erstellen von Teams und Projekten via Bugsink API
  • Automatische Sprach-Erkennung - Erkennt Python, Node.js, TypeScript, Java, .NET, Go, PHP, Ruby
  • Minimale, nicht-destruktive Änderungen - Fügt nur Konfigurations-Dateien hinzu
  • Framework-Erkennung - Erkennt Django, Flask, Express, NestJS, etc.
  • 3 Modi: Neu einrichten, DSN aktualisieren, Client-Code aktualisieren
  • Cross-Platform - Läuft auf Windows, Linux, macOS

Quick Start (Remote - Empfohlen)

Führe das Client-Kit direkt aus dem Repository aus - ohne es vorher zu klonen:

Linux / macOS

# Im Projekt-Ordner ausführen
curl -sSL https://raw.githubusercontent.com/bauer-group/CS-ApplicationErrorObservability/main/client-kit/remote-install.sh | bash

# Mit DSN
curl -sSL https://raw.githubusercontent.com/bauer-group/CS-ApplicationErrorObservability/main/client-kit/remote-install.sh | bash -s -- --dsn "https://key@errors.example.com/1"

# Mit API-Modus (automatisches Projekt-Setup)
curl -sSL https://raw.githubusercontent.com/bauer-group/CS-ApplicationErrorObservability/main/client-kit/remote-install.sh | bash -s -- \
  --api-key "your-api-key" \
  --api-url "https://errors.example.com"

# Mit wget
wget -qO- https://raw.githubusercontent.com/bauer-group/CS-ApplicationErrorObservability/main/client-kit/remote-install.sh | bash

Windows (PowerShell)

# Im Projekt-Ordner ausführen
irm https://raw.githubusercontent.com/bauer-group/CS-ApplicationErrorObservability/main/client-kit/remote-install.ps1 | iex

# Mit DSN (erst herunterladen, dann ausführen)
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/bauer-group/CS-ApplicationErrorObservability/main/client-kit/remote-install.ps1" -OutFile install.ps1
.\install.ps1 -Dsn "https://key@errors.example.com/1"

# Mit API-Modus
.\install.ps1 -ApiKey "your-api-key" -ApiUrl "https://errors.example.com"

Lokale Installation

Falls du das Repo bereits geklont hast:

Option 1: Interaktiver Modus

# Linux/macOS
./install.sh

# Windows (PowerShell)
.\install.ps1

# Windows (CMD)
install.cmd

Option 2: Mit Parametern

# Mit DSN
./install.sh --dsn "https://key@errors.observability.app.bauer-group.com/1"

# Nur DSN aktualisieren
./install.sh --update-dsn --dsn "https://..."

# Client-Code aktualisieren
./install.sh --update-client

Option 3: Direkt mit Python

python install.py --dsn "https://key@host/1" --environment production

Workflow

Option A: API-Modus (Empfohlen)

Mit API-Key wird das Team und Projekt automatisch erstellt:

# Im Projekt-Root ausführen
cd /path/to/your/project

# Interaktiv - wählt Team/Projekt aus oder erstellt neue
./install.sh --api-key "your-key" --api-url "https://errors.example.com"

# Vollautomatisch - erstellt Team und Projekt falls nicht vorhanden
./install.sh --api-key "your-key" --api-url "https://errors.example.com" \
  --team "MyTeam" --project "MyApp"

Der Installer im API-Modus:

  1. Verbindet sich mit der Bugsink API
  2. Zeigt verfügbare Teams an oder erstellt ein neues
  3. Zeigt verfügbare Projekte an oder erstellt ein neues
  4. Holt den DSN automatisch
  5. Erkennt die Projekt-Sprache
  6. Installiert die SDK-Abhängigkeiten
  7. Erstellt eine Konfigurations-Datei
  8. Fügt den DSN zur .env hinzu

Option B: Manueller Modus

1. Projekt erstellen (manuell in Bugsink UI)

  1. Öffne dein Bugsink Dashboard
  2. Gehe zu Teams → wähle oder erstelle ein Team
  3. Gehe zu ProjectsNew Project
  4. Kopiere den DSN aus den Project Settings

2. SDK integrieren

# Im Projekt-Root ausführen
cd /path/to/your/project

# Installer ausführen
./install.sh --dsn "https://key@errors.example.com/1"

Der Installer:

  1. Erkennt die Projekt-Sprache automatisch
  2. Installiert die SDK-Abhängigkeiten
  3. Erstellt eine Konfigurations-Datei
  4. Fügt den DSN zur .env hinzu

3. Integration abschließen

Füge den Import in deinen Entry-Point ein (wird vom Installer angezeigt):

Python:

from sentry_config import init_sentry
init_sentry()

Node.js:

require('./sentry.config');

TypeScript:

import './sentry.config';

Befehle

Befehl Beschreibung
./install.sh Interaktiver Modus
./install.sh --dsn <DSN> Installation mit DSN
./install.sh --api-key <KEY> --api-url <URL> API-Modus (interaktiv)
./install.sh --api-key <KEY> --api-url <URL> --team <TEAM> --project <PROJECT> API-Modus (vollautomatisch)
./install.sh --update-dsn --dsn <DSN> Nur DSN aktualisieren
./install.sh --update-client Client-Code aus Templates aktualisieren
./install.sh --environment staging Environment setzen

Unterstützte Sprachen

Sprache Erkennung SDK-Paket
Python requirements.txt, pyproject.toml, Pipfile sentry-sdk
Node.js package.json @sentry/node
TypeScript tsconfig.json @sentry/node
Java pom.xml, build.gradle io.sentry:sentry
.NET *.csproj, *.sln Sentry
Go go.mod github.com/getsentry/sentry-go
PHP composer.json sentry/sentry
Ruby Gemfile sentry-ruby

Dateistruktur

Nach der Installation werden folgende Dateien erstellt:

your-project/
├── sentry_config.py      # Python
├── sentry.config.js      # Node.js
├── src/sentry.config.ts  # TypeScript
├── SentryConfig.java     # Java
├── SentryConfig.cs       # .NET
├── pkg/sentry/sentry.go  # Go
├── config/sentry.php     # PHP
├── config/initializers/sentry.rb  # Ruby
└── .env                  # DSN wird hier hinzugefügt

Umgebungsvariablen

Variable Beschreibung Default
SENTRY_DSN Bugsink/Sentry DSN -
SENTRY_ENVIRONMENT Environment-Name production
SENTRY_TRACES_SAMPLE_RATE Performance Sample-Rate 0.1
APP_VERSION Release-Version -
BUGSINK_API_KEY API-Key für automatisches Setup -
BUGSINK_API_URL Bugsink Server URL -
BUGSINK_TEAM Standard Team-Name für API-Modus -
BUGSINK_PROJECT Standard Projekt-Name für API-Modus -

Templates anpassen

Die Templates befinden sich in templates/<language>/. Du kannst sie anpassen:

  1. Template-Datei bearbeiten
  2. ./install.sh --update-client in Projekten ausführen

Platzhalter

Platzhalter Wird ersetzt durch
{{DSN}} Der konfigurierte DSN
{{ENVIRONMENT}} Das Environment
{{RELEASE}} Die Release-Version

Fehlerbehebung

"Python not found"

Installiere Python 3.7+:

"Could not detect project language"

Stelle sicher, dass eine der erkannten Dateien im Projekt-Root existiert:

  • Python: requirements.txt, pyproject.toml, setup.py
  • Node.js: package.json
  • etc.

DSN wird nicht erkannt

Setze die Umgebungsvariable oder übergebe sie als Parameter:

export SENTRY_DSN="https://..."
./install.sh

# oder
./install.sh --dsn "https://..."

Lizenz

Teil des Error Observability Projekts.