Files
WireMock.Net-wiremock/src/WireMock.Net.OpenTelemetry/OpenTelemetryOptions.cs
Petr Houška 4525c61847 Add OTEL tracing support for Wiremock + automatic OTEL for Aspire integration (#1418)
* Update aspire to 13.1 (examples + code)

Allows usage of aspire CLI which is very useful for dev in codespaces (for my next PR).

* Add OTEL support

* Initial PR feedback

* PR feedback

* PR feedback

* PR feedback

* Cleanup.

* Cleanup

* Fix

* Fix

* Rename stuff around to be more accurate

* PR feedback

* Update WireMock.Net.OpenTelemetry.csproj

Update <Authors>

* PR feedback parser

* PR feedback package versions

* Status code feedback.

* Update preprocessor directives to to Activity Tracing instead of OpenTelemetry. Is more descriptive.

* Add tests

* Improve tests

---------

Co-authored-by: Stef Heyenrath <Stef.Heyenrath@gmail.com>
2026-01-18 17:22:36 +01:00

36 lines
1.4 KiB
C#

// Copyright © WireMock.Net
using JetBrains.Annotations;
namespace WireMock.OpenTelemetry;
/// <summary>
/// OpenTelemetry exporter configuration options for WireMock.Net.
/// These options control the export of traces to an OTLP endpoint.
/// For controlling what data is recorded in traces, configure ActivityTracingOptions in WireMockServerSettings.
/// </summary>
public class OpenTelemetryOptions
{
/// <summary>
/// Gets or sets a value indicating whether to exclude admin interface requests from ASP.NET Core instrumentation.
/// Default is <c>true</c>.
/// </summary>
/// <remarks>
/// This controls the ASP.NET Core HTTP server instrumentation filter.
/// To also exclude admin requests from WireMock's own activity tracing,
/// set <c>ActivityTracingOptions.ExcludeAdminRequests</c> in WireMockServerSettings.
/// </remarks>
[PublicAPI]
public bool ExcludeAdminRequests { get; set; } = true;
/// <summary>
/// Gets or sets the OTLP exporter endpoint URL.
/// When set, traces will be exported to this endpoint using the OTLP protocol.
/// Example: "http://localhost:4317" for gRPC or "http://localhost:4318" for HTTP.
/// If not set, the OTLP exporter will use the <c>OTEL_EXPORTER_OTLP_ENDPOINT</c> environment variable,
/// or fall back to the default endpoint (<c>http://localhost:4317</c> for gRPC).
/// </summary>
[PublicAPI]
public string? OtlpExporterEndpoint { get; set; }
}