File tree 3 files changed +15
-1
lines changed
DatadogCore/Sources/Core/Storage
DatadogInternal/Sources/Benchmarks
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ internal protocol ReadableFile {
35
35
/// Name of this file.
36
36
var name : String { get }
37
37
38
+ /// Current size of this file.
39
+ func size( ) throws -> UInt64
40
+
38
41
/// Creates InputStream for reading the available data from this file.
39
42
func stream( ) throws -> InputStream
40
43
Original file line number Diff line number Diff line change @@ -211,6 +211,12 @@ internal class FilesOrchestrator: FilesOrchestratorType {
211
211
212
212
func delete( readableFile: ReadableFile , deletionReason: BatchDeletedMetric . RemovalReason ) {
213
213
do {
214
+ #if DD_BENCHMARK
215
+ if case . intakeCode = deletionReason {
216
+ try bench. meter. counter ( metric: " ios.benchmark.bytes_deleted " )
217
+ . increment ( by: readableFile. size ( ) , attributes: [ " track " : trackName] )
218
+ }
219
+ #endif
214
220
try readableFile. delete ( )
215
221
// Decrement pending batches at each batch deletion
216
222
_pendingBatches. mutate { $0 -= 1 }
Original file line number Diff line number Diff line change @@ -87,6 +87,11 @@ public protocol BenchmarkCounter {
87
87
}
88
88
89
89
extension BenchmarkCounter {
90
+ /// Increment the counter by one.
91
+ public func increment( attributes: @autoclosure ( ) -> [ String : String ] = [ : ] ) {
92
+ add ( value: 1 , attributes: attributes ( ) )
93
+ }
94
+
90
95
/// Increment the counter.
91
96
///
92
97
/// - parameters:
@@ -99,7 +104,7 @@ extension BenchmarkCounter {
99
104
///
100
105
/// - parameters:
101
106
/// - by: Amount to increment by.
102
- public func increment< Integer> ( by amount: Integer = 1 , attributes: @autoclosure ( ) -> [ String : String ] = [ : ] ) where Integer: BinaryInteger {
107
+ public func increment< Integer> ( by amount: Integer , attributes: @autoclosure ( ) -> [ String : String ] = [ : ] ) where Integer: BinaryInteger {
103
108
add ( value: Double ( amount) , attributes: attributes ( ) )
104
109
}
105
110
}
You can’t perform that action at this time.
0 commit comments