irontelemetry-dotnet/TelemetryOptions.cs

82 lines
2.4 KiB
C#

namespace IronTelemetry.Client;
/// <summary>
/// Configuration options for IronTelemetry SDK.
/// </summary>
public class TelemetryOptions
{
/// <summary>
/// The DSN (Data Source Name) for your project.
/// Format: https://{public_key}@irontelemetry.com
/// </summary>
public string Dsn { get; set; } = string.Empty;
/// <summary>
/// The environment (e.g., "production", "staging", "development").
/// </summary>
public string? Environment { get; set; }
/// <summary>
/// The application version.
/// </summary>
public string? AppVersion { get; set; }
/// <summary>
/// The application build number.
/// </summary>
public string? AppBuild { get; set; }
/// <summary>
/// Sample rate for events (0.0 to 1.0). Default is 1.0 (100%).
/// </summary>
public double SampleRate { get; set; } = 1.0;
/// <summary>
/// Maximum number of breadcrumbs to store. Default is 100.
/// </summary>
public int MaxBreadcrumbs { get; set; } = 100;
/// <summary>
/// Enable debug logging. Default is false.
/// </summary>
public bool Debug { get; set; }
/// <summary>
/// Callback to filter exceptions before sending.
/// Return false to skip sending the exception.
/// </summary>
public Func<Exception, bool>? BeforeSend { get; set; }
/// <summary>
/// Whether to attach stack trace to messages. Default is false.
/// </summary>
public bool AttachStacktrace { get; set; }
/// <summary>
/// Timeout for sending events. Default is 5 seconds.
/// </summary>
public TimeSpan SendTimeout { get; set; } = TimeSpan.FromSeconds(5);
/// <summary>
/// Custom HTTP handler for testing or proxy scenarios.
/// </summary>
public HttpMessageHandler? HttpHandler { get; set; }
/// <summary>
/// Enable offline queue for failed sends. Default is true.
/// When enabled, failed sends are persisted to disk and retried automatically.
/// </summary>
public bool EnableOfflineQueue { get; set; } = true;
/// <summary>
/// Directory to store offline queue. Defaults to LocalApplicationData/IronTelemetry/Queue.
/// </summary>
public string? OfflineQueueDirectory { get; set; }
/// <summary>
/// Maximum items to store in offline queue. Oldest items dropped when exceeded.
/// Default: 1000
/// </summary>
public int MaxOfflineQueueSize { get; set; } = 1000;
}