You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify that the telemetry buffer and the transport don't need to flush
in data loss scenarios. Only forwarding the data to the transport is
sufficient.
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/telemetry-buffer/index.mdx
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,18 +45,18 @@ The BatchProcessor batches spans and logs into one envelope to reduce the number
45
45
46
46
Whenever the SDK finishes a span or captures a log, it MUST put it into the BatchProcessor. The SDK MUST NOT put unfinished spans into the BatchProcessor.
47
47
48
-
The BatchProcessor MUST start a timeout of 5 seconds when the SDK adds the first span or log. When the timeout exceeds, the BatchProcessor MUST send all spans or logs, no matter how many items it contains. The SDK MAY choose a different value for the timeout, but it MUST NOT exceed 30 seconds, as this can lead to problems with the span buffer on the backend, which uses a time interval of 60 seconds for determining segments for spans. The BatchProcessor SHOULD only start a new timeout, when it has spans or logs to send, to avoid running the timeout unnecessarily.
48
+
The BatchProcessor MUST start a timeout of 5 seconds when the SDK adds the first span or log. When the timeout exceeds, the BatchProcessor MUST forward all spans or logs to the transport, no matter how many items it contains. The SDK MAY choose a different value for the timeout, but it MUST NOT exceed 30 seconds, as this can lead to problems with the span buffer on the backend, which uses a time interval of 60 seconds for determining segments for spans. The BatchProcessor SHOULD only start a new timeout, when it has spans or logs to send, to avoid running the timeout unnecessarily.
49
49
50
-
The BatchProcessor MUST send all items after the SDK when containing spans or logs exceeding 1MiB in size. The SDK MAY choose a different value for the max batch size keeping the [envelope max sizes](/sdk/data-model/envelopes/#size-limits) in mind. The SDK MUST calculate the size of a span or a log to manage the BatchProcessor's memory footprint. The SDK MUST serialize the span or log and calculate the size based on the serialized JSON bytes. As serialization is expensive, the BatchProcessor SHOULD keep track of the serialized spans and logs and pass these to the envelope to avoid serializing multiple times.
50
+
The BatchProcessor MUST forward all items to the transport after the SDK when containing spans or logs exceeding 1MiB in size. The SDK MAY choose a different value for the max batch size keeping the [envelope max sizes](/sdk/data-model/envelopes/#size-limits) in mind. The SDK MUST calculate the size of a span or a log to manage the BatchProcessor's memory footprint. The SDK MUST serialize the span or log and calculate the size based on the serialized JSON bytes. As serialization is expensive, the BatchProcessor SHOULD keep track of the serialized spans and logs and pass these to the envelope to avoid serializing multiple times.
51
51
52
-
When the BatchProcessor sends all spans or logs, it MUST reset its timeout and remove all spans and logs. The SDK MUST apply filtering and sampling before adding spans or logs to the BatchProcessor. The SDK MUST apply rate limits to spans and logs after they leave the BatchProcessor to send as much data as possible by dropping data as late as possible.
52
+
When the BatchProcessor forwards all spans or logs to the transport, it MUST reset its timeout and remove all spans and logs. The SDK MUST apply filtering and sampling before adding spans or logs to the BatchProcessor. The SDK MUST apply rate limits to spans and logs after they leave the BatchProcessor to send as much data as possible by dropping data as late as possible.
53
53
54
-
The BatchProcessor MUST send all spans and logs in memory to avoid data loss in the following scenarios:
54
+
The BatchProcessor MUST forward all spans and logs in memory to the transport to avoid data loss in the following scenarios:
55
55
56
-
1. When the user calls `SentrySDK.flush()`, the BatchProcessor MUST send all data in memory.
57
-
2. When the user calls `SentrySDK.close()`, the BatchProcessor MUST send all data in memory.
58
-
3. When the application shuts down gracefully, the BatchProcessor SHOULD send all data in memory. This is mostly relevant for mobile SDKs already subscribed to these hooks, such as [applicationWillTerminate](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/applicationwillterminate(_:)) on iOS.
59
-
4. When the application moves to the background, the BatchProcessor SHOULD send all data in memory and stop the timer. This is mostly relevant for mobile SDKs.
56
+
1. When the user calls `SentrySDK.flush()`, the BatchProcessor MUST forward all data in memory to the transport, and only then the transport SHOULD flush the data.
57
+
2. When the user calls `SentrySDK.close()`, the BatchProcessor MUST forward all data in memory to the transport. SDKs SHOULD keep their existing closing behavior.
58
+
3. When the application shuts down gracefully, the BatchProcessor SHOULD forward all data in memory to the transport. The transport SHOULD keep its existing behavior, which usually stores the data to disk as an envelope. It is not required to call transport `flush`. This is mostly relevant for mobile SDKs already subscribed to these hooks, such as [applicationWillTerminate](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/applicationwillterminate(_:)) on iOS.
59
+
4. When the application moves to the background, the BatchProcessor SHOULD forward all data in memory to the transport and stop the timer. The transport SHOULD keep its existing behavior, which usually stores the data to disk as an envelope. It is not required to call transport `flush`. This is mostly relevant for mobile SDKs.
60
60
5. We're working on concept for crashes, and will update the specification when we have more details.
61
61
62
62
The detailed specification is written in the [Gherkin syntax](https://cucumber.io/docs/gherkin/reference/). The specification uses spans as an example, but the same applies to logs or any other future telemetry data.
@@ -68,15 +68,15 @@ Scenario: No spans in BatchProcessor 1 span added
68
68
When the SDK finishes 1 span
69
69
Then the SDK puts this span to the BatchProcessor
70
70
And starts a timeout of 5 seconds
71
-
And doesn't send the span to Sentry
71
+
And doesn't forward the span to the transport
72
72
73
73
Scenario: Span added before timeout exceeds
74
74
Given span A in the BatchProcessor
75
75
Given 4.9 seconds pass
76
76
When the SDK finishes span B
77
77
Then the SDK adds span B to the BatchProcessor
78
78
And doesn't reset the timeout
79
-
And doesn't send the spans A and B in the BatchProcessor to Sentry
79
+
And doesn't forward the spans A and B in the BatchProcessor to the transport
80
80
81
81
Scenario: Timeout exceeds and no spans or logs to send
82
82
Given no spans in the BatchProcessor
@@ -88,15 +88,15 @@ Scenario: Spans with size of 1 MiB - 1 byte added, timeout exceeds
88
88
Given spans with size of 1 MiB - 1 byte in the BatchProcessor
89
89
When the timeout exceeds
90
90
Then the SDK adds all the spans to one envelope
91
-
And sends them to Sentry
91
+
And forwards them to the transport
92
92
And resets the timeout
93
93
And clears the BatchProcessor
94
94
95
95
Scenario: Spans with size of 1 MiB - 1 byte added within 4.9 seconds
96
96
Given spans with size of 1 MiB - 1 byte in the BatchProcessor
97
97
When the SDK finishes another span and puts it into the BatchProcessor
98
98
Then the BatchProcessor puts all spans into one envelope
0 commit comments