Skip to content

feat(scope): Scoped logs and metrics capture#1861

Merged
limbonaut merged 17 commits into
masterfrom
limbonaut/feat/scoped-logs-metrics
Jul 17, 2026
Merged

feat(scope): Scoped logs and metrics capture#1861
limbonaut merged 17 commits into
masterfrom
limbonaut/feat/scoped-logs-metrics

Conversation

@limbonaut

@limbonaut limbonaut commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

This PR makes scope attributes a public, working part of the API. It promotes the previously-internal sentry_scope_set_attribute/_n and sentry_scope_remove_attribute/_n to public, and adds sentry_scope_capture_log and sentry_scope_capture_metric so a log or metric can be captured against a specific scope and pick up that scope's attributes and trace. Both trace and attributes now flow onto logs and metrics with spec-correct precedence, resolving most-specific-first: per-call attributes, then the passed scope, then the global scope.

Needed for current scopes and performance API in the Godot SDK. See rationale in #1838.

I plan to add sentry_scope_set_span/transaction and also sentry_scope_clear as follow-ups.

@limbonaut
limbonaut marked this pull request as ready for review July 16, 2026 12:18
@limbonaut limbonaut changed the title WIP: Scoped logs and metrics capture feat(scope): Scoped logs and metrics capture Jul 16, 2026
Comment thread src/sentry_scope.h Outdated
@github-actions

github-actions Bot commented Jul 16, 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 f4947b8

@limbonaut

limbonaut commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

To check how it would be used, you can see my WIP implementation over here (see NativeSDK::metrics_add_X and project/test/isolated/ tests):

Comment thread src/sentry_scope.c

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f9cb8a1. Configure here.

Comment thread src/sentry_scope.c
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.53%. Comparing base (88e7bae) to head (f4947b8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1861      +/-   ##
==========================================
- Coverage   75.56%   75.53%   -0.03%     
==========================================
  Files          90       90              
  Lines       21154    21169      +15     
  Branches     3759     3763       +4     
==========================================
+ Hits        15986    15991       +5     
- Misses       4334     4350      +16     
+ Partials      834      828       -6     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@limbonaut
limbonaut merged commit 947def6 into master Jul 17, 2026
67 checks passed
@limbonaut
limbonaut deleted the limbonaut/feat/scoped-logs-metrics branch July 17, 2026 10:49
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.

2 participants