Skip to content

Commit

Permalink
Merge pull request #46 from wemogy/update/monitoring
Browse files Browse the repository at this point in the history
Add OTEL Names and Sampling
  • Loading branch information
robinmanuelthiel authored Nov 26, 2023
2 parents e7437cc + cb018a2 commit de474d2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class KebabCaseParameterTransformerTests
[InlineData(null, null)]
[InlineData("", null)]
[InlineData("TypicalControllerName", "typical-controller-name")]
public void ShouldTransformMixedCaseString(object value, string expected)
public void ShouldTransformMixedCaseString(object? value, string? expected)
{
var transformer = new KebabCaseParameterTransformer();
var result = transformer.TransformOutbound(value);
Expand Down
9 changes: 6 additions & 3 deletions src/Wemogy.AspNet.Tests/Wemogy.AspNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
8 changes: 6 additions & 2 deletions src/Wemogy.AspNet/Monitoring/MonitoringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using Prometheus;
using Wemogy.Core.Monitoring;

namespace Wemogy.AspNet.Monitoring
Expand Down Expand Up @@ -38,7 +37,11 @@ public static IServiceCollection AddDefaultMonitoring(
{
builder.ConfigureResource((resource) =>
{
resource.AddService(environment.ServiceName, serviceVersion: environment.ServiceVersion);
resource.AddService(
serviceName: environment.ServiceName,
serviceNamespace: environment.ServiceNamespace,
serviceInstanceId: environment.ServiceInstanceId,
serviceVersion: environment.ServiceVersion);
});

builder.AddAspNetCoreInstrumentation();
Expand All @@ -58,6 +61,7 @@ public static IServiceCollection AddDefaultMonitoring(
services.AddOpenTelemetry().UseAzureMonitor(options =>
{
options.ConnectionString = environment.ApplicationInsightsConnectionString;
options.SamplingRatio = environment.ApplicationInsightsSamplingRatio;
});
}

Expand Down
11 changes: 4 additions & 7 deletions src/Wemogy.AspNet/Wemogy.AspNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,21 @@
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.6.0-rc.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.7" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.8" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.5.1" />
<PackageReference Include="prometheus-net" Version="8.0.0" />
<PackageReference Include="prometheus-net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.5" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.14" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.24" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="RestSharp" Version="107.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.4.0" />
<PackageReference Include="Wemogy.Core" Version="3.0.0" />
<PackageReference Include="Wemogy.Core" Version="3.1.1" />
<PackageReference Include="Dapr.AspNetCore" Version="1.10.0" />
</ItemGroup>
</Project>

0 comments on commit de474d2

Please sign in to comment.