Skip to content

Commit

Permalink
feat: or-2605 add marten/wolverine metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
koenmetsu committed Dec 9, 2024
1 parent 9748a32 commit 1ba85f6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions AssociationRegistry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solutio
CONTRIBUTING.md = CONTRIBUTING.md
regen-marten.sh = regen-marten.sh
paket.lock = paket.lock
otel-collector-config.yaml = otel-collector-config.yaml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C812C887-6495-405A-8B99-4F686D243126}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public static IServiceCollection AddMarten(
opts.DatabaseSchemaName = postgreSqlOptions.Schema;
}

opts.OpenTelemetry.TrackConnections = TrackLevel.Normal;
opts.OpenTelemetry.TrackEventCounters();

opts.Connection(postgreSqlOptions.GetConnectionString());
opts.Storage.Add(new VCodeSequence(opts, VCode.StartingVCode));
opts.Serializer(CreateCustomMartenSerializer());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
namespace AssociationRegistry.Admin.Api.Infrastructure.Extensions;

using Acties.GrarConsumer;
using Acties.GrarConsumer.HeradresseerLocaties;
using Acties.GrarConsumer.OntkoppelAdres;
using Amazon.Runtime;
using EventStore;
using Grar.AddressMatch;
using Hosts.Configuration;
using JasperFx.CodeGeneration;
using Serilog;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
using Vereniging;
using Wolverine;
using Wolverine.AmazonSqs;
using Wolverine.ErrorHandling;
using Wolverine.Runtime.Serialization;

public static class WolverineExtensions
{
Expand All @@ -26,7 +20,6 @@ public static void AddWolverine(this WebApplicationBuilder builder)
(context, options) =>
{
Log.Logger.Information("Setting up wolverine");

options.ApplicationAssembly = typeof(Program).Assembly;
options.Discovery.IncludeAssembly(typeof(Vereniging).Assembly);
options.Discovery.IncludeType<TeAdresMatchenLocatieMessage>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ static JsonNetSerializer CreateCustomMartenSerializer()

opts.Connection(connectionString);

opts.OpenTelemetry.TrackConnections = TrackLevel.Normal;
opts.OpenTelemetry.TrackEventCounters();

opts.Events.StreamIdentity = StreamIdentity.AsString;

opts.Events.MetadataConfig.EnableAll();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace AssociationRegistry.OpenTelemetry.Extensions;

using Destructurama;
using global::OpenTelemetry;
using global::OpenTelemetry.Exporter;
using global::OpenTelemetry.Metrics;
using global::OpenTelemetry.Resources;
Expand Down Expand Up @@ -82,6 +83,9 @@ public static IServiceCollection ConfigureOpenTelemetry<T>(this IHostApplication
return services.AddOpenTelemetry()
.ConfigureResource(configureResource)
.WithMetrics(providerBuilder => providerBuilder
.ConfigureResource(configureResource)
.AddMeter($"Wolverine:{serviceName}")
.AddMeter("Marten")
.AddRuntimeInstrumentation()
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
Expand Down

0 comments on commit 1ba85f6

Please sign in to comment.