mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 00:27:04 +01:00
Small updates to WireMock.Net.OpenTelemetry
This commit is contained in:
@@ -63,6 +63,7 @@ A C# .NET version based on [mock4net](https://github.com/alexvictoor/mock4net) w
|
||||
| **WireMock.Net.MimePart** | [](https://www.nuget.org/packages/WireMock.Net.MimePart) | [](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.MimePart)
|
||||
| **WireMock.Net.GraphQL** | [](https://www.nuget.org/packages/WireMock.Net.GraphQL) | [](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.GraphQL)
|
||||
| **WireMock.Net.ProtoBuf** | [](https://www.nuget.org/packages/WireMock.Net.ProtoBuf) | [](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.ProtoBuf)
|
||||
| **WireMock.Net.OpenTelemetry** | [](https://www.nuget.org/packages/WireMock.Net.ProtoBuf) | [](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.OpenTelemetry)
|
||||
| | | |
|
||||
| **WireMock.Net.RestClient** | [](https://www.nuget.org/packages/WireMock.Net.RestClient) | [](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.RestClient)
|
||||
| **WireMock.Org.RestClient** | [](https://www.nuget.org/packages/WireMock.Org.RestClient) | [](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Org.RestClient)
|
||||
|
||||
@@ -6,4 +6,4 @@ builder.AddProject<Projects.AspireApp1_Web>("webfrontend")
|
||||
.WithExternalHttpEndpoints()
|
||||
.WithReference(apiService);
|
||||
|
||||
builder.Build().Run();
|
||||
await builder.Build().RunAsync();
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Trace;
|
||||
using WireMock.OpenTelemetry;
|
||||
using WireMock.Server;
|
||||
using WireMock.Settings;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.OpenTelemetry;
|
||||
|
||||
Console.WriteLine("=== WireMock.Net OpenTelemetry Tracing Demo ===\n");
|
||||
|
||||
@@ -31,8 +31,9 @@ Console.WriteLine("=== WireMock.Net OpenTelemetry Tracing Demo ===\n");
|
||||
// Option 1: Custom TracerProvider with Console exporter for this demo
|
||||
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
|
||||
.AddWireMockInstrumentation(new OpenTelemetryOptions() { ExcludeAdminRequests = true })
|
||||
.AddHttpClientInstrumentation() // HTTP client traces (for our test requests)
|
||||
.AddConsoleExporter() // Export traces to console for demo purposes
|
||||
.AddHttpClientInstrumentation() // HTTP client traces (for our test requests)
|
||||
.AddConsoleExporter() // Export traces to console for demo purposes
|
||||
.AddOtlpExporter() // Export to real OTLP collector (e.g. Jaeger, Tempo, etc.)
|
||||
.Build();
|
||||
|
||||
Console.WriteLine("Console Exporter configured to visualize:");
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.14.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.14.0" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net.OpenTelemetry\WireMock.Net.OpenTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\WireMock.Net.OpenTelemetry\WireMock.Net.OpenTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#if ACTIVITY_TRACING_SUPPORTED
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using WireMock.Logging;
|
||||
|
||||
@@ -198,4 +197,4 @@ public static class WireMockActivitySource
|
||||
activity.SetTag("exception.stacktrace", exception.ToString());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,11 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WireMock.Owin.ActivityTracing;
|
||||
|
||||
/// <summary>
|
||||
@@ -31,4 +25,4 @@ internal static class WireMockSemanticConventions
|
||||
public const string RequestGuid = "wiremock.request.guid";
|
||||
public const string RequestBody = "wiremock.request.body";
|
||||
public const string ResponseBody = "wiremock.response.body";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!--<Version>0.0.1-preview-01</Version>-->
|
||||
<Description>OpenTelemetry exporter support for WireMock.Net</Description>
|
||||
<AssemblyTitle>WireMock.Net.OpenTelemetry</AssemblyTitle>
|
||||
<Authors>Petr Houška</Authors>
|
||||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<RootNamespace>WireMock.OpenTelemetry</RootNamespace>
|
||||
<PackageTags>wiremock;opentelemetry;otel;tracing;telemetry</PackageTags>
|
||||
<RootNamespace>WireMock</RootNamespace>
|
||||
<ProjectGuid>{C8F4E6D2-9A3B-4F1C-8D5E-7A2B3C4D5E6F}</ProjectGuid>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
@@ -26,7 +27,6 @@
|
||||
|
||||
<!-- OpenTelemetry packages -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenTelemetry" Version="1.14.0" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.14.0" />
|
||||
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
@@ -112,4 +111,4 @@ public static class WireMockOpenTelemetryExtensions
|
||||
|
||||
return tracing;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user