forked from getsentry/sentry-cocoa
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSentrySpanProtocol.h
140 lines (117 loc) · 3.68 KB
/
SentrySpanProtocol.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
#import "SentryDefines.h"
#import "SentrySerializable.h"
#import "SentrySpanContext.h"
NS_ASSUME_NONNULL_BEGIN
@class SentrySpanId, SentryId, SentryTraceHeader, SentryMeasurementUnit;
NS_SWIFT_NAME(Span)
@protocol SentrySpan <SentrySerializable>
/**
* The context information of the span.
*/
@property (nonatomic, readonly) SentrySpanContext *context;
/**
* The timestamp of which the span ended.
*/
@property (nullable, nonatomic, strong) NSDate *timestamp;
/**
* The start time of the span.
*/
@property (nullable, nonatomic, strong) NSDate *startTimestamp;
/**
* An arbitrary mapping of additional metadata of the span.
*/
@property (nullable, readonly) NSDictionary<NSString *, id> *data;
/**
* key-value pairs holding additional data about the span.
*/
@property (readonly) NSDictionary<NSString *, NSString *> *tags;
/**
* Whether the span is finished.
*/
@property (readonly) BOOL isFinished;
/**
* Starts a child span.
*
* @param operation Short code identifying the type of operation the span is measuring.
*
* @return SentrySpan
*/
- (id<SentrySpan>)startChildWithOperation:(NSString *)operation
NS_SWIFT_NAME(startChild(operation:));
/**
* Starts a child span.
*
* @param operation Defines the child span operation.
* @param description Define the child span description.
*
* @return SentrySpan
*/
- (id<SentrySpan>)startChildWithOperation:(NSString *)operation
description:(nullable NSString *)description
NS_SWIFT_NAME(startChild(operation:description:));
/**
* Sets a value to data.
*/
- (void)setDataValue:(nullable id)value forKey:(NSString *)key NS_SWIFT_NAME(setData(value:key:));
/**
* Use setDataValue instead. This method calls setDataValue, was added by mistake, and will be
* deprecated in a future version.
*/
- (void)setExtraValue:(nullable id)value forKey:(NSString *)key NS_SWIFT_NAME(setExtra(value:key:));
/**
* Removes a data value.
*/
- (void)removeDataForKey:(NSString *)key NS_SWIFT_NAME(removeData(key:));
/**
* Sets a tag value.
*/
- (void)setTagValue:(NSString *)value forKey:(NSString *)key NS_SWIFT_NAME(setTag(value:key:));
/**
* Removes a tag value.
*/
- (void)removeTagForKey:(NSString *)key NS_SWIFT_NAME(removeTag(key:));
/**
* Set a measurement without unit. When setting the measurement without the unit, no formatting
* will be applied to the measurement value in the Sentry product, and the value will be shown as
* is.
*
* @discussion Setting a measurement with the same name on the same transaction multiple times only
* keeps the last value.
*
* @param name the name of the measurement
* @param value the value of the measurement
*/
- (void)setMeasurement:(NSString *)name
value:(NSNumber *)value NS_SWIFT_NAME(setMeasurement(name:value:));
/**
* Set a measurement with specific unit.
*
* @discussion Setting a measurement with the same name on the same transaction multiple times only
* keeps the last value.
*
* @param name the name of the measurement
* @param value the value of the measurement
* @param unit the unit the value is measured in
*/
- (void)setMeasurement:(NSString *)name
value:(NSNumber *)value
unit:(SentryMeasurementUnit *)unit
NS_SWIFT_NAME(setMeasurement(name:value:unit:));
/**
* Finishes the span by setting the end time.
*/
- (void)finish;
/**
* Finishes the span by setting the end time and span status.
*
* @param status The status of this span
* */
- (void)finishWithStatus:(SentrySpanStatus)status NS_SWIFT_NAME(finish(status:));
/**
* Returns the trace information that could be sent as a sentry-trace header.
*
* @return SentryTraceHeader.
*/
- (SentryTraceHeader *)toTraceHeader;
@end
NS_ASSUME_NONNULL_END