Skip to content

Conversation

@philprime
Copy link
Member

📜 Description

This pull request introduces a new metrics integration to the Sentry SDK for Swift, allowing users to enable metrics collection and reporting via the SDK. The changes include the addition of the enableMetrics option, implementation of the metrics integration, updates to the SDK configuration, and new tests to verify the integration. The project structure is also updated to include the new integration and its tests.

Metrics Integration Feature:

  • Added a new enableMetrics option to SentryOptions, allowing users to enable or disable metrics collection. [1] [2]
  • Implemented MetricsIntegration, which is installed when enableMetrics is set to true. [1] [2]
  • Updated the SDK wrapper and options validation to support the new enableMetrics option. [1] [2]
  • Updated the enabled features builder to include "metrics" when the feature is enabled.

💡 Motivation and Context

Closes #6954

💚 How did you test it?

  • Added unit tests based on the existing option enableLogs
  • Added unit tests based on the session replay integration
  • Added option to enable metrics to run arguments in scheme
    • Enabled the option, ran the macOS sample app and checked that the "Integration initialized" log message shows up.

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

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

Generated by 🚫 dangerJS against e5611fb

@philprime philprime self-assigned this Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (philprime/metrics@98f1703). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rces/Sentry/SentryDependencyContainerSwiftHelper.m 0.000% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##             philprime/metrics     #6956   +/-   ##
=====================================================
  Coverage                     ?   84.700%           
=====================================================
  Files                        ?       449           
  Lines                        ?     27380           
  Branches                     ?     12025           
=====================================================
  Hits                         ?     23191           
  Misses                       ?      4143           
  Partials                     ?        46           
Files with missing lines Coverage Δ
SentryTestUtils/Sources/TestOptions.swift 100.000% <100.000%> (ø)
Sources/Sentry/SentryOptionsInternal.m 99.470% <100.000%> (ø)
Sources/Swift/Core/Integrations/Integrations.swift 100.000% <100.000%> (ø)
...es/Swift/Helper/SentryEnabledFeaturesBuilder.swift 100.000% <100.000%> (ø)
...wift/Integrations/Metrics/MetricsIntegration.swift 100.000% <100.000%> (ø)
Sources/Swift/Options.swift 100.000% <100.000%> (ø)
...rces/Sentry/SentryDependencyContainerSwiftHelper.m 63.157% <0.000%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98f1703...e5611fb. Read the comment docs.

@philprime philprime marked this pull request as draft December 2, 2025 13:57
@philprime
Copy link
Member Author

@cursor review
@sentry review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


@philprime philprime force-pushed the philprime/metrics-bootstrap branch from a5056fb to 1210307 Compare December 2, 2025 15:13
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