-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add sampling configuration for profiling (#2004)
Adds two new configuration options, profilesSampleRate and profilesSampler to mirror tracesSampleRate and tracesSampler, except for profiling data. There are no breaking changes -- enableProfiling is now deprecated, but will continue to work for existing clients that use it (this is equivalent to setting profilesSampleRate to 1.0)
- Loading branch information
Showing
22 changed files
with
546 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#import "SentryRandom.h" | ||
#import "SentrySampleDecision.h" | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class SentryOptions, SentrySamplingContext, SentryTracesSamplerDecision; | ||
|
||
@interface SentryProfilesSamplerDecision : NSObject | ||
|
||
@property (nonatomic, readonly) SentrySampleDecision decision; | ||
|
||
@property (nullable, nonatomic, strong, readonly) NSNumber *sampleRate; | ||
|
||
- (instancetype)initWithDecision:(SentrySampleDecision)decision | ||
forSampleRate:(nullable NSNumber *)sampleRate; | ||
|
||
@end | ||
|
||
@interface SentryProfilesSampler : NSObject | ||
|
||
/** | ||
* A random number generator | ||
*/ | ||
@property (nonatomic, strong) id<SentryRandom> random; | ||
|
||
/** | ||
* Init a ProfilesSampler with given options and random generator. | ||
* @param options Sentry options with sampling configuration | ||
* @param random A random number generator | ||
*/ | ||
- (instancetype)initWithOptions:(SentryOptions *)options random:(id<SentryRandom>)random; | ||
|
||
/** | ||
* Init a ProfilesSampler with given options and a default Random generator. | ||
* @param options Sentry options with sampling configuration | ||
*/ | ||
- (instancetype)initWithOptions:(SentryOptions *)options; | ||
|
||
/** | ||
* Determines whether a profile should be sampled based on the context, options, and | ||
* whether the trace corresponding to the profile was sampled. | ||
*/ | ||
- (SentryProfilesSamplerDecision *)sample:(SentrySamplingContext *)context | ||
tracesSamplerDecision:(SentryTracesSamplerDecision *)tracesSamplerDecision; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.