This commit is contained in:
Roland Fieger
2021-10-12 10:55:47 +02:00
parent c384e3bdca
commit fdc816624e
6 changed files with 74 additions and 25 deletions

View File

@@ -15,6 +15,13 @@ using Repositories.Interfaces;
using BusinessLogic.LookupLogic;
using BusinessLogic.LookupLogic.Interfaces;
using SearchLogic;
using OpenTelemetry.Exporter;
using OpenTelemetry.Instrumentation.AspNetCore;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using Elastic.Apm.AspNetCore;
using Elastic.Apm.EntityFrameworkCore;
using Elastic.Apm;
namespace FwSearchApi
{
@@ -24,11 +31,10 @@ namespace FwSearchApi
readonly ILogger<Startup> _logger;
public IConfiguration _configuration { get; }
public Startup(IConfiguration configuration, ILogger<Startup> logger)
public Startup(IConfiguration configuration)
{
_configuration = configuration;
_logger = logger;
_logger.LogInformation("Starting up FeatureWerk Search API");
}
// This method gets called by the runtime. Use this method to add services to the container.
@@ -45,7 +51,16 @@ namespace FwSearchApi
services.AddTransient<ISearchLogic, SearchLogic.SearchLogic>();
services.AddSwaggerGen();
_logger.LogInformation("Services for FeatureWerkAPIs configured");
services.AddOpenTelemetryTracing((builder) => builder
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddConsoleExporter()
.AddOtlpExporter(otlpOptions => {
otlpOptions.Endpoint = new Uri("http://192.168.178.44:8200");
}));
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -58,6 +73,8 @@ namespace FwSearchApi
app.UseSwagger();
app.UseElasticApm(_configuration, new EfCoreDiagnosticsSubscriber());
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "FeatureWerk Search API V1");