Skip to content

Commit a363508

Browse files
committed
feat(): add mtls support
1 parent 154a6dc commit a363508

File tree

9 files changed

+1158
-10
lines changed

9 files changed

+1158
-10
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/OpenTelemetryProtocolExporterEventSource.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,74 @@ void IConfigurationExtensionsLogger.LogInvalidConfigurationValue(string key, str
240240
{
241241
this.InvalidConfigurationValue(key, value);
242242
}
243+
244+
#if NET8_0_OR_GREATER
245+
[Event(26, Message = "{0} loaded successfully from '{1}'.", Level = EventLevel.Informational)]
246+
internal void MtlsCertificateLoaded(string certificateType, string filePath) =>
247+
this.WriteEvent(26, certificateType, filePath);
248+
249+
[Event(27, Message = "Failed to load {0} from '{1}'. Error: {2}", Level = EventLevel.Error)]
250+
internal void MtlsCertificateLoadFailed(
251+
string certificateType,
252+
string filePath,
253+
string error) => this.WriteEvent(27, certificateType, filePath, error);
254+
255+
[Event(28, Message = "{0} file not found at path: '{1}'.", Level = EventLevel.Error)]
256+
internal void MtlsCertificateFileNotFound(string certificateType, string filePath) =>
257+
this.WriteEvent(28, certificateType, filePath);
258+
259+
[Event(
260+
29,
261+
Message = "File permission check failed for {0} at '{1}'. Error: {2}",
262+
Level = EventLevel.Warning)]
263+
internal void MtlsFilePermissionCheckFailed(
264+
string certificateType,
265+
string filePath,
266+
string error) => this.WriteEvent(29, certificateType, filePath, error);
267+
268+
[Event(
269+
30,
270+
Message = "File permission warning for {0} at '{1}': {2}",
271+
Level = EventLevel.Warning)]
272+
internal void MtlsFilePermissionWarning(
273+
string certificateType,
274+
string filePath,
275+
string warning) => this.WriteEvent(30, certificateType, filePath, warning);
276+
277+
[Event(
278+
31,
279+
Message = "{0} chain validation failed for certificate '{1}'. Errors: {2}",
280+
Level = EventLevel.Error)]
281+
internal void MtlsCertificateChainValidationFailed(
282+
string certificateType,
283+
string subject,
284+
string errors) => this.WriteEvent(31, certificateType, subject, errors);
285+
286+
[Event(
287+
32,
288+
Message = "{0} chain validated successfully for certificate '{1}'.",
289+
Level = EventLevel.Informational)]
290+
internal void MtlsCertificateChainValidated(string certificateType, string subject) =>
291+
this.WriteEvent(32, certificateType, subject);
292+
293+
[Event(
294+
33,
295+
Message = "Server certificate validated successfully for '{0}'.",
296+
Level = EventLevel.Informational)]
297+
internal void MtlsServerCertificateValidated(string subject) => this.WriteEvent(33, subject);
298+
299+
[Event(
300+
34,
301+
Message = "Server certificate validation failed for '{0}'. Errors: {1}",
302+
Level = EventLevel.Error)]
303+
internal void MtlsServerCertificateValidationFailed(string subject, string errors) =>
304+
this.WriteEvent(34, subject, errors);
305+
306+
[Event(
307+
35,
308+
Message = "mTLS configuration enabled. Client certificate: '{0}'.",
309+
Level = EventLevel.Informational)]
310+
internal void MtlsConfigurationEnabled(string clientCertificateSubject) =>
311+
this.WriteEvent(35, clientCertificateSubject);
312+
#endif
243313
}

0 commit comments

Comments
 (0)