From b9e225c4672bccdb796d72b00d0d3c70fd2e5009 Mon Sep 17 00:00:00 2001 From: Niranjan Ravichandran Date: Wed, 23 Oct 2024 18:01:32 -0400 Subject: [PATCH] Expose the PerformancePreset struct initializer to allow creation of custom presets --- .../logs/SimpleHttpLogExporter.swift | 1 + .../PersistencePerformancePreset.swift | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Sources/Exporters/OpenTelemetryProtocolHttp/logs/SimpleHttpLogExporter.swift b/Sources/Exporters/OpenTelemetryProtocolHttp/logs/SimpleHttpLogExporter.swift index 324d2885..58ffa7b6 100644 --- a/Sources/Exporters/OpenTelemetryProtocolHttp/logs/SimpleHttpLogExporter.swift +++ b/Sources/Exporters/OpenTelemetryProtocolHttp/logs/SimpleHttpLogExporter.swift @@ -10,6 +10,7 @@ import OpenTelemetrySdk import FoundationNetworking #endif +/// Simple Otlp Http log exporter that exports logs synchrously. Exports the given log records and returns export status after the network call is complete. public class SimpleHttpLogExporter: OtlpHttpExporterBase, LogRecordExporter { override public init(endpoint: URL = defaultOltpHttpLoggingEndpoint(), config: OtlpConfiguration = OtlpConfiguration(), diff --git a/Sources/Exporters/Persistence/PersistencePerformancePreset.swift b/Sources/Exporters/Persistence/PersistencePerformancePreset.swift index 720d876e..6280d7e6 100644 --- a/Sources/Exporters/Persistence/PersistencePerformancePreset.swift +++ b/Sources/Exporters/Persistence/PersistencePerformancePreset.swift @@ -69,6 +69,36 @@ public struct PersistencePerformancePreset: Equatable, StoragePerformancePreset, let maxExportDelay: TimeInterval let exportDelayChangeRate: Double + public init( + maxFileSize: UInt64, + maxDirectorySize: UInt64, + maxFileAgeForWrite: TimeInterval, + minFileAgeForRead: TimeInterval, + maxFileAgeForRead: TimeInterval, + maxObjectsInFile: Int, + maxObjectSize: UInt64, + synchronousWrite: Bool, + initialExportDelay: TimeInterval, + defaultExportDelay: TimeInterval, + minExportDelay: TimeInterval, + maxExportDelay: TimeInterval, + exportDelayChangeRate: Double + ) { + self.maxFileSize = maxFileSize + self.maxDirectorySize = maxDirectorySize + self.maxFileAgeForWrite = maxFileAgeForWrite + self.minFileAgeForRead = minFileAgeForRead + self.maxFileAgeForRead = maxFileAgeForRead + self.maxObjectsInFile = maxObjectsInFile + self.maxObjectSize = maxObjectSize + self.synchronousWrite = synchronousWrite + self.initialExportDelay = initialExportDelay + self.defaultExportDelay = defaultExportDelay + self.minExportDelay = minExportDelay + self.maxExportDelay = maxExportDelay + self.exportDelayChangeRate = exportDelayChangeRate + } + // MARK: - Predefined presets /// Default performance preset.