-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.cs
More file actions
37 lines (30 loc) · 1.09 KB
/
Module.cs
File metadata and controls
37 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using VirtoCommerce.Platform.Core.Logger;
using VirtoCommerce.Platform.Core.Modularity;
namespace VirtoCommerce.OpenTelemetry.Web;
public class Module : IModule, IHasConfiguration
{
public ManifestModuleInfo ModuleInfo { get; set; }
public IConfiguration Configuration { get; set; }
public void Initialize(IServiceCollection serviceCollection)
{
if (!Configuration.GetValue("OpenTelemetry:Enabled", false))
{
return;
}
// Integrate Serilog → OpenTelemetry logging via platform's Serilog pipeline
serviceCollection.AddTransient<ILoggerConfigurationService, OpenTelemetryLoggerConfigurationService>();
// Register OpenTelemetry metrics, tracing, and OTLP exporter
serviceCollection.AddOpenTelemetryModule(Configuration);
}
public void PostInitialize(IApplicationBuilder appBuilder)
{
// Nothing to do here
}
public void Uninstall()
{
// Nothing to do here
}
}