-
-
Notifications
You must be signed in to change notification settings - Fork 340
/
Copy pathSentryScope.h
165 lines (134 loc) · 4.39 KB
/
SentryScope.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#if __has_include(<Sentry/Sentry.h>)
# import <Sentry/SentryDefines.h>
# import <Sentry/SentrySerializable.h>
# import <Sentry/SentrySpanProtocol.h>
#else
# import <SentryWithoutUIKit/SentryDefines.h>
# import <SentryWithoutUIKit/SentrySerializable.h>
# import <SentryWithoutUIKit/SentrySpanProtocol.h>
#endif
@class SentryAttachment;
@class SentryBreadcrumb;
@class SentryOptions;
@class SentryUser;
NS_ASSUME_NONNULL_BEGIN
/**
* The scope holds useful information that should be sent along with the event. For instance tags or
* breadcrumbs are stored on the scope.
* @see
* https://docs.sentry.io/platforms/apple/enriching-events/scopes/#whats-a-scope-whats-a-hub
*/
NS_SWIFT_NAME(Scope)
@interface SentryScope : NSObject <SentrySerializable>
/**
* Returns current Span or Transaction.
* @return current Span or Transaction or null if transaction has not been set.
*/
@property (nullable, nonatomic, strong) id<SentrySpan> span;
/**
* The id of current session replay.
*/
@property (nullable, nonatomic, strong) NSString *replayId;
/**
* Gets the dictionary of currently set tags.
*/
@property (nonatomic, readonly, copy) NSDictionary<NSString *, NSString *> *tags;
- (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs NS_DESIGNATED_INITIALIZER;
- (instancetype)init;
- (instancetype)initWithScope:(SentryScope *)scope;
/**
* Set global user -> thus will be sent with every event
*/
- (void)setUser:(SentryUser *_Nullable)user;
/**
* Set a global tag. Tags are searchable key/value string pairs attached to
* every event.
*/
- (void)setTagValue:(NSString *)value forKey:(NSString *)key NS_SWIFT_NAME(setTag(value:key:));
/**
* Remove the tag for the specified key.
*/
- (void)removeTagForKey:(NSString *)key NS_SWIFT_NAME(removeTag(key:));
/**
* Set global tags. Tags are searchable key/value string pairs attached to every
* event.
*/
- (void)setTags:(NSDictionary<NSString *, NSString *> *_Nullable)tags;
/**
* Set global extra -> these will be sent with every event
*/
- (void)setExtras:(NSDictionary<NSString *, id> *_Nullable)extras;
/**
* Set global extra -> these will be sent with every event
*/
- (void)setExtraValue:(id _Nullable)value
forKey:(NSString *)key NS_SWIFT_NAME(setExtra(value:key:));
/**
* Remove the extra for the specified key.
*/
- (void)removeExtraForKey:(NSString *)key NS_SWIFT_NAME(removeExtra(key:));
/**
* Set @c dist in the scope
*/
- (void)setDist:(NSString *_Nullable)dist;
/**
* Set @c environment in the scope
*/
- (void)setEnvironment:(NSString *_Nullable)environment;
/**
* Sets the @c fingerprint in the scope
*/
- (void)setFingerprint:(NSArray<NSString *> *_Nullable)fingerprint;
/**
* Sets the @c level in the scope
*/
- (void)setLevel:(enum SentryLevel)level;
/**
* Add a breadcrumb to the scope
*/
- (void)addBreadcrumb:(SentryBreadcrumb *)crumb NS_SWIFT_NAME(addBreadcrumb(_:));
- (void)add:(SentryBreadcrumb *)crumb DEPRECATED_MSG_ATTRIBUTE("use `addBreadcrumb` instead")
NS_SWIFT_NAME(add(_:));
/**
* Clears all breadcrumbs in the scope
*/
- (void)clearBreadcrumbs;
/**
* Serializes the Scope to JSON
*/
- (NSDictionary<NSString *, id> *)serialize;
/**
* Sets context values which will overwrite SentryEvent.context when event is
* "enriched" with scope before sending event.
*/
- (void)setContextValue:(NSDictionary<NSString *, id> *)value
forKey:(NSString *)key NS_SWIFT_NAME(setContext(value:key:));
/**
* Remove the context for the specified key.
*/
- (void)removeContextForKey:(NSString *)key NS_SWIFT_NAME(removeContext(key:));
/**
* Adds an attachment to the Scope's list of attachments. The SDK adds the attachment to every event
* sent to Sentry.
* @param attachment The attachment to add to the Scope's list of attachments.
*/
- (void)addAttachment:(SentryAttachment *)attachment NS_SWIFT_NAME(addAttachment(_:));
// We want to keep the old Swift `add(_ attachment:)` function as deprecated, but we cant have
// another objc `add` method
- (void)includeAttachment:(SentryAttachment *)attachment
DEPRECATED_MSG_ATTRIBUTE("use `addAttachment` instead")NS_SWIFT_NAME(add(_:));
/**
* Clears all attachments in the scope.
*/
- (void)clearAttachments;
/**
* Clears the current Scope
*/
- (void)clear;
/**
* Mutates the current transaction atomically.
* @param callback the SentrySpanCallback.
*/
- (void)useSpan:(SentrySpanCallback)callback;
@end
NS_ASSUME_NONNULL_END