Top Related Projects
Official Sentry SDKs for JavaScript
Quick Overview
Sentry is an open-source error tracking and performance monitoring platform. It helps developers identify, triage, and resolve software issues in real-time across various programming languages and frameworks. Sentry provides detailed error reports, stack traces, and performance insights to improve application reliability and user experience.
Pros
- Supports multiple programming languages and frameworks
- Provides real-time error tracking and performance monitoring
- Offers detailed error reports and stack traces for efficient debugging
- Integrates easily with popular development tools and workflows
Cons
- Can be complex to set up and configure for large-scale applications
- Self-hosted version requires significant server resources
- Learning curve for utilizing all features effectively
- Free tier has limitations on event volume and retention
Code Examples
- Basic error capturing in Python:
import sentry_sdk
sentry_sdk.init("https://examplePublicKey@o0.ingest.sentry.io/0")
def divide_by_zero():
1 / 0
try:
divide_by_zero()
except Exception as e:
sentry_sdk.capture_exception(e)
- Performance monitoring in JavaScript:
import * as Sentry from "@sentry/browser";
import { BrowserTracing } from "@sentry/tracing";
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [new BrowserTracing()],
tracesSampleRate: 1.0,
});
const transaction = Sentry.startTransaction({
op: "test",
name: "My First Test Transaction",
});
setTimeout(() => {
try {
foo();
} catch (e) {
Sentry.captureException(e);
} finally {
transaction.finish();
}
}, 99);
- Custom context in Ruby:
require 'sentry-ruby'
Sentry.init do |config|
config.dsn = 'https://examplePublicKey@o0.ingest.sentry.io/0'
end
Sentry.set_context('character', {
name: 'Mighty Fighter',
age: 19,
attack_type: 'melee'
})
begin
1 / 0
rescue ZeroDivisionError => exception
Sentry.capture_exception(exception)
end
Getting Started
To start using Sentry in your project:
- Sign up for a Sentry account at https://sentry.io/
- Create a new project and obtain your DSN
- Install the Sentry SDK for your programming language:
# For Python
pip install --upgrade sentry-sdk
# For JavaScript
npm install --save @sentry/browser @sentry/tracing
# For Ruby
gem install sentry-ruby
- Initialize Sentry in your application code (see code examples above)
- Deploy your application and monitor errors in the Sentry dashboard
Competitor Comparisons
Official Sentry SDKs for JavaScript
Pros of sentry-javascript
- Lightweight and focused specifically on JavaScript environments
- Easier integration for JavaScript-only projects
- More frequent updates and releases tailored to JavaScript ecosystem
Cons of sentry-javascript
- Limited to JavaScript/TypeScript environments
- Lacks some advanced features available in the main Sentry SDK
- Requires additional setup for non-JavaScript platforms
Code Comparison
sentry-javascript:
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
integrations: [new Sentry.BrowserTracing()],
tracesSampleRate: 1.0,
});
sentry:
import sentry_sdk
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
traces_sample_rate=1.0
)
Summary
sentry-javascript is a specialized SDK for JavaScript environments, offering easier integration and more frequent updates for JavaScript projects. However, it lacks some advanced features and cross-platform support available in the main Sentry SDK. The choice between the two depends on the project's specific requirements and the development environment.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Users and logs provide clues. Sentry provides answers.
What's Sentry?
Sentry is a developer-first error tracking and performance monitoring platform that helps developers see what actually matters, solve quicker, and learn continuously about their applications.
Official Sentry SDKs
- JavaScript
- Electron
- React-Native
- Python
- Ruby
- PHP
- Laravel
- Go
- Rust
- Java/Kotlin
- Objective-C/Swift
- C#/F#
- C/C++
- Dart
- Perl
- Clojure
- Elixir
- Unity
- Unreal Engine
- PowerShell
Resources
- Documentation
- Discussions (Bugs, feature requests, general questions)
- Discord
- Contributing
- Bug Tracker
- Code
- Transifex (Translate Sentry!)
Top Related Projects
Official Sentry SDKs for JavaScript
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot