Skip to content

Commit d611c0d

Browse files
committed
Remove log-rate limiting
1 parent 502adf7 commit d611c0d

File tree

11 files changed

+181
-742
lines changed

11 files changed

+181
-742
lines changed

tracer/src/Datadog.Trace.Coverage.collector/DataCollectorLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public DataCollectorLogger(DataCollectionLogger logger, DataCollectionContext co
4242
fileSizeLimitBytes: fileConfig.MaxLogFileSizeBytes,
4343
shared: true);
4444

45-
_datadogLogger = new DatadogSerilogLogger(loggerConfiguration.CreateLogger(), new NullLogRateLimiter(), fileConfig);
45+
_datadogLogger = new DatadogSerilogLogger(loggerConfiguration.CreateLogger(), fileConfig);
4646
}
4747
}
4848

tracer/src/Datadog.Trace/Logging/Internal/Configuration/DatadogLoggingConfiguration.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@ namespace Datadog.Trace.Logging.Internal.Configuration;
88

99
internal readonly struct DatadogLoggingConfiguration
1010
{
11-
public readonly int RateLimit;
1211
public readonly FileLoggingConfiguration? File;
1312
public readonly RedactedErrorLoggingConfiguration? ErrorLogging;
1413
public readonly ConsoleLoggingConfiguration? Console;
1514

1615
public DatadogLoggingConfiguration(
17-
int rateLimit,
1816
RedactedErrorLoggingConfiguration? errorLogging,
1917
FileLoggingConfiguration? file,
2018
ConsoleLoggingConfiguration? console)
2119
{
22-
RateLimit = rateLimit;
2320
ErrorLogging = errorLogging;
2421
File = file;
2522
Console = console;

tracer/src/Datadog.Trace/Logging/Internal/DatadogLoggingFactory.cs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ namespace Datadog.Trace.Logging;
2727

2828
internal static class DatadogLoggingFactory
2929
{
30-
// By default, we don't rate limit log messages;
31-
private const int DefaultRateLimit = 0;
3230
private const int DefaultMaxLogFileSize = 10 * 1024 * 1024;
3331

3432
internal const int DefaultConsoleQueueLimit = 1024;
@@ -50,12 +48,7 @@ public static DatadogLoggingConfiguration GetConfiguration(IConfigurationSource
5048

5149
var redactedErrorLogsConfig = GetRedactedErrorTelemetryConfiguration(source, telemetry);
5250

53-
var rateLimit = new ConfigurationBuilder(source, telemetry)
54-
.WithKeys(ConfigurationKeys.LogRateLimit)
55-
.AsInt32(DefaultRateLimit, x => x >= 0)
56-
.Value;
57-
58-
return new DatadogLoggingConfiguration(rateLimit, redactedErrorLogsConfig, fileConfig, consoleConfig);
51+
return new DatadogLoggingConfiguration(redactedErrorLogsConfig, fileConfig, consoleConfig);
5952

6053
static bool Contains(string[] items, string value)
6154
{
@@ -149,20 +142,7 @@ private static ConsoleLoggingConfiguration GetConsoleLoggingConfiguration(IConfi
149142

150143
var internalLogger = loggerConfiguration.CreateLogger();
151144

152-
ILogRateLimiter rateLimiter;
153-
154-
try
155-
{
156-
rateLimiter = config.RateLimit == 0
157-
? new NullLogRateLimiter()
158-
: new LogRateLimiter(config.RateLimit);
159-
}
160-
catch
161-
{
162-
rateLimiter = new NullLogRateLimiter();
163-
}
164-
165-
return new DatadogSerilogLogger(internalLogger, rateLimiter, config.File);
145+
return new DatadogSerilogLogger(internalLogger, config.File);
166146
}
167147

168148
[TestingAndPrivateOnly]

tracer/src/Datadog.Trace/Logging/Internal/DatadogSerilogLogger.cs

Lines changed: 126 additions & 159 deletions
Large diffs are not rendered by default.

tracer/src/Datadog.Trace/Logging/Internal/IDatadogLogger.cs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,107 +18,107 @@ internal interface IDatadogLogger
1818

1919
bool IsEnabled(LogEventLevel level);
2020

21-
void Debug(string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
21+
void Debug(string messageTemplate);
2222

23-
void Debug<T>(string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
23+
void Debug<T>(string messageTemplate, T property);
2424

25-
void Debug<T0, T1>(string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
25+
void Debug<T0, T1>(string messageTemplate, T0 property0, T1 property1);
2626

27-
void Debug<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
27+
void Debug<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2);
2828

29-
void Debug<T0, T1, T2, T3>(string messageTemplate, T0 property0, T1 property1, T2 property2, T3 property3, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
29+
void Debug<T0, T1, T2, T3>(string messageTemplate, T0 property0, T1 property1, T2 property2, T3 property3);
3030

31-
void Debug(string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
31+
void Debug(string messageTemplate, object?[] args);
3232

33-
void Debug(Exception? exception, string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
33+
void Debug(Exception? exception, string messageTemplate);
3434

35-
void Debug<T>(Exception? exception, string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
35+
void Debug<T>(Exception? exception, string messageTemplate, T property);
3636

37-
void Debug<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
37+
void Debug<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1);
3838

39-
void Debug<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
39+
void Debug<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2);
4040

41-
void Debug(Exception? exception, string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
41+
void Debug(Exception? exception, string messageTemplate, object?[] args);
4242

43-
void Information(string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
43+
void Information(string messageTemplate);
4444

45-
void Information<T>(string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
45+
void Information<T>(string messageTemplate, T property);
4646

47-
void Information<T0, T1>(string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
47+
void Information<T0, T1>(string messageTemplate, T0 property0, T1 property1);
4848

49-
void Information<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
49+
void Information<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2);
5050

51-
void Information(string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
51+
void Information(string messageTemplate, object?[] args);
5252

53-
void Information(Exception? exception, string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
53+
void Information(Exception? exception, string messageTemplate);
5454

55-
void Information<T>(Exception? exception, string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
55+
void Information<T>(Exception? exception, string messageTemplate, T property);
5656

57-
void Information<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
57+
void Information<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1);
5858

59-
void Information<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
59+
void Information<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2);
6060

61-
void Information(Exception? exception, string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
61+
void Information(Exception? exception, string messageTemplate, object?[] args);
6262

63-
void Warning(string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
63+
void Warning(string messageTemplate);
6464

65-
void Warning<T>(string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
65+
void Warning<T>(string messageTemplate, T property);
6666

67-
void Warning<T0, T1>(string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
67+
void Warning<T0, T1>(string messageTemplate, T0 property0, T1 property1);
6868

69-
void Warning<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
69+
void Warning<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2);
7070

71-
void Warning(string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
71+
void Warning(string messageTemplate, object?[] args);
7272

73-
void Warning(Exception? exception, string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
73+
void Warning(Exception? exception, string messageTemplate);
7474

75-
void Warning<T>(Exception? exception, string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
75+
void Warning<T>(Exception? exception, string messageTemplate, T property);
7676

77-
void Warning<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
77+
void Warning<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1);
7878

79-
void Warning<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
79+
void Warning<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2);
8080

81-
void Warning(Exception? exception, string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
81+
void Warning(Exception? exception, string messageTemplate, object?[] args);
8282

83-
void Error(string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
83+
void Error(string messageTemplate);
8484

85-
void Error<T>(string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
85+
void Error<T>(string messageTemplate, T property);
8686

87-
void Error<T0, T1>(string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
87+
void Error<T0, T1>(string messageTemplate, T0 property0, T1 property1);
8888

89-
void Error<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
89+
void Error<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2);
9090

91-
void Error(string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
91+
void Error(string messageTemplate, object?[] args);
9292

93-
void Error(Exception? exception, string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
93+
void Error(Exception? exception, string messageTemplate);
9494

95-
void Error<T>(Exception? exception, string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
95+
void Error<T>(Exception? exception, string messageTemplate, T property);
9696

97-
void Error<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
97+
void Error<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1);
9898

99-
void Error<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
99+
void Error<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2);
100100

101-
void Error(Exception? exception, string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
101+
void Error(Exception? exception, string messageTemplate, object?[] args);
102102

103-
void ErrorSkipTelemetry(string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
103+
void ErrorSkipTelemetry(string messageTemplate);
104104

105-
void ErrorSkipTelemetry<T>(string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
105+
void ErrorSkipTelemetry<T>(string messageTemplate, T property);
106106

107-
void ErrorSkipTelemetry<T0, T1>(string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
107+
void ErrorSkipTelemetry<T0, T1>(string messageTemplate, T0 property0, T1 property1);
108108

109-
void ErrorSkipTelemetry<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
109+
void ErrorSkipTelemetry<T0, T1, T2>(string messageTemplate, T0 property0, T1 property1, T2 property2);
110110

111-
void ErrorSkipTelemetry(string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
111+
void ErrorSkipTelemetry(string messageTemplate, object?[] args);
112112

113-
void ErrorSkipTelemetry(Exception? exception, string messageTemplate, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
113+
void ErrorSkipTelemetry(Exception? exception, string messageTemplate);
114114

115-
void ErrorSkipTelemetry<T>(Exception? exception, string messageTemplate, T property, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
115+
void ErrorSkipTelemetry<T>(Exception? exception, string messageTemplate, T property);
116116

117-
void ErrorSkipTelemetry<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
117+
void ErrorSkipTelemetry<T0, T1>(Exception? exception, string messageTemplate, T0 property0, T1 property1);
118118

119-
void ErrorSkipTelemetry<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
119+
void ErrorSkipTelemetry<T0, T1, T2>(Exception? exception, string messageTemplate, T0 property0, T1 property1, T2 property2);
120120

121-
void ErrorSkipTelemetry(Exception? exception, string messageTemplate, object?[] args, [CallerLineNumber] int sourceLine = 0, [CallerFilePath] string sourceFile = "");
121+
void ErrorSkipTelemetry(Exception? exception, string messageTemplate, object?[] args);
122122

123123
void CloseAndFlush();
124124
}

tracer/src/Datadog.Trace/Logging/Internal/ILogRateLimiter.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)