Skip to content

Commit 27e1069

Browse files
committed
feat(): add mtls support
1 parent dc97cc1 commit 27e1069

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,17 @@ void IConfigurationExtensionsLogger.LogInvalidConfigurationValue(string key, str
244244
#if NET8_0_OR_GREATER
245245
[Event(26, Message = "{0} loaded successfully from '{1}'.", Level = EventLevel.Informational)]
246246
internal void MtlsCertificateLoaded(string certificateType, string filePath) =>
247-
this.WriteEvent(25, certificateType, filePath);
247+
this.WriteEvent(26, certificateType, filePath);
248248

249249
[Event(27, Message = "Failed to load {0} from '{1}'. Error: {2}", Level = EventLevel.Error)]
250250
internal void MtlsCertificateLoadFailed(
251251
string certificateType,
252252
string filePath,
253-
string error) => this.WriteEvent(26, certificateType, filePath, error);
253+
string error) => this.WriteEvent(27, certificateType, filePath, error);
254254

255255
[Event(28, Message = "{0} file not found at path: '{1}'.", Level = EventLevel.Error)]
256256
internal void MtlsCertificateFileNotFound(string certificateType, string filePath) =>
257-
this.WriteEvent(27, certificateType, filePath);
257+
this.WriteEvent(28, certificateType, filePath);
258258

259259
[Event(
260260
29,
@@ -263,7 +263,7 @@ internal void MtlsCertificateFileNotFound(string certificateType, string filePat
263263
internal void MtlsFilePermissionCheckFailed(
264264
string certificateType,
265265
string filePath,
266-
string error) => this.WriteEvent(28, certificateType, filePath, error);
266+
string error) => this.WriteEvent(29, certificateType, filePath, error);
267267

268268
[Event(
269269
30,
@@ -272,7 +272,7 @@ internal void MtlsFilePermissionCheckFailed(
272272
internal void MtlsFilePermissionWarning(
273273
string certificateType,
274274
string filePath,
275-
string warning) => this.WriteEvent(29, certificateType, filePath, warning);
275+
string warning) => this.WriteEvent(30, certificateType, filePath, warning);
276276

277277
[Event(
278278
31,
@@ -281,33 +281,33 @@ internal void MtlsFilePermissionWarning(
281281
internal void MtlsCertificateChainValidationFailed(
282282
string certificateType,
283283
string subject,
284-
string errors) => this.WriteEvent(30, certificateType, subject, errors);
284+
string errors) => this.WriteEvent(31, certificateType, subject, errors);
285285

286286
[Event(
287287
32,
288288
Message = "{0} chain validated successfully for certificate '{1}'.",
289289
Level = EventLevel.Informational)]
290290
internal void MtlsCertificateChainValidated(string certificateType, string subject) =>
291-
this.WriteEvent(31, certificateType, subject);
291+
this.WriteEvent(32, certificateType, subject);
292292

293293
[Event(
294294
33,
295295
Message = "Server certificate validated successfully for '{0}'.",
296296
Level = EventLevel.Informational)]
297-
internal void MtlsServerCertificateValidated(string subject) => this.WriteEvent(32, subject);
297+
internal void MtlsServerCertificateValidated(string subject) => this.WriteEvent(33, subject);
298298

299299
[Event(
300300
34,
301301
Message = "Server certificate validation failed for '{0}'. Errors: {1}",
302302
Level = EventLevel.Error)]
303303
internal void MtlsServerCertificateValidationFailed(string subject, string errors) =>
304-
this.WriteEvent(33, subject, errors);
304+
this.WriteEvent(34, subject, errors);
305305

306306
[Event(
307307
35,
308308
Message = "mTLS configuration enabled. Client certificate: '{0}'.",
309309
Level = EventLevel.Informational)]
310310
internal void MtlsConfigurationEnabled(string clientCertificateSubject) =>
311-
this.WriteEvent(34, clientCertificateSubject);
311+
this.WriteEvent(35, clientCertificateSubject);
312312
#endif
313313
}

src/OpenTelemetry.Exporter.OpenTelemetryProtocol/OtlpMtlsOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Func<
6060
/// Gets a value indicating whether mTLS is enabled.
6161
/// mTLS is considered enabled if at least the client certificate path is provided.
6262
/// </summary>
63-
public bool IsEnabled => !string.IsNullOrEmpty(this.ClientCertificatePath);
63+
public bool IsEnabled => !string.IsNullOrWhiteSpace(this.ClientCertificatePath);
6464
}
6565

6666
#endif

0 commit comments

Comments
 (0)