Skip to content

feat: add sentry_is_enabled() - #2045

Merged
jpnurmi merged 1 commit into
masterfrom
jpnurmi/feat/is-enabled
Sep 2, 2026
Merged

feat: add sentry_is_enabled()#2045
jpnurmi merged 1 commit into
masterfrom
jpnurmi/feat/is-enabled

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Adds sentry_is_enabled() as a thread-safe public API for checking whether the SDK has completed initialization and has not yet been closed. It returns 0 before initialization, after initialization failure, and after sentry_close().

This is inspired by many other Sentry SDKs, and motivated by #1980, which needs a way to determine whether the SDK is initialized to avoid duplicating private state checks in the logging and metrics implementations.

Originally proposed by @limbonaut in #2000 (comment)

Other SDKs usually provide is_enabled() to check whether it's initialized. Just an idea, and probably out of scope for this PR.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against ba0f821

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.41%. Comparing base (de1d458) to head (ba0f821).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2045      +/-   ##
==========================================
+ Coverage   74.37%   74.41%   +0.03%     
==========================================
  Files         103      103              
  Lines       26665    26670       +5     
  Branches     4852     4852              
==========================================
+ Hits        19832    19846      +14     
+ Misses       5501     5488      -13     
- Partials     1332     1336       +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JoshuaMoelans JoshuaMoelans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice addition 🚀

@jpnurmi
jpnurmi merged commit 307bae3 into master Sep 2, 2026
73 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/feat/is-enabled branch September 2, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants