Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change datadog packages #539

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ nuget HtmlAgilityPack 1.11.59

nuget CsvHelper 31.0.2

nuget Datadog.Trace 2.49.0
nuget Datadog.Trace.Bundle 2.49.0

nuget NetTopologySuite 2.5.0
nuget Dapper 2.1.35
nuget NodaTime 3.1.11
Expand Down
27 changes: 16 additions & 11 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ NUGET
System.Memory (>= 4.5)
CsvHelper (31.0.2)
Dapper (2.1.35)
Datadog.Trace (2.49)
System.Diagnostics.DiagnosticSource (>= 4.4.1)
Datadog.Trace.Bundle (2.49)
Datadog.Trace (>= 2.49)
Destructurama.JsonNet (3.0)
Newtonsoft.Json (>= 13.0.3)
Serilog (>= 3.1.1)
Expand Down Expand Up @@ -476,9 +480,9 @@ NUGET
Microsoft.EntityFrameworkCore.Relational (8.0.3)
Microsoft.EntityFrameworkCore (>= 8.0.3)
Microsoft.Extensions.Configuration.Abstractions (>= 8.0)
Microsoft.EntityFrameworkCore.Relational.Design (1.1.6)
Microsoft.EntityFrameworkCore.Relational (>= 1.1.6)
NETStandard.Library (>= 1.6.1)
Microsoft.EntityFrameworkCore.Relational.Design (2.0.0-preview1-final)
Microsoft.EntityFrameworkCore.Relational (>= 2.0.0-preview1-final)
NETStandard.Library (>= 2.0.0-preview1-25301-01)
Microsoft.EntityFrameworkCore.SqlServer (8.0.3)
Microsoft.Data.SqlClient (>= 5.1.5)
Microsoft.EntityFrameworkCore.Relational (>= 8.0.3)
Expand Down Expand Up @@ -667,14 +671,15 @@ NUGET
Microsoft.EntityFrameworkCore.Abstractions (>= 8.0.2)
Microsoft.EntityFrameworkCore.Relational (>= 8.0.2)
Npgsql (>= 8.0.2)
Npgsql.EntityFrameworkCore.PostgreSQL.Design (1.1)
Microsoft.EntityFrameworkCore (>= 1.1)
Microsoft.EntityFrameworkCore.Relational (>= 1.1)
Microsoft.EntityFrameworkCore.Relational.Design (>= 1.1)
Microsoft.Extensions.DependencyInjection (>= 1.1)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 1.1)
Npgsql (>= 3.1.9)
Npgsql.EntityFrameworkCore.PostgreSQL (>= 1.1)
Npgsql.EntityFrameworkCore.PostgreSQL.Design (2.0.0-preview1)
Microsoft.EntityFrameworkCore (>= 2.0.0-preview1-final)
Microsoft.EntityFrameworkCore.Relational (>= 2.0.0-preview1-final)
Microsoft.EntityFrameworkCore.Relational.Design (>= 2.0.0-preview1-final)
Microsoft.Extensions.DependencyInjection (>= 2.0.0-preview1-final)
Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.0.0-preview1-final)
NETStandard.Library (>= 1.6.1)
Npgsql (>= 3.2.2)
Npgsql.EntityFrameworkCore.PostgreSQL (>= 2.0.0-preview1)
NSwag.CodeGeneration (14.0.3)
NJsonSchema.CodeGeneration (>= 11.0)
NSwag.Core (>= 14.0.3)
Expand Down
9 changes: 8 additions & 1 deletion src/PostalRegistry.Api.CrabImport/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.2-bookworm-slim-amd64
RUN mkdir /app && chown -R app:app /app
WORKDIR /app

LABEL maintainer "Digitaal Vlaanderen <[email protected]>"
LABEL maintainer="Digitaal Vlaanderen <[email protected]>"
LABEL registry="postal-registry"

COPY / /app
Expand All @@ -16,6 +16,13 @@ RUN apt-get update && \

EXPOSE 3000/tcp
ENV ASPNETCORE_URLS http://*:3000
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/app/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/app/datadog

# Run the createLogPath script on Linux to ensure the automatic instrumentation logs are generated without permission issues
RUN /app/datadog/createLogPath.sh

# switch to created user
USER app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace PostalRegistry.Api.CrabImport.Infrastructure.Modules
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Api.Exceptions;
using Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac;
using Be.Vlaanderen.Basisregisters.EventHandling;
using Be.Vlaanderen.Basisregisters.EventHandling.Autofac;
using Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac;
Expand Down Expand Up @@ -34,8 +33,6 @@ protected override void Load(ContainerBuilder builder)
{
var eventSerializerSettings = EventsJsonSerializerSettingsProvider.CreateSerializerSettings();

builder.RegisterModule(new DataDogModule(_configuration));

builder
.RegisterModule(new EventHandlingModule(typeof(DomainAssemblyMarker).Assembly, eventSerializerSettings))
.RegisterModule(new EnvelopeModule())
Expand Down
21 changes: 0 additions & 21 deletions src/PostalRegistry.Api.CrabImport/Infrastructure/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace PostalRegistry.Api.CrabImport.Infrastructure
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Api;
using Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac;
using Configuration;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
Expand Down Expand Up @@ -114,32 +113,12 @@ public void Configure(
ILoggerFactory loggerFactory,
IApiVersionDescriptionProvider apiVersionProvider,
MsSqlStreamStore streamStore,
ApiDataDogToggle datadogToggle,
ApiDebugDataDogToggle debugDataDogToggle,
HealthCheckService healthCheckService)
{
StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag, loggerFactory).GetAwaiter().GetResult();
StartupHelpers.EnsureSqlStreamStoreSchema<Startup>(streamStore, loggerFactory);

app
.UseDataDog<Startup>(new DataDogOptions
{
Common =
{
ServiceProvider = serviceProvider,
LoggerFactory = loggerFactory
},
Toggles =
{
Enable = datadogToggle,
Debug = debugDataDogToggle
},
Tracing =
{
ServiceName = _configuration["DataDog:ServiceName"],
}
})

.UseDefaultForApi(new StartupUseOptions
{
Common =
Expand Down
6 changes: 0 additions & 6 deletions src/PostalRegistry.Api.CrabImport/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"ConnectionString": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.PostalRegistry;Trusted_Connection=True;TrustServerCertificate=True;"
},

"DataDog": {
"Enabled": false,
"Debug": false,
"ServiceName": "postal-registry-dev"
},

"BaseUrl": "https://api.staging-basisregisters.vlaanderen/",

"Cors": [
Expand Down
4 changes: 3 additions & 1 deletion src/PostalRegistry.Api.CrabImport/paket.references
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Be.Vlaanderen.Basisregisters.Api
Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency
Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac
Be.Vlaanderen.Basisregisters.EventHandling.Autofac
Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac

AspNetCore.HealthChecks.SqlServer

Datadog.Trace
Datadog.Trace.Bundle

SourceLink.Embed.AllSourceFiles
SourceLink.Copy.PdbFiles
1 change: 0 additions & 1 deletion src/PostalRegistry.Api.CrabImport/paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies
framework: net8.0
Be.Vlaanderen.Basisregisters.Api >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.EventHandling.Autofac >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.ProjectionHandling.SqlStreamStore.Autofac >= LOCKEDVERSION
AspNetCore.HealthChecks.SqlServer >= LOCKEDVERSION
Expand Down
9 changes: 8 additions & 1 deletion src/PostalRegistry.Api.Extract/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.2-bookworm-slim-amd64
RUN mkdir /app && chown -R app:app /app
WORKDIR /app

LABEL maintainer "Digitaal Vlaanderen <[email protected]>"
LABEL maintainer="Digitaal Vlaanderen <[email protected]>"
LABEL registry="postal-registry"

COPY / /app
Expand All @@ -16,6 +16,13 @@ RUN apt-get update && \

EXPOSE 3004/tcp
ENV ASPNETCORE_URLS http://*:3004
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/app/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/app/datadog

# Run the createLogPath script on Linux to ensure the automatic instrumentation logs are generated without permission issues
RUN /app/datadog/createLogPath.sh

# switch to created user
USER app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace PostalRegistry.Api.Extract.Infrastructure.Modules
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Api.Exceptions;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -27,8 +26,6 @@ public ApiModule(

protected override void Load(ContainerBuilder builder)
{
builder.RegisterModule(new DataDogModule(_configuration));

builder
.RegisterModule(new ExtractModule(_configuration, _services, _loggerFactory, false));

Expand Down
35 changes: 7 additions & 28 deletions src/PostalRegistry.Api.Extract/Infrastructure/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace PostalRegistry.Api.Extract.Infrastructure
{
using System;
using System.Linq;
using System.Reflection;
using Asp.Versioning.ApiExplorer;
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Api;
Expand All @@ -8,17 +12,12 @@ namespace PostalRegistry.Api.Extract.Infrastructure
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using Modules;
using Projections.Extract;
using System;
using System.Linq;
using System.Reflection;
using Asp.Versioning.ApiExplorer;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.OpenApi.Models;

public class Startup
{
Expand Down Expand Up @@ -114,31 +113,11 @@ public void Configure(
IHostApplicationLifetime appLifetime,
ILoggerFactory loggerFactory,
IApiVersionDescriptionProvider apiVersionProvider,
ApiDataDogToggle datadogToggle,
ApiDebugDataDogToggle debugDataDogToggle,
HealthCheckService healthCheckService)
{
StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag, loggerFactory).GetAwaiter().GetResult();

app
.UseDataDog<Startup>(new DataDogOptions
{
Common =
{
ServiceProvider = serviceProvider,
LoggerFactory = loggerFactory
},
Toggles =
{
Enable = datadogToggle,
Debug = debugDataDogToggle
},
Tracing =
{
ServiceName = _configuration["DataDog:ServiceName"],
}
})

.UseDefaultForApi(new StartupUseOptions
{
Common =
Expand Down
6 changes: 0 additions & 6 deletions src/PostalRegistry.Api.Extract/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"ExtractProjectionsAdmin": "Server=(localdb)\\mssqllocaldb;Database=EFProviders.InMemory.PostalRegistry;Trusted_Connection=True;TrustServerCertificate=True;"
},

"DataDog": {
"Enabled": false,
"Debug": false,
"ServiceName": "PostalRegistry Extract"
},

"BaseUrl": "https://api.staging-basisregisters.vlaanderen/",

"Cors": [
Expand Down
4 changes: 3 additions & 1 deletion src/PostalRegistry.Api.Extract/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ Be.Vlaanderen.Basisregisters.AggregateSource
Be.Vlaanderen.Basisregisters.Api
Be.Vlaanderen.Basisregisters.GrAr.Extracts
Be.Vlaanderen.Basisregisters.EventHandling.Autofac
Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac

AspNetCore.HealthChecks.SqlServer

Datadog.Trace
Datadog.Trace.Bundle

SourceLink.Embed.AllSourceFiles
SourceLink.Copy.PdbFiles
1 change: 0 additions & 1 deletion src/PostalRegistry.Api.Extract/paket.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies
Be.Vlaanderen.Basisregisters.Api >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.GrAr.Extracts >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.EventHandling.Autofac >= LOCKEDVERSION
Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac >= LOCKEDVERSION
AspNetCore.HealthChecks.SqlServer >= LOCKEDVERSION

files
Expand Down
9 changes: 8 additions & 1 deletion src/PostalRegistry.Api.Legacy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.2-bookworm-slim-amd64
RUN mkdir /app && chown -R app:app /app
WORKDIR /app

LABEL maintainer "Digitaal Vlaanderen <[email protected]>"
LABEL maintainer="Digitaal Vlaanderen <[email protected]>"
LABEL registry="postal-registry"

COPY / /app
Expand All @@ -16,6 +16,13 @@ RUN apt-get update && \

EXPOSE 3002/tcp
ENV ASPNETCORE_URLS http://*:3002
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/app/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/app/datadog

# Run the createLogPath script on Linux to ensure the automatic instrumentation logs are generated without permission issues
RUN /app/datadog/createLogPath.sh

# switch to created user
USER app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace PostalRegistry.Api.Legacy.Infrastructure.Modules
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Be.Vlaanderen.Basisregisters.Api.Exceptions;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand All @@ -28,8 +27,6 @@ public ApiModule(

protected override void Load(ContainerBuilder builder)
{
builder.RegisterModule(new DataDogModule(_configuration));

builder
.RegisterModule(new LegacyModule(_configuration, _services, _loggerFactory))
.RegisterModule(new SyndicationModule(_configuration, _services, _loggerFactory));
Expand Down
21 changes: 0 additions & 21 deletions src/PostalRegistry.Api.Legacy/Infrastructure/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace PostalRegistry.Api.Legacy.Infrastructure
using System.Linq;
using System.Reflection;
using Asp.Versioning.ApiExplorer;
using Be.Vlaanderen.Basisregisters.DataDog.Tracing.Autofac;
using Microsoft.OpenApi.Models;

/// <summary>Represents the startup process for the application.</summary>
Expand Down Expand Up @@ -117,31 +116,11 @@ public void Configure(
IHostApplicationLifetime appLifetime,
ILoggerFactory loggerFactory,
IApiVersionDescriptionProvider apiVersionProvider,
ApiDataDogToggle datadogToggle,
ApiDebugDataDogToggle debugDataDogToggle,
HealthCheckService healthCheckService)
{
StartupHelpers.CheckDatabases(healthCheckService, DatabaseTag, loggerFactory).GetAwaiter().GetResult();

app
.UseDataDog<Startup>(new DataDogOptions
{
Common =
{
ServiceProvider = serviceProvider,
LoggerFactory = loggerFactory
},
Toggles =
{
Enable = datadogToggle,
Debug = debugDataDogToggle
},
Tracing =
{
ServiceName = _configuration["DataDog:ServiceName"],
}
})

.UseDefaultForApi(new StartupUseOptions
{
Common =
Expand Down
Loading
Loading